LandscapeDNDC 1.37.0
Loading...
Searching...
No Matches
ldndc Namespace Reference

Spatially explicit groundwater model. More...

Classes

struct  BaseRootSystemDNDC
 Interface of the fine root system of a plant: rooting depth, distribution of fine root mass and length across soil layers, root growth restrictions and nitrogen uptake (see Root system). More...
 
class  EcHy
 Hydrology model EcHy. More...
 
struct  manure_properties_t
 Default composition of an organic fertilizer. All values can be overwritten by the corresponding attributes of the manure event (availc, availn, ureafraction, nh4fraction, donfraction, no3fraction, ligninfraction, cellulosefraction). More...
 
struct  metrx_iso_counter_t
 
struct  metrx_p_carbon_t
 
struct  metrx_p_fluxes_t
 
class  NitrogenTransformationInhibitors
 Nitrification and urease inhibitors as explicit pools with first-order decay and concentration dependent inhibition (see Nitrification and urease inhibitors) More...
 
class  PhysiologyGrowthPSIM
 Physiology model PSIM (Physiological Simulation Model) for trees and grass, see PSIM - Physiological Simulation Model for the model description. More...
 
class  PhysiologyPlaMox
 Vegetation model PlaMox: carbon and nitrogen dynamics of crops and grass (see PlaMox - Plant Growth Model). More...
 
class  PhysiologyPNET
 Vegetation model PNET. More...
 
struct  RootSystemDNDC
 Fine root system used by PlaMox and, for the distribution functions and nitrogen uptake, by other physiology modules (see Root system). More...
 
class  SoilChemistryMeTrX
 Biogeochemical model MeTrx. More...
 
class  SoilchemistrySoilDNDCAliasDNDC
 SoilDNDC registered under the former model ID "soilchemistry:dndc". More...
 
class  SoilchemistrySoilDNDCAliasDNDC2
 SoilDNDC registered under the former model ID "soilchemistry:dndc2". More...
 
class  SoilchemistrySoilDNDCAliasSoilchemistryDNDC
 SoilDNDC registered under the former model ID "soilchemistry:soilchemistrydndc". More...
 
struct  tillage_properties_t
 Properties of a tillage operation. All values except legacy can be overwritten by the corresponding attributes of the till event (mixing, incorporation, inversion). More...
 
class  WatercycleDNDC
 Watercycle model WatercycleDNDC. More...
 

Enumerations

enum  lmodule_flag_e {
  LMOD_FLAG_NONE = 0u ,
  LMOD_FLAG_CONTROL = 1u << 0 ,
  LMOD_FLAG_USER = 1u << 1 ,
  LMOD_FLAG_SYSTEM = 1u << 2 ,
  LMOD_FLAG_INITIALIZER = 1u << 3 ,
  LMOD_FLAG_FINALIZER = 1u << 4 ,
  LMOD_FLAG_MAINTENANCE = 1u << 5 ,
  LMOD_FLAG_OUTPUT = 1u << 6 ,
  LMOD_FLAG_TEST_MODULE = 1u << 7 ,
  LMOD_FLAG_CNT_ ,
  LMOD_FLAG_CNT = 1 + 1 + cbm::log2_t< LMOD_FLAG_CNT_-1 >::LOG2
}
 
enum  { LSUB_FLAG_NONE = 0u }
 
enum  c4_photosynthesis_method_e {
  c4_photosynthesis_legacy ,
  c4_photosynthesis_collatz_1992
}
 Photosynthesis method of C4 plants (see C4 photosynthesis) More...
 
enum  
 Lower bounds for number of foliage layers.
 
enum  stomatalconductance_method_e
 Stomatal conductance methods.
 
enum  {
  CPOOL_VL ,
  CPOOL_L ,
  CPOOL_R ,
  CPOOL_B ,
  CPOOL_CNT
}
 Order of carbon pools in array passed to allocate_litter. More...
 
enum  metrx_iso_op_e {
  ISO_OP_INPUT ,
  ISO_OP_REACT ,
  ISO_OP_REDUCE_N2O ,
  ISO_OP_COLUMN_DOWN ,
  ISO_OP_COLUMN_UP ,
  ISO_OP_SPINUP ,
  ISO_OP_SKIP
}
 
enum  metrx_p_checkpoint_e {
  P_CP_ENTRY = 0 ,
  P_CP_SPINUP ,
  P_CP_MGMT ,
  P_CP_END
}
 

Functions

lerr_t assign_soillayer_porosity (double &_porosity_with_stones, size_t const &_nd_stratum, double const &_depth, double const &_stone_fraction, double const &_c_org_without_stones, double const &_bulk_density_without_stones, const ldndc::site::input_class_site_t *_site, const ldndc::soillayers::input_class_soillayers_t *_soillayers, const ldndc::soilparameters::input_class_soilparameters_t *_soilparameters, bool _info=false)
 
lerr_t assign_soillayer_macropores (double &_macropores_with_stones, double &_wc_fc, double &_wc_sat, size_t const &_nd_stratum, double const &_depth, double const &_stone_fraction, double const &_porosity_with_stones, const ldndc::site::input_class_site_t *_site, const ldndc::soillayers::input_class_soillayers_t *_soillayers, const ldndc::soilparameters::input_class_soilparameters_t *_soilparameters, bool _info=false)
 
double resistance_aero_abovecanopy (double const &, double const &)
 returns boundary layer resistance above canopy
 
double resistance_aero_incanopy (double const &, double const &, double const &)
 returns boundary layer resistance within canopy
 
double crown_shape_parameter (double _length, double lref, double ps)
 Returns a crown shape factor which depends on canopy length.
 
void canopy_biomass_distribution (size_t const _fl_cnt_max, size_t const _fl_cnt, double const _ps, double const _h_bottom, double const _h_top, double const *_h_fl, double *_fFol_fl)
 Foliage biomass distribution vertically across canopy.
 
void canopy_lai_distribution (double _sla_min, double _sla_max, double _height_max, double _height_min, double _mFol, double const *_fFol_fl, double const *_h_fl, double *_lai_fl, double *_sla_fl, size_t _foliage_layer_cnt, size_t _foliage_layer_cnt_max)
 Leaf area distribution vertically across the whole canopy.
 
void estimate_single_layer_biomass (double const _ps, double const _h_bottom, double const _h_top, double _lw, double &_fract, double _h_cum_bottom, double _h_cum_top)
 Vertical biomass estimation.
 
void fineroots_biomass_distribution (size_t _sl_cnt_litter, size_t _sl_cnt_soil, double _ps, double _rooting_depth, double *_f_frt_sl, double const *_h_sl)
 
double get_optimum_sap_wood_biomass (MoBiLE_Plant *_p)
 
double get_sapwood_foliage_ratio (MoBiLE_Plant *_p)
 
double sapwood_foliage_area_ratio (double _height, double _qsf_p1, double _qsf_p2)
 
double stomatal_conductance_ballberry_1987 (double, double, double, double)
 Stomatal conductance according to Berry, Woodward and Ball 1987.
 
double stomatal_conductance_leuning_1990 (double, double, double, double, double)
 Stomatal conductance according to Leuning 1990.
 
double stomatal_conductance_leuning_1995_a (double, double, double, double, double, double)
 Stomatal conductance according to Leuning 1995 (humidity response by vapour pressure deficit only).
 
double stomatal_conductance_eller_2020 (double, double, double, double, double, double, double, double, double, double, double)
 Stomatal conductance according to Eller et al. 2020.
 
double potential_transpiration_unlimited (double _co2, double _carbon_uptake, double _wuecmax)
 Returns potential transpiration in [m].
 
double potential_transpiration_soil_atmosphere_limited (soillayers::input_class_soillayers_t const &, double _vpd, double _carbon_uptake, double _f_area, double _wuecmax, double _wuecmin, lvector_t< double > const &_h_sl, lvector_t< double > const &_wc, lvector_t< double > const &_wc_min, lvector_t< double > const &_wc_max)
 Returns potential transpiration in [m].
 
double potential_transpiration_soil_atmosphere_limited_root_scaled (size_t _soil_layer_cnt, double _vpd, double _carbon_uptake, double _wuecmax, double _wuecmin, double const *_frt_sl, lvector_t< double > const &_wc, lvector_t< double > const &_wc_min, lvector_t< double > const &_wc_max)
 Returns potential transpiration in [m].
 
double potential_transpiration_stomatal_conductance_limited (size_t, double gsmin, double gsmax, double *_lai_fl, lvector_t< double > _vpd_fl, double *_relative_conductance_fl)
 Returns potential transpiration in [m].
 
