NutrientTransportSediment.h
Go to the documentation of this file.
1/*!
2 * \file NutrientTransportSediment.h
3 * \brief Nutrient removed and lost in surface runoff.
4 *
5 * Support three carbon model, static method (orgn.f), C-FARM one carbon model (orgncswat.f),
6 * and CENTURY C/N cycling model (NCsed_leach.f90) from SWAT
7 * As for phosphorus, psed.f of SWAT calculates the attached to sediment in surface runoff.
8 *
9 * Changelog:
10 * - 1. 2016-04-30 - hr - Initial implementation.
11 * - 2. 2016-09-28 - lj - Add CENTURY model of calculating organic nitrogen removed in surface runoff.
12 * - 3. 2017-08-23 - lj - Solve inconsistent results when using openmp to reducing raster data according to subbasin ID.
13 * - 4. 2018-05-08 - lj -
14 * -# Reformat, especially naming style (sync update in "text.h").
15 * -# Code optimization, e.g., use multiply instead of divide.
16 * - 5. 2022-08-22 - lj - Change float to FLTPT.
17 *
18 * \todo Ammonian adsorbed to soil should be considered.
19 * \author Huiran Gao, Liangjun Zhu
20 */
21#ifndef SEIMS_MODULE_NUTRSED_H
22#define SEIMS_MODULE_NUTRSED_H
23
24#include "SimulationModule.h"
25
26/** \defgroup NUTRSED
27 * \ingroup Nutrient
28 * \brief Nutrient removed and lost with the eroded sediment in surface runoff
29 */
30
31/*!
32 * \class NutrientTransportSediment
33 * \ingroup NUTRSED
34 *
35 * \brief Nutrient removed and lost with the eroded sediment in surface runoff
36 *
37 */
38
40public:
42
44
45 void SetValue(const char* key, FLTPT value) OVERRIDE;
46
47 void SetValue(const char* key, int value) OVERRIDE;
48
49 void Set1DData(const char* key, int n, FLTPT* data) OVERRIDE;
50
51 void Set1DData(const char* key, int n, int* data) OVERRIDE;
52
53 void Set2DData(const char* key, int nrows, int ncols, FLTPT** data) OVERRIDE;
54
56
58
60
62
64
65 void Get1DData(const char* key, int* n, FLTPT** data) OVERRIDE;
66
67 void Get2DData(const char* key, int* nrows, int* ncols, FLTPT*** data) OVERRIDE;
68
69private:
70 /*!
71 * \brief check the input data for running CENTURY model. Make sure all the inputs data is available.
72 * \return bool The validity of the inputs data.
73 */
74 bool CheckInputDataCenturyModel();
75
76 /*!
77 * \brief check the input data for running C-FARM one carbon model. Make sure all the inputs data is available.
78 * \return bool The validity of the inputs data.
79 */
80 bool CheckInputDataCFarmModel();
81
82 /*!
83 * \brief calculates the amount of organic nitrogen removed in surface runoff.
84 * orgn.f of SWAT, when CSWAT = 0
85 * \return void
86 */
87 void OrgNRemovedInRunoffStaticMethod(int i);
88
89 /*!
90 * \brief calculates the amount of organic nitrogen removed in surface runoff.
91 * orgnswat.f of SWAT, when CSWAT = 1
92 * \TODO THIS IS ON TODO LIST
93 * \return void
94 */
95 void OrgNRemovedInRunoffCFarmOneCarbonModel(int i);
96
97 /*!
98 * \brief calculates the amount of organic nitrogen removed in surface runoff.
99 * NCsed_leach.f90 of SWAT, when CSWAT = 2
100 * \return void
101 */
102 void OrgNRemovedInRunoffCenturyModel(int i);
103
104 /*!
105 * \brief Calculates the amount of organic and mineral phosphorus attached to sediment in surface runoff.
106 * psed.f of SWAT
107 * \return void
108 */
109 void OrgPAttachedtoSed(int i);
110
111private:
112 /// subbasins number
113 int m_nSubbsns;
114 /// current subbasin ID, 0 for the entire watershed
115 int m_inputSubbsnID;
116 /// cell width of grid map (m)
117 FLTPT m_cellWth;
118 /// cell area of grid map (ha)
119 FLTPT m_cellArea;
120 /// number of cells
121 int m_nCells;
122 /// soil layers
123 int* m_nSoilLyrs;
124 /// maximum soil layers
125 int m_maxSoilLyrs;
126 /// soil rock content, %
127 FLTPT** m_soilRock;
128 /// sol_ul, soil saturated water amount, mm
129 FLTPT** m_soilSat;
130 /* carbon modeling method
131 * = 0 Static soil carbon (old mineralization routines)
132 * = 1 C-FARM one carbon pool model
133 * = 2 Century model
134 */
135 int m_cbnModel;
136 /// enrichment ratio
137 FLTPT* m_enratio;
138
139 ///inputs
140
141 // soil loss caused by water erosion
142 FLTPT* m_olWtrEroSed;
143 // surface runoff generated
144 FLTPT* m_surfRf;
145 //bulk density of the soil
146 FLTPT** m_soilBD;
147 // thickness of soil layer
148 FLTPT** m_soilThk;
149 /// Soil mass (kg/ha)
150 FLTPT** m_soilMass;
151
152 /// subbasin related
153 //! subbasin IDs
154 vector<int> m_subbasinIDs;
155 /// subbasin grid (subbasins ID)
156 int* m_subbsnID;
157 /// subbasins information
158 clsSubbasins* m_subbasinsInfo;
159
160 ///output data
161 //amount of organic nitrogen in surface runoff
162 FLTPT* m_surfRfSedOrgN;
163 //amount of organic phosphorus in surface runoff
164 FLTPT* m_surfRfSedOrgP;
165 //amount of active mineral phosphorus sorbed to sediment in surface runoff
166 FLTPT* m_surfRfSedAbsorbMinP;
167 //amount of stable mineral phosphorus sorbed to sediment in surface runoff
168 FLTPT* m_surfRfSedSorbMinP;
169
170 /// output to channel
171
172 FLTPT* m_surfRfSedOrgNToCh; // amount of organic N in surface runoff to channel, kg
173 FLTPT* m_surfRfSedOrgPToCh; // amount of organic P in surface runoff to channel, kg
174 FLTPT* m_surfRfSedAbsorbMinPToCh; // amount of active mineral P in surface runoff to channel, kg
175 FLTPT* m_surfRfSedSorbMinPToCh; // amount of stable mineral P in surface runoff to channel, kg
176
177 ///input & output
178 //amount of nitrogen stored in the active organic (humic) nitrogen pool, kg N/ha
179 FLTPT** m_soilActvOrgN;
180 //amount of nitrogen stored in the fresh organic (residue) pool, kg N/ha
181 FLTPT** m_soilFrshOrgN;
182 //amount of nitrogen stored in the stable organic N pool, kg N/ha
183 FLTPT** m_soilStabOrgN;
184 //amount of phosphorus stored in the organic P pool, kg P/ha
185 FLTPT** m_soilHumOrgP;
186 //amount of phosphorus stored in the fresh organic (residue) pool, kg P/ha
187 FLTPT** m_soilFrshOrgP;
188 //amount of phosphorus in the soil layer stored in the stable mineral phosphorus pool, kg P/ha
189 FLTPT** m_soilStabMinP;
190 //amount of phosphorus stored in the active mineral phosphorus pool, kg P/ha
191 FLTPT** m_soilActvMinP;
192 /// for C-FARM one carbon model
193 FLTPT** m_soilManP;
194 /// for CENTURY C/Y cycling model
195 /// inputs from other modules
196 FLTPT** m_sol_LSN;
197 FLTPT** m_sol_LMN;
198 FLTPT** m_sol_HPN;
199 FLTPT** m_sol_HSN;
200 FLTPT** m_sol_HPC;
201 FLTPT** m_sol_HSC;
202 FLTPT** m_sol_LMC;
203 FLTPT** m_sol_LSC;
204 FLTPT** m_sol_LS;
205 FLTPT** m_sol_LM;
206 FLTPT** m_sol_LSL;
207 FLTPT** m_sol_LSLC;
208 FLTPT** m_sol_LSLNC;
209 FLTPT** m_sol_BMC;
210 FLTPT** m_sol_WOC;
211 FLTPT** m_soilPerco;
212 FLTPT** m_subSurfRf;
213 /// outputs
214 FLTPT** m_soilIfluCbn; ///< lateral flow Carbon loss in each soil layer
215 FLTPT** m_soilPercoCbn; ///< percolation Carbon loss in each soil layer
216 FLTPT* m_soilIfluCbnPrfl; ///< lateral flow Carbon loss in soil profile
217 FLTPT* m_soilPercoCbnPrfl; ///< percolation Carbon loss in soil profile
218 FLTPT* m_sedLossCbn; ///< amount of C lost with sediment pools
219};
220#endif /* SEIMS_MODULE_NUTRSED_H */
Parent class for all modules in SEIMS.
#define OVERRIDE
A compatible reference to override or blank if not supported by the compiler.
Definition: basic.h:160
void SetValue(const char *key, FLTPT value) OVERRIDE
Set data, DT_Single, float point number (float or double)
void InitialIntermediates() OVERRIDE
Initialize intermediate parameters for reducing computing amount.
int Execute() OVERRIDE
Execute the simulation. Return 0 for success.
bool CheckInputData() OVERRIDE
Check the input data.
void SetValue(const char *key, int value) OVERRIDE
Set data, DT_Single, integer.
void SetSubbasins(clsSubbasins *) OVERRIDE
Set pointer of clsSubbasins class which contains all subbasins information. Added by LJ,...
void InitialOutputs() OVERRIDE
Initialize output variables.
void Set1DData(const char *key, int n, FLTPT *data) OVERRIDE
Set 1D data, by default, DT_Raster1D, float.
void Set2DData(const char *key, int nrows, int ncols, FLTPT **data) OVERRIDE
Set 2D data, by default, DT_Raster2D, float.
void Get1DData(const char *key, int *n, FLTPT **data) OVERRIDE
Get 1D data, by default, DT_Raster1D, float.
void Set1DData(const char *key, int n, int *data) OVERRIDE
Set 1D data, by default, DT_Raster1D, integer.
void Get2DData(const char *key, int *nrows, int *ncols, FLTPT ***data) OVERRIDE
Get 2D data, by default, DT_Raster2D, float.
Nutrient removed and lost with the eroded sediment in surface runoff.
Definition: NutrientTransportSediment.h:39
Manager all Subbasin related parameters and methods.
Definition: clsSubbasin.h:214
Base module for all simulation modules in SEIMS.
Definition: SimulationModule.h:46