SUR_CN.h
Go to the documentation of this file.
1/**
2* @file
3* @version 1.0
4* @author Wu Hui
5* @date 29-December-2010
6*
7* @brief SCS Curve Number Method to calculate infiltration and excess precipitation
8*
9* Revision: Zhiqiang Yu
10* Date: 2011-2-14
11* 1. Because w1 and w2 in equation 2:1.1.6 is fixed, add two variable to store these
12* two coefficients to avoid repeating calculation.
13* 2. When w1 and w2 is calculated using equation 2:1.1.7 and 2:1.1.8, FC and SAT should
14* be FC*rootdepth and SAT*rootdepth rather than (FC-WP)*rootdepth and (SAT-WP)*rootdepth.
15* And the unit conversion of rootdepth would be from m to mm.
16* 3. Overload the function Calculate_CN to calculate the CN of one cell.
17* 4. Delete some parameters and input variables. They are Depre_in,Moist_in and Depression.
18* D_SOMO from soil water balance module and D_DPST from depression module is enough. The
19* initialization of soil moisture and depression storage is the task of soil water balance
20* module and depression module.
21* 5. Modify the name of input and output variables to make it consistent with other modules.
22*
23* Revised LiangJun Zhu
24* 1. Add the support of dynamic multi-layers soil, rather than the fixed 2 layers in previous version.
25* 2.The unit of soil depth and root depth (from crop.dat) are both mm.
26*/
27#ifndef SEIMS_SUR_CN_H
28#define SEIMS_SUR_CN_H
29
30#include "SimulationModule.h"
31
32// using namespace std; // Avoid this statement! by lj.
33
34/*!
35 * \defgroup SUR_CN
36 * \ingroup Hydrology
37 * \brief SCS Curve Number Method to calculate infiltration and excess precipitation
38 *
39 */
40
41/*!
42 * \class SUR_CN
43 * \ingroup SUR_CN
44 * \brief SCS Curve Number Method to calculate infiltration and excess precipitation
45 *
46 */
47class SUR_CN : public SimulationModule {
48public:
49 //! Constructor
50 SUR_CN(void);
51
52 //! Destructor
53 ~SUR_CN(void);
54
55 virtual int Execute(void);
56
57 virtual void SetValue(const char *key, float data);
58
59 virtual void Set1DData(const char *key, int n, float *data);
60
61 virtual void Set2DData(const char *key, int nrows, int ncols, float **data);
62
63 virtual void Get1DData(const char *key, int *n, float **data);
64
65 virtual void Get2DData(const char *key, int *nRows, int *nCols, float ***data);
66
67 bool CheckInputSize(const char *key, int n);
68
69 bool CheckInputData(void);
70
71private:
72 /// number of soil layers, i.e., the maximum soil layers number of all soil types
73 int m_nSoilLayers;
74 /// soil depth
75 float **m_soilDepth;
76 ///// depth of the up two layers(The depth are 10mm and 100 mm, respectively).
77 //float m_depth[2];
78 /// soil depth of the current layer, replace float m_depth[2] in previous version.
79 float *m_upSoilDepth;
80 /// valid cells number
81 int m_nCells;
82 /// soil porosity
83 float **m_porosity;
84 /// water content of soil at field capacity
85 float **m_fieldCap;
86 /// plant wilting point moisture
87 float **m_wiltingPoint;
88
89 /// root depth of plants (mm)
90 float *m_rootDepth;
91 /// CN under moisture condition II
92 float *m_cn2;
93 /// Net precipitation calculated in the interception module (mm)
94 float *m_P_NET;
95 /// Initial soil moisture
96 float *m_initSoilMoisture;
97
98 /// depression storage
99 float *m_SD; // SD(t-1) from the depression storage module
100 /// from interpolation module
101 /// mean air temperature of the current day
102 float *m_tMean;
103 /// snowfall temperature from the parameter database (deg C)
104 float m_Tsnow;
105 /// threshold soil freezing temperature (deg C)
106 float m_Tsoil;
107 /// frozen soil moisture relative to saturation above which no infiltration occur (m3/m3)
108 float m_Sfrozen;
109 /// snowmelt threshold temperature from the parameter database (deg C)
110 float m_T0;
111 /// snowmelt from the snowmelt module (mm)
112 float *m_SM;
113 /// snow accumulation from the snow balance module (mm) at t+1 timestep
114 float *m_SA;
115 /// soil temperature obtained from the soil temperature module (deg C)
116 float *m_TS;
117
118 /// Julian day, not used? by LJ
119 //int m_julianDay;
120
121 // output
122 /// the excess precipitation (mm) of the total nCells
123 float *m_PE;
124 /// soil moisture of each soil layer in current time step
125 float **m_soilMoisture;
126 /// infiltration map of watershed (mm) of the total nCells
127 float *m_INFIL;
128
129 //add by Zhiqiang
130 /// the first shape coefficient in eq. 2:1.1.7 and 2:1.1.8 in SWAT theory 2009, p104
131 float *m_w1;
132 /// the second shape coefficient in eq. 2:1.1.7 and 2:1.1.8 in SWAT theory 2009, p104
133 float *m_w2;
134 /// the retention parameter for the moisture condition I curve number
135 float *m_sMax;
136
137 /// initialize m_w1 and m_w2
138 void initalW1W2(void);
139
140 /// Calculation SCS-CN number
141 float Calculate_CN(float sm, int cell);
142
143 /// initial outputs before execute main function
144 void InitialOutputs(void);
145};
146#endif /* SEIMS_SUR_CN_H */
Parent class for all modules in SEIMS.
virtual void SetValue(const char *key, float data)
Set data, DT_Single, float point number (float or double)
SUR_CN(void)
Constructor.
virtual void Get2DData(const char *key, int *nRows, int *nCols, float ***data)
Get 2D data, by default, DT_Raster2D, float.
virtual void Set2DData(const char *key, int nrows, int ncols, float **data)
Set 2D data, by default, DT_Raster2D, float.
virtual int Execute(void)
Execute the simulation. Return 0 for success.
~SUR_CN(void)
Destructor.
bool CheckInputData(void)
Check the input data.
virtual void Set1DData(const char *key, int n, float *data)
Set 1D data, by default, DT_Raster1D, float.
virtual void Get1DData(const char *key, int *n, float **data)
Get 1D data, by default, DT_Raster1D, float.
SCS Curve Number Method to calculate infiltration and excess precipitation.
Definition: SUR_CN.h:47
Base module for all simulation modules in SEIMS.
Definition: SimulationModule.h:46