lerr_t get_voc_emission_factors (ldndc::MoBiLE_Plant *, int, bool, double, int, double, double)
 
 REGISTER_OPTION (PhysiologyPlaMox, loggerstream, "Stream for sending logging data")
 Option loggerstream: stream for logging data.
 
 REGISTER_OPTION (PhysiologyPlaMox, npot," [bool]")
 Option npot (see Model options)
 
 REGISTER_OPTION (PhysiologyPlaMox, transpirationmethod," [char]")
 Option transpirationmethod (see Model options)
 
 REGISTER_OPTION (PhysiologyPlaMox, droughtstress," [char]")
 Option droughtstress (see Model options)
 
 REGISTER_OPTION (PhysiologyPlaMox, heatstress, " [char]")
 Option heatstress (see Model options)
 
 REGISTER_OPTION (PhysiologyPlaMox, droughtstressmethod," [char]")
 Option droughtstressmethod (see Model options)
 
 REGISTER_OPTION (PhysiologyPlaMox, plantfamilies," [char]")
 Option plantfamilies (see Model options)
 
 REGISTER_OPTION (PhysiologyPlaMox, c4photosynthesis," [char]")
 Option c4photosynthesis (see Model options)
 
 REGISTER_OPTION (PhysiologyPlaMox, ndeficiencyreference," [char]")
 Option ndeficiencyreference (see Model options)
 
 REGISTER_OPTION (PhysiologyPlaMox, nlimitedgrowth," [bool]")
 Option nlimitedgrowth (see Model options)
 
 REGISTER_OPTION (PhysiologyPlaMox, mixcover," [bool]")
 Option mixcover: area bounds scaled by fractional cover (mixed stands)
 
lerr_t LDNDC_API allocate_litter (double _c, double _n, double _RCNRVL, double _RCNRL, double _RCNRR, double _C[], double &_n_diff)
 calculates the amount of C which is added to the very labile, labile and recalcitrant decomposition pool
 
double LDNDC_API cation_exchange_capacity (double _clay, double _sand, double _som, double _ph, ecosystem_type_e _ecosystem)
 Detailed description provided here .
 
double d_eff_air_a (double const &, double const &)
 Returns effective diffusion coefficient depending on gas content.
 
double d_eff_air_b (double const &, double const &, double const &, double const &)
 Returns effective diffusion coefficient depending on gas content and porosity.
 
double d_eff_air_millington_and_quirk_1961 (double const &, double const &)
 Returns effective diffusion coefficient after [56].
 
lerr_t update_litter_height (soillayers::input_class_soillayers_t const &, substate_watercycle_t &, substate_soilchemistry_t &)
 Detailed description provided here .
 
bool forest_floor (size_t, soillayers::input_class_soillayers_t const &, const ldndc::site::input_class_site_t &)
 First floor defined by:
 
bool ah_horizon (double, soillayers::input_class_soillayers_t const &, const ldndc::soilparameters::input_class_soilparameters_t &)
 Returns true if a soil layer belongs to the Ah horizon below the forest floor, i.e., a forest floor is defined (litter height > 0) and the lower boundary of the layer lies within the humus form specific Ah thickness (AH_THICKNESS) below the forest floor.
 
bool manure_default_properties (cbm::string_t const &, siteparameters::input_class_siteparameters_t const &, manure_properties_t &)
 Default composition of manure type _type (see table above).
 
bool manure_is_liquid (cbm::string_t const &)
 true for liquid manure types (slurry, digestate)
 
double LDNDC_API sap_wood_fraction (double _lai_max, double _qsfa, double _height_min, double _height_max, double _depth)
 sap_wood_fraction The calculation of the fraction of sapwood in coarse roots is based on the idealized volume fraction and assumes that the stem in the crown as well as the coarse roots are shaped as cones, and that core wood reaches a third of the cone
 
void tillage_mix (lvector_t< double > &, size_t, double, lvector_t< double > const &, double)
 Partial homogenization of a pool over the first _cnt layers: pool_l = (1 - m) pool_l + m h_l / z * sum_k pool_k with the layer thickness h_l and the depth z of the lowest tilled layer. The pool sum is conserved.
 
void tillage_mix_water (lvector_t< double > &, lvector_t< double > const &, lvector_t< double > const &, size_t, double, lvector_t< double > const &)
 Fraction of an amount added to the tilled layers that ends up in layer _l: without inversion, material is put into the uppermost layer and mixed with the given mixing; with inversion, it is distributed over the lower half of the tilled layers in proportion to the layer thickness.
 
lerr_t wood_initialization (soillayers::input_class_soillayers_t const &, MoBiLE_Plant *, substate_soilchemistry_t &, ecosystem_type_e)
 Initialization of aboveground and belowground wood debris, derived from existing vegetation.
 
double non_stomatal_water_limitation (double const &_var, double const &_var_ref, double const &_var_scale)
 Non stomatal water limitation.
 
double wind_speed_2m (double, double)
 Wind speed at 2 m height from wind speed measured at height z [m] above ground (logarithmic profile over short grass, FAO-56 eq. 47); unchanged for z <= 2 m.
 
double penman_monteith_fao56 (int, int, double, double, double, double, double, double, double, double=-1.0)
 FAO-56 Penman-Monteith reference evapotranspiration [m d-1] (short grass, albedo 0.23, surface resistance 70 s m-1)
 
double LDNDC_API thornthwaite_heat_index (double, size_t, double, double)
 Thornthwaite heat index.
 
double LDNDC_API thornthwaite (double, double, double, double, double)
 Potential evapotranspiration after [65].
 

Variables

LDNDC_API lflags_t const TMODE_DEFAULTS = TMODE_SUBDAILY|TMODE_PRE_DAILY|TMODE_POST_DAILY|TMODE_PRE_YEARLY|TMODE_POST_YEARLY
 
cbm::logger_t * PhysiologyPlaMoxLogger = NULL
 Logger of PlaMox.
 

Detailed Description

Spatially explicit groundwater model.

data synthesizer base class

declare common types related to species

common types related to species (implementation)

declare species groups known to the simulation system

container class for one complete soil and humus parameters set

collection of various helper functions

container class for site parameters

Declare common types related to site input.

declare common types related to setup input

common types related to setup input

declare common types related to remotesensing input

Van Genuchten soil-hydraulics: free functions and parametrised class for capillary pressure, hydraulic conductivity, and water content.

declare common types related to groundwater input

declare common types related to geometry input

common event related data types

(management) event factories

base class for (management) events

declare common types related to climate input

declare common types related to checkpoint input

declare common types related to air chemistry input

Author
David Kraus (created on: october 24, 2014)
  • David Kraus
Date
13 Nov, 2017
Author
David Kraus
Steffen Klatt (created on: mar 05, 2013), Edwin Haas
Steffen Klatt (created on: aug 13, 2012), Edwin Haas
Steffen Klatt (created on: may 23, 2014), Edwin Haas
Steffen Klatt (created on: dec 16, 2012), Edwin Haas David Kraus
Steffen Klatt (created on: dec 10, 2011)
Note
2026-09-28 Event time windowing functionality finally ported into the trunk, Edwin Haas
Author
Steffen Klatt (created on: dec 10, 2011)
Note
2026-09-28 Event time windowing functionality finally ported into the trunk, Edwin Haas
Author
Steffen Klatt (created on: dec 10, 2011)
Steffen Klatt (created on: dec 10, 2011), Edwin Haas
Steffen Klatt (created on: feb 03, 2014), Edwin Haas
Steffen Klatt (created on: may 29, 2015), David Kraus
David Kraus (created on: february 28, 2017)
Steffen Klatt on: may 29, 2015), David Kraus
Steffen Klatt (created on: sep 03, 2013), Edwin Haas


for now, also pulls in all kernel specific input declarations

Author
Steffen Klatt (created on: aug 11, 2012), Edwin Haas
  • Steffen Klatt (created on: jun 06, 2013)
  • David Kraus
  • Edwin Haas
Steffen Klatt (created on: jun 19, 2013), Edwin Haas
Ruediger Grote, David Kraus
Steffen Klatt (created on: jun 20, 2013) Edwin Haas David Kraus
Steffen Klatt (created on: mar 31, 2013) Edwin Haas David Kraus
Steffen Klatt (created on jun 19, 2013), Edwin Haas
Steffen Klatt (created on: jun 20, 2013), Edwin Haas
Steffen Klatt (created on: apr 04, 2013), Edwin Haas David Kraus
Steffen Klatt, Edwin Haas
Steffen Klatt (created on: jan 19, 2013)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
LSUB_FLAG_NONE 

empty flag

80{
83};
@ LSUB_FLAG_NONE
Definition mbe_substate.h:82

◆ anonymous enum

anonymous enum

Order of carbon pools in array passed to allocate_litter.

Enumerator
CPOOL_VL 

very labile

