LandscapeDNDC 1.37.0
Loading...
Searching...
No Matches
ldndc::NitrogenTransformationInhibitors Class Reference

Nitrification and urease inhibitors as explicit pools with first-order decay and concentration dependent inhibition (see Nitrification and urease inhibitors) More...

#include <models/soilchemistry/ld_enhanced_efficiency_nitrogen_fertilizers.h>

Public Member Functions

lerr_t set_ni_type (std::string const &)
 
double default_ni_dose (int _ni_type) const
 
double nitrification_inhibition (double, double) const
 
void decay (double &, double &, double, double, double) const
 

Static Public Member Functions

static int ni_type_index (std::string const &)
 
static int ui_type_index (std::string const &)
 

Detailed Description

Nitrification and urease inhibitors as explicit pools with first-order decay and concentration dependent inhibition (see Nitrification and urease inhibitors)

Member Function Documentation

◆ decay()

void ldndc::NitrogenTransformationInhibitors::decay ( double & _ni,
double & _ui,
double _h,
double _temperature,
double _time_fraction ) const

first-order decay of both inhibitor pools of one layer during one time step

361{
362 if ( cbm::flt_greater_zero( _ni))
363 {
364 _ni *= decay_factor_ni( _temperature, _time_fraction);
365 /* residues without effect are removed (avoids transport of negligible amounts) */
366 if ( !cbm::flt_greater_zero( _h) || (_ni / _h < 1.0e-4 * p_.ni_kmm[ni_type_])) { _ni = 0.0; }
367 }
368 else { _ni = 0.0; }
369 if ( cbm::flt_greater_zero( _ui))
370 {
371 _ui *= decay_factor_ui( _temperature, _time_fraction);
372 if ( !cbm::flt_greater_zero( _h) || (_ui / _h < 1.0e-4 * p_.ui_kmm)) { _ui = 0.0; }
373 }
374 else { _ui = 0.0; }
375}

◆ default_ni_dose()

double ldndc::NitrogenTransformationInhibitors::default_ni_dose ( int _ni_type) const
inline

default doses [kg (kg fertilizer N)-1] for events that give the inhibitor type but no amount

136{ return p_.ni_dose[_ni_type]; }

◆ ni_type_index()

int ldndc::NitrogenTransformationInhibitors::ni_type_index ( std::string const & _ni_type)
static

index of a nitrification inhibitor type, -1 if unknown (case insensitive, empty = dcd)

286{
287 std::string t( _ni_type);
288 for ( size_t i = 0; i < t.size(); ++i) { t[i] = (char)std::tolower( (unsigned char)t[i]); }
289 if (( t == "" ) || ( t == "?" ) || ( t == "dcd" ) || ( t == "dicyandiamide" )) { return NI_DCD; }
290 if (( t == "dmpp" ) || ( t == "dmpsa" )) { return NI_DMPP; }
291 if (( t == "nitrapyrin" ) || ( t == "nitrapyrine" )) { return NI_NITRAPYRIN; }
292 return -1;
293}

Referenced by set_ni_type().

Here is the caller graph for this function:

◆ nitrification_inhibition()

double ldndc::NitrogenTransformationInhibitors::nitrification_inhibition ( double _ni,
double _h ) const

inhibition [0-1] for an inhibitor amount [kg m-2] in a layer of height [m]

337{
338 if ( !cbm::flt_greater_zero( _ni) || !cbm::flt_greater_zero( _h))
339 {
340 return 0.0;
341 }
342 double const c( _ni / _h);
343 return p_.ni_max * c / (c + p_.ni_kmm[ni_type_]);
344}

◆ set_ni_type()

lerr_t ldndc::NitrogenTransformationInhibitors::set_ni_type ( std::string const & _ni_type)

parameter set of the nitrification inhibitor applied last

308{
309 int const t( ni_type_index( _ni_type));
310 if ( t < 0)
311 {
312 return LDNDC_ERR_FAIL;
313 }
314 ni_type_ = t;
315 return LDNDC_ERR_OK;
316}
static int ni_type_index(std::string const &)
Definition ld_enhanced_efficiency_nitrogen_fertilizers.cpp:285

References ni_type_index().

Here is the call graph for this function:

◆ ui_type_index()

int ldndc::NitrogenTransformationInhibitors::ui_type_index ( std::string const & _ui_type)
static

index of a urease inhibitor type, -1 if unknown (case insensitive: nbpt, nppt; empty = nbpt)

298{
299 std::string t( _ui_type);
300 for ( size_t i = 0; i < t.size(); ++i) { t[i] = (char)std::tolower( (unsigned char)t[i]); }
301 if (( t == "" ) || ( t == "nbpt" ) || ( t == "nppt" ) || ( t == "nbpt+nppt" )) { return 0; }
302 return -1;
303}