RUFAS.routines.field.soil.carbon_cycling.decomposition module#

class RUFAS.routines.field.soil.carbon_cycling.decomposition.Decomposition(soil_data: SoilData | None, field_size: float | None = None)#

Bases: object

This class is responsible for calculating the factors related carbon decomposition rate.

Parameters#

soil_dataSoilData, optional

An instance of SoilData containing soil properties and carbon pool information. A new instance is created if not provided.

field_sizefloat, optional, default None

The size of the field in hectares (ha). This is used to initialize a SoilData object if one is not provided.

Attributes#

dataSoilData

The SoilData instance being used by this module. Contains information about the soil’s properties, carbon pools, and other relevant data for simulating decomposition.

References#

Excel file in Basecamp, located at “Ruminant Farm Systems Model (RuFaS) › Docs & Files › Scientific Documentation › Soil and Crop Module › Literature › Carbon Models › DAYCENT”

Notes#

The equations for this model, referenced in the soil psuedocode, are derived from an excel file on Basecamp, but the meaning (and validity) of terms is extremely unclear from both sources. The documentation cannot be adequately completed without a better understanding of these methods.

__init__(soil_data: SoilData | None, field_size: float | None = None)#
decompose() None#

Determines decomposition effect for each layer and temperature effect.

static _calc_temp_factor(layer_temp, x_inflection: float = 15.4, y_inflection: float = 11.75, point_distance: float = 29.7, inflection_slope=0.03, normalizer=20.80546) float#

Calculate the temperature factor for each layer.

This function implements the “pseudocode_soil” S.6.A.1 and uses defaults drawn from defac: course soil.

Parameters#

layer_tempfloat

Temperature of the layer (Celsius).

Returns#

float

Temperature effect (unitless).

Notes#

This temperature factor is lower-bounded at 0.0 because if negative, it may result in a negative amount of decomposition, which in this context would be considered a bug.

static _calc_moisture_factor(water_factor, a_term: float = 0.55, b_term: float = 1.7, c_term: float = -0.007, first_exponent=6.648115, second_exponent=3.22) float#

Calculate the moisture factor for carbon decomposition for the layer.

This function implements the “pseudocode_soil” S.6.A.2 and uses defaults drawn from defac: course soil.

Parameters#

water_factorfloat

Relative water saturation (%).

a_termfloat, default 0.55

Coarse in defac row 3, column N

b_termfloat, default 1.7

Coarse in defac row 4, column N

c_termfloat, default -0.007

Coarse in defac row 5, column

first_exponentfloat, default 6.648115

First exponent in defac spreadsheet

second_exponentfloat, default 3.22

Second exponent in defac spreadsheet

Returns#

float

Moisture factor (unitless).

Notes#

If negative bases are raised to exponents, they sometimes result in complex numbers instead of negative floats. This behavior can cause the program to crash. To avoid this, a sign correction factor is computed, allowing the absolute value of the bases to be used.

The moisture effect is lower-bounded at 0 because if negative, it will lead to a negative decomposition factor, which is not meaningful.