CPOOL_L 

labile

CPOOL_R 

recalcitrant

CPOOL_B 

wood

25{
29 CPOOL_L,
31 CPOOL_R,
33 CPOOL_B,
34
35 CPOOL_CNT
36};
@ CPOOL_VL
Definition ld_allocatelitter.h:27
@ CPOOL_B
Definition ld_allocatelitter.h:33
@ CPOOL_L
Definition ld_allocatelitter.h:29
@ CPOOL_R
Definition ld_allocatelitter.h:31

◆ c4_photosynthesis_method_e

Photosynthesis method of C4 plants (see C4 photosynthesis)

Enumerator
c4_photosynthesis_legacy 

C3 electron transport limitation (J/4) and minimum of the limitations (PSIM, PhotoFarquhar)

c4_photosynthesis_collatz_1992 

Collatz et al. 1992: light, Rubisco and PEP carboxylase limitation with co-limitation (PlaMox)

31{
36};
@ c4_photosynthesis_collatz_1992
Definition berryball.h:35
@ c4_photosynthesis_legacy
Definition berryball.h:33

◆ lmodule_flag_e

Enumerator
LMOD_FLAG_NONE 

empty flag

LMOD_FLAG_CONTROL 

marks model as control model

LMOD_FLAG_USER 

marks model as user model

LMOD_FLAG_SYSTEM 

marks model as internal system model

LMOD_FLAG_INITIALIZER 

marks model as initializer (runs before user legacy models)

LMOD_FLAG_FINALIZER 

marks model as finalizer (runs after user legacy models)

LMOD_FLAG_MAINTENANCE 

marks model as maintenance model (e.g. updates, resets, etc)

LMOD_FLAG_OUTPUT 

marks model as output model (always added last)

LMOD_FLAG_TEST_MODULE 

marks model as test model

70{
72 LMOD_FLAG_NONE = 0u,
73
75 LMOD_FLAG_CONTROL = 1u << 0,
76
78 LMOD_FLAG_USER = 1u << 1,
79
81 LMOD_FLAG_SYSTEM = 1u << 2,
83 LMOD_FLAG_INITIALIZER = 1u << 3,
85 LMOD_FLAG_FINALIZER = 1u << 4,
87 LMOD_FLAG_MAINTENANCE = 1u << 5,
88
90 LMOD_FLAG_OUTPUT = 1u << 6,
91
93 LMOD_FLAG_TEST_MODULE = 1u << 7,
94
95 LMOD_FLAG_CNT_,
96 LMOD_FLAG_CNT = 1 + 1 + cbm::log2_t< LMOD_FLAG_CNT_-1 >::LOG2
97};
@ LMOD_FLAG_FINALIZER
Definition mbe_legacymodel.h:85
@ LMOD_FLAG_TEST_MODULE
Definition mbe_legacymodel.h:93
@ LMOD_FLAG_MAINTENANCE
Definition mbe_legacymodel.h:87
@ LMOD_FLAG_INITIALIZER
Definition mbe_legacymodel.h:83
@ LMOD_FLAG_USER
Definition mbe_legacymodel.h:78
@ LMOD_FLAG_NONE
Definition mbe_legacymodel.h:72
@ LMOD_FLAG_CONTROL
Definition mbe_legacymodel.h:75
@ LMOD_FLAG_OUTPUT
Definition mbe_legacymodel.h:90
@ LMOD_FLAG_SYSTEM
Definition mbe_legacymodel.h:81

◆ metrx_iso_op_e

Enumerator
ISO_OP_INPUT 

external input to tgt

ISO_OP_REACT 

src -> tgt (signed)

ISO_OP_REDUCE_N2O 

n2o -> n2 with site preference

ISO_OP_COLUMN_DOWN 

counter[k]: flux k -> k+1

ISO_OP_COLUMN_UP 

counter[k]: flux k -> k-1, counter[0] to tgt

ISO_OP_SPINUP 

exchange humus1-3 and litter within a layer

ISO_OP_SKIP 

tracked elsewhere (tillage hooks)

55{
63};
@ ISO_OP_REACT
Definition soilchemistry-metrx-isotopes.h:57
@ ISO_OP_COLUMN_UP
Definition soilchemistry-metrx-isotopes.h:60
@ ISO_OP_COLUMN_DOWN
Definition soilchemistry-metrx-isotopes.h:59
@ ISO_OP_SKIP
Definition soilchemistry-metrx-isotopes.h:62
@ ISO_OP_INPUT
Definition soilchemistry-metrx-isotopes.h:56
@ ISO_OP_SPINUP
Definition soilchemistry-metrx-isotopes.h:61
@ ISO_OP_REDUCE_N2O
Definition soilchemistry-metrx-isotopes.h:58

◆ metrx_p_checkpoint_e

Enumerator
P_CP_ENTRY 

after MeTrX_update: plant litter, plant uptake

P_CP_SPINUP 

after MeTrX_spinup: spinup adjustment

P_CP_MGMT 

after field management: carbon of manure

P_CP_END 

end of time step: turnover, sorption, leaching

112{
113 P_CP_ENTRY = 0,
115 P_CP_MGMT,
116 P_CP_END
117};
@ P_CP_SPINUP
Definition soilchemistry-metrx-phosphorus.h:114
@ P_CP_END
Definition soilchemistry-metrx-phosphorus.h:116
@ P_CP_MGMT
Definition soilchemistry-metrx-phosphorus.h:115
@ P_CP_ENTRY
Definition soilchemistry-metrx-phosphorus.h:113

Function Documentation

◆ allocate_litter()

lerr_t ldndc::allocate_litter ( double _c,
double _n,
double _RCNRVL,
double _RCNRL,
double _RCNRR,
double _C[],
double & _n_diff )

calculates the amount of C which is added to the very labile, labile and recalcitrant decomposition pool

The needed information in this function are the amount of carbon in litter _c and the corresponding CN ratio (determined from nitrogen _n).

four cases: If the CN ratio is lower than the CN ratio of the very labile litter pool, all litter-C goes to the very labile decomposition pool.

If the CN ratio is between RCNRVL and the harmonic mean of RCNRVL and RCNRR, an increasing CN ratio decreases C_0 and increases C_1 and C_2.

If thc CN ratio is between the harmonic mean of RCNRVL and RCNRR and RCNRR, C_1 and C_2 decrease and only C_0 increases.

If CN ratio is higher than RCNRR, all Litter-C goes to C_2.

Parameters
_cCarbon in litter flux
_nNitrogen in litter flux
_COrganic carbon that is added to the
  • very labile,
  • labile,
  • recalcitrant decomposition pool (kgC ha-1)
_n_diff
Note
rr_vl_l harmonic mean of RCNRL and RCNRVL; used to calculate weights how addC is partitioned into C1,C2 and C3 rr_l_r harmonic mean of RCNRL and RCNRR
Author
david kraus (created on: may 6, 2014)
24{
25 ldndc_assert( _n >= 0.0);
26
27 if (cbm::flt_equal_zero(_n))
28 {
29 _C[CPOOL_VL] = 0.0;
30 _C[CPOOL_L] = 0.0;
31 _C[CPOOL_R] = 0.0;
32 _C[CPOOL_B] = _c;
33 _n_diff = 0.0;
34 }
35 else
36 {
37 ldndc_assert(( _RCNRVL > 0.0) && ( _RCNRL > 0.0) && ( _RCNRR > 0.0));
38 double const cn( _c / _n);
39
40 if ( cn < _RCNRVL)
41 {
42 /* cn \in (0,rL) */
43 _C[CPOOL_VL] = _c;
44 _C[CPOOL_L] = 0.0;
45 _C[CPOOL_R] = 0.0;
46 _C[CPOOL_B] = 0.0;
47 _n_diff = ( _n - _c/_RCNRVL);
48 }
49 else if (( cn >= _RCNRVL) && ( cn < _RCNRL))
50 {
51 /* cn \in [rL,r) */
52 double rr_l_r( 2.0 * _RCNRR * _RCNRL / ( _RCNRR + _RCNRL));
53 double addrr( _c * ( rr_l_r - cn) / ( rr_l_r - _RCNRVL) * ( _RCNRVL / cn));
54 _C[CPOOL_VL] = ( 1.25 * addrr - _c * 0.25);
55 _C[CPOOL_L] = ( _c - addrr);
56 _C[CPOOL_R] = (( _c - addrr) * 0.25);
57 _C[CPOOL_B] = 0.0;
58 _n_diff = 0.0;
59 }
60 else if (( cn >= _RCNRL) && ( cn <= _RCNRR))
61 {
62 /* cn \in [r,rR] */
63 double rr_vl_l( 2.0 * _RCNRVL * _RCNRL / ( _RCNRVL + _RCNRL));
64 double addrr( _c * ( rr_vl_l - cn) / (rr_vl_l - _RCNRR) * ( _RCNRR / cn));
65 _C[CPOOL_VL] = (( _c - addrr) * 0.25);
66 _C[CPOOL_L] = ( _c - addrr);
67 _C[CPOOL_R] = ( _c - ( _C[0] + _C[1]));
68 _C[CPOOL_B] = 0.0;
69 _n_diff = 0.0;
70 }
71 else
72 {
73 /* cn \in (rR,\inf) */
74 _C[CPOOL_VL] = 0.0;
75 _C[CPOOL_L] = 0.0;
76 _C[CPOOL_R] = _n * _RCNRR;
77 _C[CPOOL_B] = _c - _n * _RCNRR;
78 _n_diff = 0.0;
79 }
80 }
81
82 return LDNDC_ERR_OK;
83}

