soilwater module
Soil water movement and content module.
Model one-dimensional soil water movement (fluxes). Includes groundwater (assumes constant water table depth).
Author - Christopher Teh Boon Sung
SWC namedtuple
SWC(sat, fc, pwp, psd, porosity, airentry)
namedtuple: Soil water characteristics
sat
float: saturation point
fc
float: field capacity
pwp
float: permanent wilting point
psd
float: pore-size distribution
porosity
float: soil porosity
airentry
float: air-entry value
Texture namedtuple
Texture(clay, sand, om)
namedtuple: Soil texture
clay
float: percentage of clay
sand
float: percentage of sand
om
float: percentage of organic matter
AET namedtuple
AET(crop, soil)
namedtuple: Actual or reduction to evapotranspiration (ET)
crop
float: actual crop transpiration (or reduction of crop potential transpiration)
soil
float: actual soil evaporation (or reduction of soil potential evaporation)
RootWater class
Soil water characteristics in the rooting zone.
ATTRIBUTES
wc (float)
: water content (mm)vwc (float)
: water content (m3/m3)critical (float)
: critical water content, below which plant water stress occurs (m3/m3)sat (float)
: saturation point (m3/m3)fc (float)
: field capacity (m3/m3)pwp (float)
: permanent wilting point (m3/m3)
Constructor __init__
RootWater(self)
Create and initialize the RootWater object.
SoilLayer class
Soil layer properties class.
The physical properties of a soil layer, dealing with soil water content and fluxes.
CLASS ATTRIBUTES
flux_fields (list)
: list of flux names (str) to serve as dictionary keys which are['t', 'e', 'influx', 'outflux', 'netflux']
ATTRIBUTES
thick (float)
: Thickness of the soil layer (m)texture
: Sand, clay, and organic matter (%)vwc (float)
: Vol. water content (m3/m3)wc (float)
: Water content (mm)accthick (float)
: Cumulative thickness (m)depth (float)
: Depth of layer from soil surface (m)swc (SWC)
: Soil water characteristics (varying units)ksat (float)
: Saturated hydraulic conductivity (m/day)k (float)
: Hydraulic conductivity (m/day)matric (float)
: Matric head (m)gravity (float)
: Gravity head (m)fluxes (dict)
: Water flux components stored in a dictionary
The keys for the dictionary fluxes
are as follows
't': Plant water uptake via transpiration (m/day)
'e': Loss of water via evaporation (m/day)
'influx': Water entry into layer (m/day)
'outflux': Water exit out of layer (m/day)
'netflux': Difference between influx and outflux (m/day)
METHODS
initialize_layer
: Initialize all attributesupdate_heads_k
: Update the matric head, gravity head, and the unsaturated hydraulic conductivitytothead
: Total/sum of matric and gravity head (m) -getter
method
Note
Volumetric water content (vwc) can be given as a negative value. Negative values are a special code to mean that the water content is a fraction between SAT and FC or between FC and PWP. The codes are along a scale from -3 to -1:
Scale:
-2.75 -2.25 -1.5
[-3 ....|..........|....-2 ...........|..........-1]
PWP FC SAT
so that if the given water content is -1, -2, or -3, it means the water content should be set to saturation, field capacity, or permanent wilting point, respectively. A value of -1.5 means the water content will be set at halfway between SAT and FC. Likewise, -2.25 and -2.75 mean the water content will be lower than FC, where the former (-2.25) means the water content will be set nearer to FC, but the latter (-2.75) closer to PWP.
Any negative values outside the range of -3 to -1 means the water content wil be set at FC.
Constructor __init__
SoilLayer(self)
Create and initialize the SoilLayer object.
initialize_layer
SoilLayer.initialize_layer(self, prevlayer, nextlayer)
Initialize all soil layer attributes.
Note
This function will set the water content to be within the range of SAT and FC or between FC and PWP, if the volumetric water content is given as negative value. See this class's docstring above.
Arguments
- prevlayer (
SoilLayer
): previous soil layer (layer above current layer) - nextlayer (
SoilLayer
): next soil layer (layer beneath current layer)
Returns
None
:
update_heads_k
SoilLayer.update_heads_k(self)
Update matric and gravity heads (m), and unsaturated hydraulic conductivity (m/day).
Update is based on current soil water content.
Returns
None
:
tothead
Total head (m) - getter
method.
Returns
float
: total head
SoilWater class
Soil water balance class.
Model the soil water flow in one dimension and water balance. Include the effect of groundwater, if any, but assume constant water table depth.
EXTERNAL INFORMATION REQUIRED (MUST BE SUPPLIED FROM AN EXTERNAL CLASS)
petcrop (float): Potential transpiration (from crop) (mm/day)
petsoil (float): Potential evaporation (fro soil) (mm/day)
ATTRIBUTES
numintervals (int)
: Number of intervals for integration within a dayrootdepth (float)
: Rooting depth (m)has_watertable (bool)
: True if water table / groundwater is present, else Falsenumlayers (int)
: Number of soil layerslayers (list)
: List of SoilLayer objects (their numbers must match numlayers)rootwater (RootWater)
: Soil water characteristics in the root zonecf (list)
: List of dictionary of cumulative fluxes for every soil layerwaterstresses (AET)
: Reduction to evaporation and transpiration due to water stressnetrain (float)
: Net rainfall (mm/day)aet (AET)
: Actual water loss by evaporation and transpiration (mm/day)
METHODS
net_rainfall
: Net rainfall (mm/day)rooting_depth
: Increase in rooting depth (m)update_rootwater
: Update the water content and water characteristics in the rooting zonereduce_et
: Reduction in evaporation and transpiration (0-1, 1=no stress, 0=max. stress)actual_et
: Actual evaporation and transpiration (mm/day)influx_from_watertable
: Influx of water from the water table (m/day).calc_water_fluxes
: Calculate the various water fluxes (m/day) for all soil layersdaily_water_balance
: Solve for the water content in each soil layerupdate
: Update the soil water properties by solving the water fluxes
Constructor __init__
SoilWater(self, fname_in)
Create and initialize the SoilWater object.
Arguments
- fname_in (str): path and filename of the model initialization file
net_rainfall
SoilWater.net_rainfall(self)
Net rainfall (mm/day).
Returns
float
: net rainfall
rooting_depth
SoilWater.rooting_depth(self)
Increase in rooting depth (m).
Returns
float
: rooting depth
update_rootwater
SoilWater.update_rootwater(self)
Update the water content and water characteristics in the rooting zone.
The RootZone
object will be set here.
Note
Critical soil water content for plant water stress taken as 0.6 or 60% of the difference between soil saturation and permanent wilting point.
Returns
None
:
reduce_et
Reduction in evaporation and transpiration (0-1, 1=no stress, 0=max. stress).
Returns
AET
: namedtuple
containing reduction in E and T (float
)
actual_et
Actual evaporation and transpiration (mm/day).
Arguments
- petcrop (float): potential water loss from the crop (mm/day)
- petsoil (float): potential water loss from the soil (mm/day)
Returns
AET
: namedtuple
containing actual water loss from soil and crop (float
)
influx_from_watertable
SoilWater.influx_from_watertable(self)
Influx of water from the water table (m/day).
Returns
float
: groundwater influx
calc_water_fluxes
SoilWater.calc_water_fluxes(self, petcrop, petsoil, firstrun)
Calculate the various water fluxes (m/day) for all soil layers.
Flux can either have a positive or negative sign
+ve flux - means downward flow
-ve flux - means upward flow (against gravity)
Arguments
- petcrop (float): potential water loss from the crop (mm/day)
- petsoil (float): potential water loss from the soil (mm/day)
- firstrun (bool): set to
True
for first run, elseFalse
.True
means the cumulative fluxes will be initialize with the first set of flux values.False
will accumulate the flux values.
Returns
None
:
daily_water_balance
SoilWater.daily_water_balance(self, petcrop, petsoil)
Solve for the water content in each soil layer.
Arguments
- petcrop (float): potential water loss from the crop (mm/day)
- petsoil (float): potential water loss from the soil (mm/day)
Returns
None
:
update
SoilWater.update(self, external_info)
Update the soil water properties by solving the water fluxes.
Arguments
- external_info (dict): requires information on potential transpiration and evaporation
Returns
None
: