2.0.0b10
catchment modelling framework
Loading...
Searching...
No Matches
Cell Class Reference

This class is the basic landscape object. More...

+ Collaboration diagram for Cell:

Detailed Description

This class is the basic landscape object.

It is the owner of water storages, and the upper and lower boundary conditions of the system (rainfall, atmospheric vapor, deep groundwater)

Public Member Functions

Saturation
void InvalidateSatDepth () const
 Marks the saturated depth as unvalid. This is done automatically, when the state of a layer changes.
 
real get_saturated_depth () const
 Returns the potential \(\Psi_{total}\) of the deepest unsaturated layer as distance from the surface.
 
void set_saturated_depth (real depth)
 Sets the potential \(\Psi_{total}\) of each layer as distance from the surface.
 

Flux nodes of the cell

cmf::upslope::vegetation::Vegetation vegetation
 The vegetation object of the cell.
 
cmf::atmosphere::Meteorologyget_meteorology () const
 Returns the meteorological data source.
 
void set_aerodynamic_resistance (cmf::atmosphere::aerodynamic_resistance::ptr Ra)
 Sets the method to calculate aerodynamic resistance against turbulent sensible heat fluxes.
 
void set_meteorology (const cmf::atmosphere::Meteorology &new_meteo)
 Sets a meteorological data source.
 
void set_weather (const cmf::atmosphere::Weather &weather)
 Sets the weather for this cell. Connectivity to a meteorological station is lost.
 
void set_rainfall (double rainfall)
 Exchanges a timeseries of rainfall with a constant flux.
 
double get_rainfall (cmf::math::Time t) const
 Returns the current rainfall flux in m3/day.
 
void set_rain_source (cmf::atmosphere::RainSource::ptr new_source)
 Changes the current source of rainfall.
 
cmf::atmosphere::RainSource::ptr get_rain_source ()
 Returns the current source for rainfall.
 
void set_uptakestress (const cmf::upslope::ET::RootUptakeStressFunction &stressfunction)
 Uses the given WaterStressFunction for all stressedET like connections to the transpiration target.
 
cmf::water::flux_node::ptr get_evaporation ()
 Returns the end point of all evaporation of this cell (a cmf::water::flux_node)
 
cmf::water::flux_node::ptr get_transpiration ()
 Returns the end point of all transpiration of this cell (a cmf::water::flux_node)
 
cmf::water::flux_node::ptr get_surfacewater ()
 returns the surface water of this cell. This is either a flux node or a cmf::upslope::SurfaceWater
 
surfacewater_ptr surfacewater_as_storage ()
 Makes the surfacewater of this cell a cmf::upslope::SurfaceWater storage.
 
cmf::water::WaterStorage::ptr add_storage (std::string Name, char storage_role='N', bool isopenwater=false)
 Adds a new storage to the cell.
 
ptrdiff_t add_storage (cmf::water::WaterStorage::ptr storage)
 Bounds an existing storage to the cell.
 
real surface_water_coverage () const
 Returns the coverage of the surface water.
 
real heat_flux (cmf::math::Time t) const
 Calculates the surface heat balance.
 
real leave_wetness () const
 Return the fraction of wet leaves in the canopy if a canopy water storage exists.
 
cmf::atmosphere::Weather get_weather (cmf::math::Time t) const
 Returns the current meteorological conditions of the cell at time t.
 

Location

cmf::geometry::point get_position () const
 Returns the location of the cell.
 
double get_area () const
 Returns the area of the cell.
 
double m3_to_mm (double volume) const
 Converts a volume in m3 in mm for the cell area.
 

Layers

size_t layer_count () const
 Returns the number of layers of the cell.
 
cmf::upslope::SoilLayer::ptr get_layer (ptrdiff_t ndx) const
 Returns the layer at position ndx.
 
const layer_listget_layers () const
 Returns the list of layers.
 
cmf::upslope::SoilLayer::ptr add_layer (real lowerboundary, const cmf::upslope::RetentionCurve &r_curve, real saturateddepth=10)
 Adds a layer to the cell.
 
cmf::upslope::SoilLayer::ptr add_layer (real lowerboundary)
 Adds a rather conceptual layer to the cell. Use this version for conceptual models. The retention curve resambles an empty bucket.
 
void remove_last_layer ()
 Remove the lowest layer from this cell.
 
void remove_layers ()
 Removes all layers from this cell.
 
double get_soildepth () const
 Returns the lower boundary of the lowest layer in m.
 

Member Function Documentation

◆ add_layer()

cmf::upslope::SoilLayer::ptr add_layer ( real lowerboundary,
const cmf::upslope::RetentionCurve & r_curve,
real saturateddepth = 10 )

Adds a layer to the cell.

Layers are created using this function

Returns
the new layer
Parameters
lowerboundaryThe maximum depth of the layer in m. If lowerboundary is smaller or equal than the lowerboundary of thelowest layer, an error is raised
r_curveA retention curve. See here for a discussion on retention curves in cmf.
saturateddepthThe initial potential of the new layer in m below surface. Default = 10m (=quite dry)

◆ add_storage()

cmf::water::WaterStorage::ptr add_storage ( std::string Name,
char storage_role = 'N',
bool isopenwater = false )

Adds a new storage to the cell.

Parameters
NameThe name of the storage
storage_roleA shortcut to describe the functional role of the storage new storage. Possible Values:
  • 'C' denotes a canopy storage
  • 'S' denotes a snow storage
  • any other value denotes a storage with an undefined function
isopenwaterIf true, an open water storage with a cmf::river::Prism height function is created

◆ get_layer()

cmf::upslope::SoilLayer::ptr get_layer ( ptrdiff_t ndx) const

Returns the layer at position ndx.

From python this function is masked as a sequence:

l = cell.layers[ndx]

◆ get_layers()

const layer_list & get_layers ( ) const

Returns the list of layers.

From python this function is masked as a property:

layers = cell.layers

◆ get_saturated_depth()

real get_saturated_depth ( ) const

Returns the potential \(\Psi_{total}\) of the deepest unsaturated layer as distance from the surface.

This function is wrapped as the property saturated_depth in Python

◆ heat_flux()

real heat_flux ( cmf::math::Time t) const

Calculates the surface heat balance.

Parameters
tTime step

◆ leave_wetness()

real leave_wetness ( ) const

Return the fraction of wet leaves in the canopy if a canopy water storage exists.

If no canopy storage is present, it returns 0.0 (=empty). The fraction of wet leaves are calculated as the linear filling of the canopy storage.

◆ set_saturated_depth()

void set_saturated_depth ( real depth)

Sets the potential \(\Psi_{total}\) of each layer as distance from the surface.

This function is wrapped as the property saturated_depth in Python

◆ surface_water_coverage()

real surface_water_coverage ( ) const

Returns the coverage of the surface water.

The covered fraction (0..1) is simply modelled as a piecewise linear function of the surface water depth. If the depth is above the aggregate height, the coverage is 1, below it is given as

\[ c = \frac{h_{water}}{\Delta h_{surface}}\]

with c the coverage, \(h_{water}\) the depth of the surface water and \(\Delta h_{surface}\) the amplitude of the surface roughness