References CPOOL_B, CPOOL_L, CPOOL_R, and CPOOL_VL.

◆ assign_soillayer_macropores()

lerr_t ldndc::assign_soillayer_macropores ( double & _macropores_with_stones,
double & _wc_fc,
double & _wc_sat,
size_t const & _nd_stratum,
double const & _depth,
double const & _stone_fraction,
double const & _porosity_with_stones,
const ldndc::site::input_class_site_t * _site,
const ldndc::soillayers::input_class_soillayers_t * _soillayers,
const ldndc::soilparameters::input_class_soilparameters_t * _soilparameters,
bool _info = false )

Hydraulic parameters are checked for consistency against each other.

873{
874 ldndc::site::iclass_site_stratum_t stratum;
875 lerr_t rc_stratum = _soillayers->stratum( _nd_stratum, &stratum);
876 RETURN_IF_NOT_OK( rc_stratum);
877
878 if ( cbm::is_valid( stratum.macropores))
879 {
880 _macropores_with_stones = stratum.macropores;
881 }
882 else
883 {
884 if ( forest_floor( _depth, *_soillayers, *_site))
885 {
886 _macropores_with_stones = _soilparameters->HUMUS_MACROPORES( _soillayers->humus_type());
887 }
888 else
889 {
890 double clay( 0.0);
891 double sand( 0.0);
892 double silt( 0.0);
893 lerr_t rc_texture = assign_soillayer_soil_texture( clay, sand, silt, _nd_stratum, _depth,
894 _site, _soillayers, _soilparameters, false);
895 if ( rc_texture)
896 {
897 LOGERROR( "Initialization of field capacity and wilting point of stratum ",
898 _nd_stratum+1, " not successful due to invalid soil texture info");
899 return LDNDC_ERR_FAIL;
900 }
901
902 cbm::string_t texture_name( ldndc::get_soil_texture( sand * 100.0, clay * 100.0));
903 ldndc::soillayers::soil_type_e texture_type( ldndc::get_soil_texture_type( texture_name));
904
905 if ( ldndc::use_usda_soil_texture_triangle( _soillayers->soil_type()) &&
906 (texture_type != ldndc::soillayers::SOIL_NONE))
907 {
908 _macropores_with_stones = _soilparameters->SOIL_MACROPORES( texture_type);
909 }
910 else
911 {
912 _macropores_with_stones = _soilparameters->SOIL_MACROPORES( _soillayers->soil_type());
913 }
914 }
915 }
916
917 _macropores_with_stones *= (1.0 - _stone_fraction);
918
922 if( cbm::flt_greater( _wc_fc + _macropores_with_stones, _porosity_with_stones))
923 {
924 double const scale_down( _porosity_with_stones / ( _wc_fc + _macropores_with_stones));
925 _wc_fc *= scale_down;
926 STRATUM_INFO( "Field capacity exceeded porosity minus macropores in stratum ", _nd_stratum+1, ". ",
927 "Adjusted field capacity: ", _wc_fc / (1.0 - _stone_fraction) * 100.0," [%]");
928 }
929
930 if( cbm::flt_less_equal( _wc_sat, _wc_fc))
931 {
932 _wc_sat = 0.5 * (_wc_fc + _porosity_with_stones);
933 STRATUM_INFO( "Saturated water content smaller than field capacity in stratum ", _nd_stratum+1, ". ",
934 "Adjusted saturated water content: ", _wc_sat / (1.0 - _stone_fraction) * 100.0," [%]");
935 }
936
937 return LDNDC_ERR_OK;
938}
bool forest_floor(size_t, soillayers::input_class_soillayers_t const &, const ldndc::site::input_class_site_t &)
First floor defined by:
Definition ld_litterheight.cpp:139

References forest_floor().

Here is the call graph for this function:

◆ assign_soillayer_porosity()

lerr_t ldndc::assign_soillayer_porosity ( double & _porosity_with_stones,
size_t const & _nd_stratum,
double const & _depth,
double const & _stone_fraction,
double const & _c_org_without_stones,
double const & _bulk_density_without_stones,
const ldndc::site::input_class_site_t * _site,
const ldndc::soillayers::input_class_soillayers_t * _soillayers,
const ldndc::soilparameters::input_class_soilparameters_t * _soilparameters,
bool _info = false )

Porosity is estimated based on organic carbon fraction and bulk density for the soil including stones. Porosity is given by a value between 0 and 1. See: porosity()

664{
665 ldndc::site::iclass_site_stratum_t stratum;
666 lerr_t rc_stratum = _soillayers->stratum( _nd_stratum, &stratum);
667 if ( rc_stratum)
668 {
669 LOGERROR( "Invalid stratum [nd=", _nd_stratum,"]");
670 return LDNDC_ERR_FAIL;
671 }
672
673 double porosity_without_stones( invalid_dbl);
674 if( cbm::flt_greater_equal_zero( stratum.porosity))
675 {
676 porosity_without_stones = stratum.porosity;
677 }
678 else
679 {
680 double clay( 0.0);
681 double sand( 0.0);
682 double silt( 0.0);
683 lerr_t rc_texture = assign_soillayer_soil_texture( clay, sand, silt, _nd_stratum, _depth, _site, _soillayers, _soilparameters, false);
684 if ( rc_texture)
685 {
686 LOGERROR( "Initialization of porosity of stratum ", _nd_stratum+1, " [site id=",_site->object_id(),"] not successful due to invalid soil texture info");
687 return LDNDC_ERR_FAIL;
688 }
689
695 double mineral_soil_density( cbm::DMIN);
696 double const clay_sand_silt( clay + sand + silt);
697 if ( cbm::flt_greater_zero( clay_sand_silt))
698 {
699 mineral_soil_density = (clay * cbm::DCLA + sand * cbm::DSAN + silt * cbm::DSIL) / clay_sand_silt;
700 }
701 porosity_without_stones = ldndc::porosity( _c_org_without_stones, _bulk_density_without_stones, mineral_soil_density);
702 STRATUM_INFO( "Porosity of stratum ",_nd_stratum+1," not initialized, estimated value (without stones): ", porosity_without_stones*100.0," [%]");
703 }
704
705 _porosity_with_stones = porosity_without_stones * (1.0 - _stone_fraction);
706
707 if ( !cbm::flt_in_range_lu( 0.0, _porosity_with_stones, 1.0))
708 {
709 LOGERROR( "Porosity of stratum ", _nd_stratum+1, " [site id=",_site->object_id(),"] out of range: ",
710 _porosity_with_stones / (1.0 - _stone_fraction)*100," [%]");
711 return LDNDC_ERR_FAIL;
712 }
713 else
714 {
715 return LDNDC_ERR_OK;
716 }
717}

◆ canopy_biomass_distribution()

void ldndc::canopy_biomass_distribution ( size_t const _fl_cnt_max,
size_t const _fl_cnt,
double const _ps,
double const _h_bottom,
double const _h_top,
double const * _h_fl,
double * _fFol_fl )

Foliage biomass distribution vertically across canopy.

Parameters
_fl_cnt_maxmaximum number of foliage parameters
_fl_cntcurrent actively used number of foliage parameters
_ps
_h_bottom
_h_top
_h_fl
_fFol_fl
Returns
no return value
49{
50 /* reset */
51 for ( size_t fl = 0; fl < _fl_cnt_max; ++fl)
52 {
53 _fFol_fl[fl] = 0.0;
54 }
55
56 // total distribution length
57 if ( cbm::flt_greater( _h_top, _h_bottom))
58 {
59 double h_cum_top( 0.0);
60 for ( size_t fl = 0; fl < _fl_cnt; ++fl)
61 {
62 double const h_cum_bottom( h_cum_top);
63 h_cum_top += _h_fl[fl];
64
66 _ps, _h_bottom, _h_top,
67 _h_fl[fl], _fFol_fl[fl],
68 h_cum_bottom, h_cum_top);
69 }
70
71 double const fFol_sum( cbm::sum( _fFol_fl, _fl_cnt));
72 if ( cbm::flt_equal_zero( fFol_sum))
73 {
74 for ( size_t fl = 0; fl < _fl_cnt; ++fl)
75 {
76 _fFol_fl[fl] = 1.0 / double( _fl_cnt);
77 }
78 }
79 else
80 {
81 for ( size_t fl = 0; fl < _fl_cnt; ++fl)
82 {
83 _fFol_fl[fl] /= fFol_sum;
84 }
85 }
86 }
87}
void estimate_single_layer_biomass(double const _ps, double const _h_bottom, double const _h_top, double _lw, double &_fract, double _h_cum_bottom, double _h_cum_top)
Vertical biomass estimation.
Definition ld_plantfunctions.cpp:1900

References estimate_single_layer_biomass().

Here is the call graph for this function:

◆ canopy_lai_distribution()

void ldndc::canopy_lai_distribution ( double _sla_min,
double _sla_max,
double _height_max,
double _height_min,
double _mFol,
double const * _fFol_fl,
double const * _h_fl,
double * _lai_fl,
double * _sla_fl,
size_t _foliage_layer_cnt,
size_t _foliage_layer_cnt_max )

Leaf area distribution vertically across the whole canopy.

Parameters
_sla_minspecific leaf area at canopy top
_sla_maxspecific leaf area at canopy bottom
_height_maxtotal plant height
_height_minplant height at start of canopy
_mFolfoliage biomass
_fFol_flfoliage biomass distribution
_h_flcanopy discretization
_lai_flcanopy layer leaf area index
_sla_flcanopy layer specific leaf are
_foliage_layer_cntnumber of canopy layers
_foliage_layer_cnt_maxmaximum number of canopy layers
Returns
no return value
106{
107 /* reset canopy */
108 for ( size_t fl = 0; fl < _foliage_layer_cnt_max; ++fl)
109 {
110 _sla_fl[fl] = 0.0;
111 _lai_fl[fl] = 0.0;
112 }
113
114 double const crown_length( _height_max - _height_min);
115 if ( cbm::flt_greater_zero( crown_length))
116 {
117 double const delta_sla( cbm::bound_min( 0.0, _sla_max - _sla_min));
118
119 /* cumulative height of total plant */
120 double h_cum_total_top( 0.0);
121 double h_cum_crown_bottom( 0.0);
122 for (size_t fl = 0; fl < _foliage_layer_cnt; ++fl)
123 {
124 h_cum_total_top += _h_fl[fl];
125
126 /* sla and lai are greater zero only within canopy */
127 if ( cbm::flt_greater( h_cum_total_top, _height_min))
128 {
129 double const h_cum_crown_top( cbm::bound_max( h_cum_total_top - _height_min, crown_length));
130 double const h_cum_crown( 0.5 * (h_cum_crown_bottom + h_cum_crown_top));
131
132 _sla_fl[fl] = _sla_max - (delta_sla * h_cum_crown / crown_length);
133 _lai_fl[fl] = _sla_fl[fl] * _mFol * _fFol_fl[fl];
134
135 h_cum_crown_bottom = h_cum_crown_top;
136 }
137 }
138 }
139}

◆ cation_exchange_capacity()

double LDNDC_API ldndc::cation_exchange_capacity ( double _clay,
double _sand,
double _som,
double _ph,
ecosystem_type_e _ecosystem )

Detailed description provided here .

Parameters
_clayClay content [%]
_sandSand content [%]
_somSoil organic matter content [%]
_phpH value [-]
_ecosystemEcosystem type [-]
Returns
Cation exchange capacity [mol:g-1:1e-5]

Referenced by ldndc::SoilChemistryMeTrX::MeTrX_clay_nh4_equilibrium().

Here is the caller graph for this function:

◆ crown_shape_parameter()

double ldndc::crown_shape_parameter ( double _length,
double lref,
double ps )

Returns a crown shape factor which depends on canopy length.

modification of crown shape by canopy length

1629{
1630 // crown/ root profile shape value shifts with crown length/ root profile depth
1631 double ps2(ps);
1632 if (_length <= 1.0)
1633 {
1634 ps2 = 1.0;
1635 }
1636 else if (lref > 1.0)
1637 {
1638 ps2 = cbm::bound_max(1.0 + (ps - 1.0) * (_length - 1.0) / (lref - 1.0), ps);
1639 }
1640
1641 return ps2;
1642}

◆ d_eff_air_a()

double ldndc::d_eff_air_a ( double const & _exp,
double const & _gas_content )

Returns effective diffusion coefficient depending on gas content.

Parameters
[in]_expExponent [-]
[in]_gas_contentGas content [m^3:m^-3]
Returns
Effective diffusion coefficient [-]
23{
24 return std::pow( _gas_content, _exp);
25}

◆ d_eff_air_b()

double ldndc::d_eff_air_b ( double const & _exp_g,
double const & _exp_p,
double const & _gas_content,
double const & _porosity )

Returns effective diffusion coefficient depending on gas content and porosity.

Parameters
[in]_exp_gExponent for gas content [-]
[in]_exp_pExponent for porosity [-]
[in]_gas_contentGas content [m^3:m^-3]
[in]_porosityPorosity [m^3:m^-3]
Returns
Effective diffusion coefficient [-]
36{
37 return std::pow( _gas_content, _exp_g) / std::pow( _porosity, _exp_p);
38}

◆ d_eff_air_millington_and_quirk_1961()

double ldndc::d_eff_air_millington_and_quirk_1961 ( double const & _gas_content,
double const & _porosity )

Returns effective diffusion coefficient after [56].

Parameters
[in]_gas_contentGas content [m^3:m^-3]
[in]_porosityPorosity [m^3:m^-3]
Returns
Effective diffusion coefficient [-]
47{
48 return std::pow( _gas_content, 10.0/3.0) / (_porosity * _porosity);
49}

◆ estimate_single_layer_biomass()

void ldndc::estimate_single_layer_biomass ( double const _ps,
double const _h_bottom,
double const _h_top,
double _lw,
double & _fract,
double _h_cum_bottom,
double _h_cum_top )

Vertical biomass estimation.

Parameters
_psform parameter
_h_bottomheight of start of distributed biomass
_h_topheight of end of distributed biomass
_lw
_fract
_h_cum_bottom
_h_cum_top
Returns
No return value

The standard vertical distribution of biomass is done with the same assumptions for canopy (veglibs_canopy) and rooting space (Root distribution). Only for root distribution there are several more options available.

1908{
1909 // calculation proceeds as long as cumulative length is smaller than total crown length
1910 if ( cbm::flt_greater( _h_cum_top, _h_bottom) &&
1911 cbm::flt_less_equal( _h_cum_bottom, _h_top))
1912 {
1913 // distance from the crown start/ soil surface for which the relative biomass shall be estimated
1914 double hAct( 0.0);
1915 double const length( _h_top - _h_bottom);
1916
1917 // if total crown height is within the first canopy layer
1918 if ( cbm::flt_less( _h_top, _lw))
1919 {
1920 hAct = length;
1921 }
1922 // for the partially filled last canopy/ soil layer
1923 else if ( cbm::flt_less_equal( _h_top, _h_cum_top))
1924 {
1925 hAct = length - ( _h_top - _h_cum_bottom) * 0.5;
1926 }
1927 // for the partially filled first canopy/ soil layer
1928 else if ( cbm::flt_less( _h_cum_bottom, _h_bottom))
1929 {
1930 hAct = ( _h_cum_top - _h_bottom) * 0.5;
1931 }
1932 // for fully filled canopy/ soil layers
1933 else
1934 {
1935 hAct = ( _h_cum_bottom - _h_bottom) + (_h_cum_top - _h_cum_bottom) * 0.5;
1936 }
1937
1938 double const relH( cbm::flt_less( length, _lw) ? 1.0 : ((length - hAct) / length));
1939
1940 // relative biomass distribution throughout the canopy/ soil according to Grote 2007
1941 double fH( pow( _ps, 100.0 * hAct / ( cbm::flt_greater( length, 5.0) ? (length * length) : 25.0)));
1942
1943 _fract = relH * fH;
1944 }
1945 else
1946 {
1947 _fract = 0.0;
1948 }
1949}

Referenced by canopy_biomass_distribution(), and fineroots_biomass_distribution().

Here is the caller graph for this function:

◆ fineroots_biomass_distribution()

void ldndc::fineroots_biomass_distribution ( size_t _sl_cnt_litter,
size_t _sl_cnt_soil,
double _ps,
double _rooting_depth,
double * _f_frt_sl,
double const * _h_sl )

Root distribution and root properties are generally fixed throughout the simulation period. Only, if the initial condition of planting doesn't allow the soil profile to be fully rooted (e.g. plants are too small), rooting depth increases linearly with \( FRT_DGR_MAX \) until the maximum root depth (defined by the soil profile) is reached. This is different in Plamox, where plant roots start growing down with planting and should not grow as deep as the soil profile depth, but stop at the species parameter, the maximum rooting depth \( ZRTMC \).

Standard empirial root distribution

The distribution of fine root biomass \( m(z) \) within the rooting space depends on the rooting depth and is calculated with the same empirical equation as the foliage biomass (veglibs_canopy). The main difference is that the parameter 'p' is generally below 1 now to get a concave distribution ([28]).

\[ m(z) = M \cdot \frac{r_{ih} f(z)}{\int r_{ih} f(z)} \\ r_{ih} = \frac{RD - z}{RD} \\ f(z) = p^{100 \frac{z}{RD^2}} \]

\( RD \): root depth (m)
\( z \): distribution depth for which the percentage roots should be defined (between 0-1, from upper soil boundary to rooting depth)
\( p \): shape parameter

Fine roots biomass distribution
Note
This function is currently the standard option for PSIM/TREEDYN (implicitly)

scaling factor for root distribution (basically to enable root and canopy profile calculations with the same function)

fraction of fine roots in the litter layer

fraction of fine roots in the mineral soil

1987{
1988 if ( cbm::flt_greater_zero( _rooting_depth))
1989 {
1991 double const SCALE( 10.0);
1992
1994 double f_litter( 0.0);
1995
1996 double litter_depth( 0.0);
1997 for ( size_t sl = 0; sl < _sl_cnt_litter; ++sl)
1998 {
1999 litter_depth += _h_sl[sl];
2000 }
2001
2002 /* if rooting depth <= litter depth neglect litter layer (new seedlings start in mineral layer)*/
2003 if ( cbm::flt_greater( litter_depth, _rooting_depth))
2004 {
2005 _sl_cnt_litter = 0;
2006 f_litter = 0.0;
2007 }
2008 /* else assume that fine roots are distributed according to litter height relative to soil profile*/
2009 else
2010 {
2011 f_litter = litter_depth / _rooting_depth;
2012 }
2013
2014 for ( size_t sl = 0; sl < _sl_cnt_litter; ++sl)
2015 {
2016 _f_frt_sl[sl] = f_litter / (double)_sl_cnt_litter;
2017 }
2018
2020 double const f_soil( 1.0 - f_litter);
2021
2022 double h_cum( 0.0);
2023 double f_frt_sum( 0.0);
2024 for ( size_t sl = _sl_cnt_litter; sl < _sl_cnt_soil; ++sl)
2025 {
2026 double const h_cum_old( h_cum);
2027 h_cum += _h_sl[sl] * SCALE;
2028
2029 estimate_single_layer_biomass( _ps, 0.0, SCALE * _rooting_depth,
2030 SCALE * _h_sl[sl], _f_frt_sl[sl],
2031 h_cum_old, h_cum);
2032 f_frt_sum += _f_frt_sl[sl];
2033 }
2034
2035 for ( size_t sl = _sl_cnt_litter; sl < _sl_cnt_soil; ++sl)
2036 {
2037 _f_frt_sl[sl] = _f_frt_sl[sl] / f_frt_sum * f_soil;
2038 }
2039 }
2040 else
2041 {
2042 for ( size_t sl = 0; sl < _sl_cnt_soil; ++sl)
2043 {
2044 _f_frt_sl[sl] = 0.0;
2045 }
2046 }
2047}

References estimate_single_layer_biomass().

Here is the call graph for this function:

◆ forest_floor()

bool ldndc::forest_floor ( size_t _sl,
soillayers::input_class_soillayers_t const & _soillayers,
const ldndc::site::input_class_site_t &  )

First floor defined by:

  • litter height
  • ecosystem type
143{
144 if ( _sl < _soillayers.soil_layers_in_litter_cnt())
145 {
146 return true;
147 }
148
149 return false;
150}

Referenced by assign_soillayer_macropores().

Here is the caller graph for this function:

◆ get_optimum_sap_wood_biomass()

double ldndc::get_optimum_sap_wood_biomass ( MoBiLE_Plant * _p)
Parameters
_pPlant
Returns
Optimum sap wood biomass depending on foliage biomass.
33{
34 double const sapwood_area_demand( _p->lai_max * _p->qsfa );
35/*
36 double const non_stem_sapwood(_p->aboveground_wood() * _p->f_branch);
37 double const optimum_msap_tree( (*_p)->DSAP() * cbm::DM3_IN_M3 * sapwood_area_demand
38 * (_p->h_trunk + _p->h_depth/3.0 + _p->h_crown / 3.0) );
39 double const optimum_sap_wood( optimum_msap_tree + non_stem_sapwood);
40
41 if ( (*_p)->IS_WOOD())
42 {
43 double const total_wood( _p->aboveground_wood() + _p->belowground_wood() );
44 return cbm::bound_max( optimum_sap_wood, total_wood );
45 }
46 else
47 {
48 return optimum_sap_wood;
49 }
50*/
51 return ( (*_p)->DSAP() * cbm::DM3_IN_M3 * sapwood_area_demand
52 * (_p->h_trunk + (_p->h_depth / 3.0) * (1.0 + _p->fcrt_eff()) + (_p->h_crown / 3.0) * (1.0 + (*_p)->FBRA())) );
53}

Referenced by get_sapwood_foliage_ratio().

Here is the caller graph for this function:

◆ get_sapwood_foliage_ratio()

double ldndc::get_sapwood_foliage_ratio ( MoBiLE_Plant * _p)
Parameters
_pPlant
Returns
sap wood to foliage ratio
63{
64 double const biomass_limit( 0.001);
65
66 if ( !(*_p)->FREEGROWTH() && (_p->nb_ageclasses() > 0) )
67 {
68 size_t na_max( _p->nb_ageclasses() - 1);
69 if ( cbm::flt_greater( _p->mBud + _p->mFol - _p->mFol_na[na_max], biomass_limit))
70 {
71 double const m_sap_opt( get_optimum_sap_wood_biomass(_p));
72 return m_sap_opt / ( _p->mBud + _p->mFol - _p->mFol_na[na_max]);
73 }
74 }
75 else if ( cbm::flt_greater( _p->mFol + _p->mBud, biomass_limit))
76 {
77 double const m_sap_opt( get_optimum_sap_wood_biomass(_p));
78 return m_sap_opt / ( _p->mFol + _p->mBud);
79 }
80
81 return 0.0;
82}
double get_optimum_sap_wood_biomass(MoBiLE_Plant *_p)
Definition ld_sapwoodbiomass.cpp:32

References get_optimum_sap_wood_biomass().

Here is the call graph for this function:

◆ get_voc_emission_factors()

lerr_t ldndc::get_voc_emission_factors ( ldndc::MoBiLE_Plant * _vt,
int _fl,
bool _calc_synthase_activity,
double _latitude,
int _yearday,
double _foliage_temperature,
double _foliage_radiation )

Daily calculation of voc (isoprene and monoterpenes) synthase activity NOTE that fCO2 depends on outside CO2, internal CO2 would probably be better (explaining relatively high emissions when stomata closed)

146{
147// if running subdaily calc activity on last subdaily time step
148
149
150// if ("beginning of simulation and first time that pointers are assigned")
151// --> assign ef with sef
152// --> assign ef with iso/monoAct
153//
154// else if ( "further within simulation ")
155// --> assign ef with iso/monoAct
156
157
158
159 if ( !_calc_synthase_activity)
160 {
161 ldndc_use_standard_emission_factors( _vt, _fl);
162 return LDNDC_ERR_OK;
163 }
164
165 else if (( _calc_synthase_activity) && (( ( *_vt)->ALPHA0_IS() + ( *_vt)->ALPHA0_MT()) > 0.0) && ( ( *_vt)->PA() > 0.0))
166 {
167 LOGINFO_ONCE( "Calculation of voc synthase activity instead of standard emission factors");
168 ldndc_calc_voc_synthase_activity( _vt, _fl, _latitude, _yearday, _foliage_temperature, _foliage_radiation);
169
170 /* factors for conversion from enzyme activity (nmol m-2 (leaf area) s-1) to emission factor (ug component gDW-1 h-1) */
171 double const lsw = cbm::G_IN_KG / _vt->sla_fl[_fl];
172 double const UNIT_CONV = cbm::SEC_IN_HR * cbm::UMOL_IN_NMOL;
173
174 /* "isoAct_vtfl"/"monoAct_vtfl" [nmol enzyme product m-2 leaf area s-1] activity of isoprene/monterpene synthase to produce isoprene/monoterpenes */
175 _vt->ef_iso_fl[_fl] = _vt->isoAct_fl[_fl] * cbm::MC5H8 * UNIT_CONV / ( lsw * ( *_vt)->SCALE_I());
176 _vt->ef_mono_fl[_fl] = _vt->monoAct_fl[_fl] * cbm::MC10H16 * UNIT_CONV / ( lsw * ( *_vt)->SCALE_M());
177
178
179 return LDNDC_ERR_OK;
180 }
181
182 else if (( _calc_synthase_activity) && ((( ( *_vt)->ALPHA0_IS() + ( *_vt)->ALPHA0_MT()) <= 0.0) || ( ( *_vt)->PA() <= 0.0)))
183 {
184 LOGWARN_ONCE( "Dynamic calculation of emission activity not possible",
185 " because species specific paramters ALPHA0_IS + ALPHA0_MT, or PA is equal or less than zero",
186 " [ALPHA0_IS=",( *_vt)->ALPHA0_IS(),",ALPHA0_MT=",( *_vt)->ALPHA0_MT(),",PA=",( *_vt)->PA(),"]",
187 " Thus standard emission factors are used!");
188
189 ldndc_use_standard_emission_factors( _vt, _fl);
190 return LDNDC_ERR_OK;
191
192 }
193
194 else
195 {
196 LOGERROR("Wrong configuration of CalcSynthaseActivity, CalcParTempDependence, or species specific parameters...");
197 return LDNDC_ERR_FAIL;
198 }
199
200}

◆ manure_default_properties()

bool ldndc::manure_default_properties ( cbm::string_t const & ,
siteparameters::input_class_siteparameters_t const & ,
manure_properties_t &  )

Default composition of manure type _type (see table above).

Returns
false if _type is not one of the types listed above (including green and straw)
23{
24 if ( _type == "slurry")
25 {
26 _mp.avail_n = _sipar.FRAC_LABILE_N_SLURRY();
27 _mp.avail_c = _sipar.FRAC_LABILE_C_SLURRY();
28 _mp.f_urea = _sipar.LIQUREA_SLURRY();
29 _mp.f_nh4 = _sipar.LIQNH4_SLURRY();
30 _mp.f_don = _sipar.LIQDON_SLURRY();
31 _mp.f_no3 = _sipar.LIQNO3_SLURRY();
32 _mp.f_lignin = 0.2; // Bhogal et al. (2011), Levi-Minzi et al. (1986), Probert et al. (2005)
33 _mp.f_cellulose = 0.6; // Bhogal et al. (2011), Levi-Minzi et al. (1986)
34 _mp.f_stable = 0.0;
35 }
36 else if ( _type == "farmyard")
37 {
38 _mp.avail_n = _sipar.FRAC_LABILE_N_FARMYARD();
39 _mp.avail_c = _sipar.FRAC_LABILE_C_FARMYARD();
40 _mp.f_urea = _sipar.LIQUREA_FARMYARD();
41 _mp.f_nh4 = _sipar.LIQNH4_FARMYARD();
42 _mp.f_don = _sipar.LIQDON_FARMYARD();
43 _mp.f_no3 = _sipar.LIQNO3_FARMYARD();
44 _mp.f_lignin = 0.2; // Bhogal et al. (2011), Levi-Minzi et al. (1986), Probert et al. (2005)
45 _mp.f_cellulose = 0.6; // Bhogal et al. (2011), Levi-Minzi et al. (1986)
46 _mp.f_stable = 0.0;
47 }
48 else if ( _type == "compost")
49 {
50 _mp.avail_n = _sipar.FRAC_LABILE_N_COMPOST();
51 _mp.avail_c = _sipar.FRAC_LABILE_C_COMPOST();
52 _mp.f_urea = _sipar.LIQUREA_COMPOST();
53 _mp.f_nh4 = _sipar.LIQNH4_COMPOST();
54 _mp.f_don = _sipar.LIQDON_COMPOST();
55 _mp.f_no3 = _sipar.LIQNO3_COMPOST();
56 _mp.f_lignin = 0.8;
57 _mp.f_cellulose = 0.1;
58 _mp.f_stable = 0.0;
59 }
60 else if ( _type == "generic")
61 {
62 _mp.avail_n = (_sipar.FRAC_LABILE_N_SLURRY() + _sipar.FRAC_LABILE_N_FARMYARD()) / 2.0;
63 _mp.avail_c = (_sipar.FRAC_LABILE_C_SLURRY() + _sipar.FRAC_LABILE_C_FARMYARD()) / 2.0;
64 _mp.f_urea = (_sipar.LIQUREA_SLURRY() + _sipar.LIQUREA_FARMYARD()) / 2.0;
65 _mp.f_nh4 = (_sipar.LIQNH4_SLURRY() + _sipar.LIQNH4_FARMYARD()) / 2.0;
66 _mp.f_don = (_sipar.LIQDON_SLURRY() + _sipar.LIQDON_FARMYARD()) / 2.0;
67 _mp.f_no3 = (_sipar.LIQNO3_SLURRY() + _sipar.LIQNO3_FARMYARD()) / 2.0;
68 _mp.f_lignin = 0.2;
69 _mp.f_cellulose = 0.6;
70 _mp.f_stable = 0.0;
71 }
72 else if ( _type == "beancake")
73 {
74 _mp.avail_n = _sipar.FRAC_LABILE_N_BEANCAKE();
75 _mp.avail_c = _sipar.FRAC_LABILE_C_BEANCAKE();
76 _mp.f_urea = 0.0;
77 _mp.f_nh4 = 1.0;
78 _mp.f_don = 0.0;
79 _mp.f_no3 = 0.0;
80 _mp.f_lignin = 0.1;
81 _mp.f_cellulose = 0.5;
82 _mp.f_stable = 0.0;
83 }
84 else if ( _type == "digestate")
85 {
86 /* Moeller & Mueller (2012), Tambone et al. (2009) */
87 _mp.avail_n = 0.6;
88 _mp.avail_c = 0.05;
89 _mp.f_urea = 0.0;
90 _mp.f_nh4 = 0.95;
91 _mp.f_don = 0.05;
92 _mp.f_no3 = 0.0;
93 _mp.f_lignin = 0.35;
94 _mp.f_cellulose = 0.4;
95 _mp.f_stable = 0.0;
96 }
97 else if ( _type == "poultry")
98 {
99 /* Nicholson et al. (1996); uric acid is treated as urea */
100 _mp.avail_n = 0.5;
101 _mp.avail_c = 0.1;
102 _mp.f_urea = 0.6;
103 _mp.f_nh4 = 0.35;
104 _mp.f_don = 0.05;
105 _mp.f_no3 = 0.0;
106 _mp.f_lignin = 0.15;
107 _mp.f_cellulose = 0.5;
108 _mp.f_stable = 0.0;
109 }
110 else if (( _type == "sewagesludge") || ( _type == "biosolids"))
111 {
112 /* US EPA (1995) */
113 _mp.avail_n = 0.15;
114 _mp.avail_c = 0.05;
115 _mp.f_urea = 0.0;
116 _mp.f_nh4 = 0.9;
117 _mp.f_don = 0.1;
118 _mp.f_no3 = 0.0;
119 _mp.f_lignin = 0.25;
120 _mp.f_cellulose = 0.35;
121 _mp.f_stable = 0.0;
122 }
123 else if ( _type == "biochar")
124 {
125 /* Wang et al. (2016): labile fraction about 3 %, mean residence time of the stable fraction about 560 years */
126 _mp.avail_n = 0.0;
127 _mp.avail_c = 0.0;
128 _mp.f_urea = 0.0;
129 _mp.f_nh4 = 1.0;
130 _mp.f_don = 0.0;
131 _mp.f_no3 = 0.0;
132 _mp.f_lignin = 0.0;
133 _mp.f_cellulose = 0.0;
134 _mp.f_stable = 0.97;
135 }
136 else
137 {
138 return false;
139 }
140
141 return true;
142}
double f_lignin
Definition ld_manure.h:45
double avail_n
Definition ld_manure.h:33
double f_stable
Definition ld_manure.h:50
double f_urea
Definition ld_manure.h:38
double avail_c
Definition ld_manure.h:35

References ldndc::manure_properties_t::avail_c, ldndc::manure_properties_t::avail_n, ldndc::manure_properties_t::f_lignin, ldndc::manure_properties_t::f_stable, and ldndc::manure_properties_t::f_urea.

◆ non_stomatal_water_limitation()

double ldndc::non_stomatal_water_limitation ( double const & _var,
double const & _var_ref,
double const & _var_scale )

Non stomatal water limitation.

Parameters
_var...
_var_ref...
_var_scale...
Returns
Drought stress scaling factor [0-1]
148{
149 // water impact on non-stomatal limitations based on Tuzet et al.2003
150 if ( cbm::flt_greater_equal_zero( _var))
151 {
152 return 1.0;
153 }
154 else
155 {
156 return cbm::bound(0.0, (1.0 + std::exp(_var_ref * _var_scale)) / (1.0 + std::exp((_var_ref - _var) * _var_scale)), 1.0);
157 }
158}

Referenced by ldndc::PhysiologyGrowthPSIM::PSIM_PhotosynthesisRates().

Here is the caller graph for this function:

◆ sap_wood_fraction()

double ldndc::sap_wood_fraction ( double _lai_max,
double _qsfa,
double _height_min,
double _height_max,
double _depth )

sap_wood_fraction The calculation of the fraction of sapwood in coarse roots is based on the idealized volume fraction and assumes that the stem in the crown as well as the coarse roots are shaped as cones, and that core wood reaches a third of the cone

Calculation is based on the sapwood area demand for foliage. Sapwood volume is assumed to equal a cone within the canopy and across the rooted soil, and a column between the ground and canopy start.

Author
David Kraus (created on: may 6, 2014)
26{
27 /* sapwood area (assumed to be in equilibrium with foliage demand) */
28 double const sap_area( _lai_max * _qsfa);
29
30 /* estimated aboveground sapwood biomass */
31 double const msap_a( sap_area * _height_min + sap_area / 3.0 * (_height_max - _height_min));
32
33 /* estimated belowground sapwood biomass */
34 double const msap_b( sap_area / 3.0 * _depth);
35
36 if ( cbm::flt_greater_zero( msap_a + msap_b))
37 {
38 return msap_b / ( msap_a + msap_b);
39 }
40
41 return 0.0;
42}

◆ sapwood_foliage_area_ratio()

double ldndc::sapwood_foliage_area_ratio ( double _height,
double _qsf_p1,
double _qsf_p2 )
Parameters
_heightTree height
_qsf_p1species parameter
_qsf_p2species parameter
Returns
Ratio of sap wood area to foliage area.
106{
107 return (_qsf_p1 + _height * _qsf_p2) * cbm::M2_IN_CM2;
108}

◆ tillage_mix_water()

void LDNDC_API ldndc::tillage_mix_water ( lvector_t< double > & ,
lvector_t< double > const & ,
lvector_t< double > const & ,
size_t ,
double ,
lvector_t< double > const &  )

Fraction of an amount added to the tilled layers that ends up in layer _l: without inversion, material is put into the uppermost layer and mixed with the given mixing; with inversion, it is distributed over the lower half of the tilled layers in proportion to the layer thickness.

homogenizes the liquid water content [m3 m-3] of the tilled layers like tillage_mix() (water amount conserved), but never above the ice-free pore space of a layer; excess water is moved to the tilled layers that still have free pore space

130{
131 if (( _cnt == 0) || !cbm::flt_greater_zero( _mixing))
132 {
133 return;
134 }
135 double water( 0.0), depth( 0.0);
136 for ( size_t l = 0; l < _cnt; ++l)
137 {
138 water += _wc[l] * _h[l];
139 depth += _h[l];
140 }
141 if ( !cbm::flt_greater_zero( depth))
142 {
143 return;
144 }
145 double const wc_mean( water / depth);
146 for ( size_t l = 0; l < _cnt; ++l)
147 {
148 _wc[l] = (1.0 - _mixing) * _wc[l] + _mixing * wc_mean;
149 }
150 /* water above the ice-free pore space goes to layers with free pore space */
151 for ( int it = 0; it < 10; ++it)
152 {
153 double excess( 0.0), room( 0.0);
154 for ( size_t l = 0; l < _cnt; ++l)
155 {
156 double const wc_max( cbm::bound_min( 0.0, _poro[l] - _ice[l]));
157 if ( _wc[l] > wc_max)
158 {
159 excess += ( _wc[l] - wc_max) * _h[l];
160 _wc[l] = wc_max;
161 }
162 else
163 {
164 room += ( wc_max - _wc[l]) * _h[l];
165 }
166 }
167 if ( !( excess > 0.0) || !( room > 0.0))
168 {
169 break;
170 }
171 double const f( cbm::bound_max( excess / room, 1.0));
172 for ( size_t l = 0; l < _cnt; ++l)
173 {
174 double const wc_max( cbm::bound_min( 0.0, _poro[l] - _ice[l]));
175 if ( _wc[l] < wc_max)
176 {
177 _wc[l] += f * ( wc_max - _wc[l]);
178 }
179 }
180 }
181}

◆ update_litter_height()

lerr_t ldndc::update_litter_height ( soillayers::input_class_soillayers_t const & _soillayers,
substate_watercycle_t & _wc,
substate_soilchemistry_t & _sc )

Detailed description provided here .

Parameters
_slSoil layers class
_wcWatercycle state
_scSoilchemistry state
Returns
Error code
36{
37 double const raw_litter_above( _sc.c_raw_lit_1_above +
38 _sc.c_raw_lit_2_above +
39 _sc.c_raw_lit_3_above);
40
41 double h_cum( 0.0);
42 for( size_t sl = 0; sl < _soillayers.soil_layer_cnt(); ++sl)
43 {
44 if ( sl < _soillayers.soil_layers_in_litter_cnt())
45 {
46 if ( cbm::flt_greater_zero( _sc.dens_sl[sl] * _sc.fcorg_sl[sl]) &&
47 cbm::flt_greater_zero( _sc.som_sl[sl]))
48 {
49 double const volume_water( _wc.wc_sl[sl] * _sc.h_sl[sl]);
50
51 double const mass_soil( _sc.min_sl[sl] + _sc.som_sl[sl] + raw_litter_above / _soillayers.soil_layers_in_litter_cnt());
52 double const density_soil( cbm::DM3_IN_M3 * _sc.dens_sl[sl]);
53
54 // soil organic matter increases --> inc sl-height
55 double const h_new( mass_soil / density_soil);
56 _sc.h_sl[sl] = h_new;
57
58 double const wc_new( volume_water / _sc.h_sl[sl]);
59 if ( cbm::flt_less_equal( wc_new, _sc.poro_sl[sl]))
60 {
61 _wc.wc_sl[sl] = wc_new;
62 }
63 else
64 {
65 _wc.wc_sl[sl] = _sc.poro_sl[sl];
66 _wc.surface_water += (wc_new - _sc.poro_sl[sl]) * h_new;
67 }
68 }
69 else if ( !cbm::flt_greater_zero( _sc.som_sl[sl]))
70 {
71 _sc.h_sl[sl] = 0.0;
72 _wc.wc_sl[sl] = 0.0;
73
74 LOGERROR( "Soil litter layer height vanished. Illegal situation!");
75 return LDNDC_ERR_FAIL;
76 }
77 }
78
79 h_cum += _sc.h_sl[sl];
80 _sc.depth_sl[sl] = h_cum;
81 }
82
83 return LDNDC_ERR_OK;
84}

◆ wood_initialization()

lerr_t ldndc::wood_initialization ( soillayers::input_class_soillayers_t const & _sl,
MoBiLE_Plant * _p,
substate_soilchemistry_t & _sc,
ecosystem_type_e _ecosystemtype )

Initialization of aboveground and belowground wood debris, derived from existing vegetation.

28{
34 double const add_c_wood( ((_ecosystemtype == ECOSYS_FOREST_NATURAL) ? 0.3 : 0.1) * ( _p->mSap + _p->mCor) * cbm::CCDM);
35
36 //add 80% aboveground
37 _sc.c_wood += 0.8 * add_c_wood;
38 _sc.n_wood += 0.8 * add_c_wood / cbm::CCDM * _p->ncCor;
39
40 //add 20% belowground
41 for ( size_t sl = 0; sl < _sl.soil_layer_cnt(); ++sl)
42 {
43 _sc.c_wood_sl[sl] += 0.2 * _p->fFrt_sl[sl] * add_c_wood;
44 _sc.n_wood_sl[sl] += 0.2 * _p->fFrt_sl[sl] * add_c_wood / cbm::CCDM * _p->ncCor;
45 }
46
47 return LDNDC_ERR_OK;
48}

Referenced by ldndc::SoilChemistryMeTrX::MeTrX_update().

Here is the caller graph for this function:

Variable Documentation

◆ TMODE_DEFAULTS

lflags_t const ldndc::TMODE_DEFAULTS = TMODE_SUBDAILY|TMODE_PRE_DAILY|TMODE_POST_DAILY|TMODE_PRE_YEARLY|TMODE_POST_YEARLY
extern
Author
steffen klatt, edwin haas