| Title: | Soil Organic Carbon Turnover Modelling with 'C-TOOL' |
|---|---|
| Description: | Provides an 'R' interface to the 'C-TOOL' soil carbon turnover model for simulating soil organic carbon dynamics in agricultural systems. The package supports the definition of carbon inputs, management schedules, soil parameters, and temperature forcing, and includes tools for scenario analysis and calibration of selected model parameters against observed soil organic carbon stocks. The 'C-TOOL' model and related modelling framework are described by Petersen et al. (2002) <doi:10.1016/S0304-3800(02)00034-0>, Petersen et al. (2005) <doi:10.1016/j.soilbio.2004.08.006>, Petersen et al. (2013) <doi:10.1016/j.jclepro.2013.03.007>, and Taghizadeh-Toosi et al. (2014) <doi:10.1016/j.ecolmodel.2014.08.016>. Further applications and developments are described by Taghizadeh-Toosi et al. (2016) <doi:10.1016/j.agsy.2016.03.004>, Keel et al. (2017) <doi:10.1111/ejss.12454>, Taghizadeh-Toosi et al. (2020) <doi:10.1007/s11104-020-04500-9>, and Taghizadeh-Toosi and Christensen (2021) <doi:10.1038/s41598-021-97744-z>. |
| Authors: | Evandro H. Figueiredo Moura da Silva [aut], João Serra [aut], Franca Giannini-Kurina [aut, cre] |
| Maintainer: | Franca Giannini-Kurina <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 3.1.0 |
| Built: | 2026-07-05 08:18:06 UTC |
| Source: | https://github.com/cran/rCTOOL |
Clean and harmonize monthly allocation inputs.
.clean_monthly_allocations(m_config).clean_monthly_allocations(m_config)
m_config |
Management configuration list. |
Reads management configuration with monthly allocation vectors and returns a configuration containing 'plant_monthly_allocation'.
Depending on the user input: - if plant, grain and grass allocations are all provided, plant allocation is recalculated as grain plus grass - if only one allocation is provided, it is treated as plant allocation - if two allocations are provided, they must correspond to grain and grass; otherwise an error is returned
A management configuration list containing 'plant_monthly_allocation'.
Calculate soil carbon loss by first-order decomposition.
.decay(CO_t, k, tempCoefficient).decay(CO_t, k, tempCoefficient)
CO_t |
Carbon amount in the pool at time t. |
k |
First-order decomposition rate constant. |
tempCoefficient |
Temperature response coefficient. |
Carbon change due to decomposition during the timestep.
.soil_temp
.soil_temp(depth, month, T_ave, Amplitude, th_diff).soil_temp(depth, month, T_ave, Amplitude, th_diff)
depth |
Soil layer reference depth in cm. In the default C-TOOL configuration, the model operates with two fixed layers: topsoil (25 cm) and subsoil (100 cm). |
month |
Month index (1 to 12). |
T_ave |
Monthly mean air temperature. |
Amplitude |
Annual temperature amplitude used in the soil temperature equation. |
th_diff |
Thermal diffusivity. |
Soil temperature at the midpoint of the soil layer for the specified monthly timestep.
Calculate the temperature response coefficient for carbon decomposition.
.temp_coef(T_zt).temp_coef(T_zt)
T_zt |
Soil temperature at depth z and time t. |
Temperature response coefficient for carbon decomposition.
Example dataset used to demonstrate a basic rCTOOL simulation.
basic_examplebasic_example
A data frame.
Internal example dataset distributed with rCTOOL.
Check carbon balance consistency of a simulation.
check_balance(ctool_output, cin_config, s_config)check_balance(ctool_output, cin_config, s_config)
ctool_output |
Output from turnover model. |
cin_config |
Carbon input configuration. |
s_config |
Soil configuration. |
Computes the balance between initial soil carbon, cumulative carbon inputs, final carbon stocks and cumulative CO2 emissions. The balance should be zero or very close to zero.
The input 'ctool_output' data.frame, returned unchanged after checking carbon balance consistency.
Calibrates two C-TOOL parameters against observed SOC stocks: 'f_hum_top' and 'k_hum'.
ctool_calibrate( time_config, cinput_config, temperature_config, management_config, soil_config, observed, f_hum_top = c(min = 0.2, max = 0.6, by = 0.05), k_hum = c(min = 0.002, max = 0.004, by = 5e-04), cn_init = 10, years_col = "Year", obs_col = "SOC_obs", f_fom_top = 0.003, metric = "d_index", minimize = NULL, keep_simulations = FALSE, verbose = TRUE )ctool_calibrate( time_config, cinput_config, temperature_config, management_config, soil_config, observed, f_hum_top = c(min = 0.2, max = 0.6, by = 0.05), k_hum = c(min = 0.002, max = 0.004, by = 5e-04), cn_init = 10, years_col = "Year", obs_col = "SOC_obs", f_fom_top = 0.003, metric = "d_index", minimize = NULL, keep_simulations = FALSE, verbose = TRUE )
time_config |
A C-TOOL time configuration object returned by [define_timeperiod()]. |
cinput_config |
A C-TOOL carbon input configuration object returned by [define_Cinputs()]. |
temperature_config |
A C-TOOL compatible temperature configuration used by [run_ctool()]. It must contain at least 'month' and 'Tavg'. A single historical annual temperature amplitude is calculated internally from the monthly climatology of 'Tavg'. |
management_config |
A C-TOOL management configuration object returned by [management_config()]. |
soil_config |
A C-TOOL soil configuration object returned by [soil_config()]. All parameters are preserved, except 'f_hum_top', 'k_hum', and the internally recalculated 'f_rom_top'. |
observed |
A data frame with observed SOC values. By default, it must contain columns 'Year' and 'SOC_obs'. |
f_hum_top |
Named numeric vector defining the calibration range for 'f_hum_top', with names 'min', 'max', and 'by'. |
k_hum |
Named numeric vector defining the calibration range for 'k_hum', with names 'min', 'max', and 'by'. |
cn_init |
Initial C:N ratio used by [initialize_soil_pools()]. Default is '10'. |
years_col |
Name of the year column in 'observed'. Default is '"Year"'. |
obs_col |
Name of the observed SOC column in 'observed'. Default is '"SOC_obs"'. |
f_fom_top |
Fixed topsoil FOM transfer fraction used to calculate 'f_rom_top'. Default is '0.003'. |
metric |
Character. Metric used to select the best tested parameter set. Options are '"d_index"', '"RMSE"', '"R2"', '"MAE"', and '"Bias"'. Default is '"d_index"'. The legacy value '"d"' is also accepted and internally converted to '"d_index"'. |
minimize |
Logical. Should the selected metric be minimized? If 'NULL', sensible defaults are used: 'FALSE' for '"d_index"' and '"R2"', and 'TRUE' for '"RMSE"', '"MAE"', and absolute '"Bias"'. |
keep_simulations |
Logical. If 'TRUE', stores all calibrated simulation time series. Default is 'FALSE'. |
verbose |
Logical. If 'TRUE', prints progress messages. |
This function assumes that all C-TOOL simulation inputs have already been prepared using the standard rCTOOL workflow. The only additional data required for calibration is a two-column data frame containing observed SOC stocks by year.
The observed data frame must contain, by default:
- 'Year': observation year. - 'SOC_obs': observed SOC stock.
For each tested value of 'f_hum_top', 'f_rom_top' is calculated internally as:
'f_rom_top = 1 - f_hum_top - f_fom_top'
Invalid combinations where 'f_rom_top <= 0' are removed before model runs.
The function first evaluates the current C-TOOL parameter set supplied through 'soil_config'. It then evaluates the tested calibration grid. If the current C-TOOL parameter set performs as well as or better than the best tested calibration, the function recommends keeping the current parameters.
The main goodness-of-fit statistics returned by the function are RMSE, MAE, mean bias, R2, and the Willmott index of agreement, here reported as 'd_index'.
An object of class '"ctool_calibration"', a list containing:
Best tested calibration parameter set and its metrics.
Recommended parameter set. This may be either the current C-TOOL parameter set or the best tested calibration.
Text explaining whether to keep current parameters or use the best tested calibration.
Metrics for the current C-TOOL parameters and best tested calibration.
Metrics for all tested parameter combinations.
Observed SOC data used for calibration.
Simulation using the supplied soil configuration.
Simulation using the best tested calibration.
Simulation using the recommended parameter set.
Parameter grid used for calibration.
Optional list of all tested calibrated simulations.
Calibration settings.
Willmott, C. J. (1981). On the validation of models. Physical Geography, 2(2), 184-194.
# Example workflow: # # observed <- data.frame( # Year = c(1923, 1932, 1942, 1950), # SOC_obs = c(54.2, 53.8, 52.1, 51.4) # ) # # calib <- ctool_calibrate( # time_config = time_cfg, # cinput_config = cin_cfg, # temperature_config = t_cfg, # management_config = m_cfg, # soil_config = soil_cfg, # observed = observed, # f_hum_top = c(min = 0.20, max = 0.60, by = 0.05), # k_hum = c(min = 0.0020, max = 0.0040, by = 0.0005) # )# Example workflow: # # observed <- data.frame( # Year = c(1923, 1932, 1942, 1950), # SOC_obs = c(54.2, 53.8, 52.1, 51.4) # ) # # calib <- ctool_calibrate( # time_config = time_cfg, # cinput_config = cin_cfg, # temperature_config = t_cfg, # management_config = m_cfg, # soil_config = soil_cfg, # observed = observed, # f_hum_top = c(min = 0.20, max = 0.60, by = 0.05), # k_hum = c(min = 0.0020, max = 0.0040, by = 0.0005) # )
Calculates performance metrics between observed and simulated SOC values.
ctool_calibration_metrics(observed, simulated)ctool_calibration_metrics(observed, simulated)
observed |
Numeric vector with observed values. |
simulated |
Numeric vector with simulated values. |
The returned 'd_index' is the Willmott index of agreement.
A data frame with 'd_index', 'RMSE', 'R2', 'Bias', 'MAE', and 'n'.
Willmott, C. J. (1981). On the validation of models. Physical Geography, 2(2), 184-194.
ctool_calibration_metrics( observed = c(50, 52, 55), simulated = c(49, 53, 54) )ctool_calibration_metrics( observed = c(50, 52, 55), simulated = c(49, 53, 54) )
Prepare annual carbon input (from plants and/or manure) configuration.
define_Cinputs( management_filepath = NULL, Cin_top = NULL, Cin_sub = NULL, Cin_man = NULL, time_config = NULL )define_Cinputs( management_filepath = NULL, Cin_top = NULL, Cin_sub = NULL, Cin_man = NULL, time_config = NULL )
management_filepath |
Either a filepath to a management template or a data.frame containing 'Cin_top', 'Cin_sub' and 'Cin_man'. |
Cin_top |
Annual carbon input from plant residues in the topsoil. |
Cin_sub |
Annual carbon input from plant residues in the subsoil. |
Cin_man |
Annual carbon input from manure. |
time_config |
Time configuration object returned by 'define_timeperiod()' |
A list containing 'Cin_top', 'Cin_sub' and 'Cin_man'.
time_config <- define_timeperiod(yr_start = 2006, yr_end = 2008) define_Cinputs( Cin_top = c(2, 2, 2), Cin_sub = c(0.5, 0.5, 0.5), Cin_man = c(1, 1, 1), time_config = time_config )time_config <- define_timeperiod(yr_start = 2006, yr_end = 2008) define_Cinputs( Cin_top = c(2, 2, 2), Cin_sub = c(0.5, 0.5, 0.5), Cin_man = c(1, 1, 1), time_config = time_config )
Check whether a parameter value lies within specified physical bounds.
define_physical_boundaries(value, min_limit, max_limit)define_physical_boundaries(value, min_limit, max_limit)
value |
parameter value |
min_limit |
Minimum allowed value. |
max_limit |
Maximum allowed value. |
The input value if it lies within the specified physical bounds.
define_physical_boundaries(0.3, 0, 1)define_physical_boundaries(0.3, 0, 1)
Create the monthly simulation time structure.
define_timeperiod(yr_start, yr_end)define_timeperiod(yr_start, yr_end)
yr_start |
Initial simulation year. |
yr_end |
Final nd simulation year. |
A list with two elements: 'timeperiod', a data.frame containing monthly timesteps, years and annual timestep identifiers; and 'steps', the total number of simulated months.
define_timeperiod(yr_start=2006, yr_end=2010)define_timeperiod(yr_start=2006, yr_end=2010)
Exports a template that can be used to provide management inputs for the model. The exported file includes monthly allocation variables and carbon input columns initialized with zeros, so they can be filled by the user before being read by the model.
export_management_template(yr_start, yr_end, filepath)export_management_template(yr_start, yr_end, filepath)
yr_start |
Initial simulation year. |
yr_end |
Final simulation year. |
filepath |
Filepath where management template will be exported. |
Users should keep only the columns relevant to their workflow and avoid double accounting among allocation variables. For example, when 'plant_monthly_allocation' is used, grain and grass allocation columns should not be used simultaneously.
If monthly carbon inputs are provided directly, additional allocation columns may not be needed. These consistency checks are not enforced automatically and must be handled by the user when preparing the input file.
The exported template as a data.frame.
path <- tempfile(fileext = ".csv") export_management_template(2006, 2010, path)path <- tempfile(fileext = ".csv") export_management_template(2006, 2010, path)
Calculate FOM decomposition and carbon fluxes in the subsoil layer.
FOM_sub_calculations(FOM_sub_t, month, t_avg, amplitude, s_config)FOM_sub_calculations(FOM_sub_t, month, t_avg, amplitude, s_config)
FOM_sub_t |
Numeric. Carbon content in FOM subsoil pool (Mg C ha-1). |
month |
Integer. Month index (1–12). |
t_avg |
Numeric. Monthly mean air temperature (°C). |
amplitude |
Numeric. Annual historical temperature amplitude used in the soil temperature function. |
s_config |
List. Soil configuration parameters |
A list with updated pool values and fluxes for FOM subsoil layer.
FOM_sub_calculations( FOM_sub_t = 10, month = 7, t_avg = 15, amplitude = 10, s_config = soil_config() )FOM_sub_calculations( FOM_sub_t = 10, month = 7, t_avg = 15, amplitude = 10, s_config = soil_config() )
Calculate FOM decomposition and carbon fluxes in the topsoil layer.
FOM_top_calculations( FOM_top_t, month, t_avg = t_avg, amplitude = amplitude, s_config )FOM_top_calculations( FOM_top_t, month, t_avg = t_avg, amplitude = amplitude, s_config )
FOM_top_t |
Numeric. Carbon content in FOM top pool (Mg C ha-1). |
month |
Integer. Month index (1–12). |
t_avg |
Numeric. Monthly mean air temperature (°C). |
amplitude |
Numeric. Annual historical temperature amplitude used in the soil temperature function. |
s_config |
List. Soil configuration parameters. |
A list with updated pool values and fluxes for FOM topsoil layer.
FOM_top_calculations( FOM_top_t = 10, month = 7, t_avg = 15, amplitude = 10, s_config = soil_config() )FOM_top_calculations( FOM_top_t = 10, month = 7, t_avg = 15, amplitude = 10, s_config = soil_config() )
Calculate HUM decomposition and carbon fluxes in the subsoil layer.
HUM_sub_calculations(HUM_sub_t, month, t_avg, amplitude, s_config)HUM_sub_calculations(HUM_sub_t, month, t_avg, amplitude, s_config)
HUM_sub_t |
Numeric. Carbon content in the HUM subsoil pool (Mg C ha-1). |
month |
Integer. Month index (1-12). |
t_avg |
Numeric. Monthly mean air temperature (degrees C). |
amplitude |
Numeric. Annual historical temperature amplitude used in the soil temperature function. |
s_config |
List. Soil configuration parameters. |
A list with updated HUM subsoil pool values and associated fluxes.
HUM_sub_calculations( HUM_sub_t = 20, month = 7, t_avg = 15, amplitude = 10, s_config = soil_config() )HUM_sub_calculations( HUM_sub_t = 20, month = 7, t_avg = 15, amplitude = 10, s_config = soil_config() )
Calculate HUM decomposition and carbon fluxes in the topsoil layer.
HUM_top_calculations( HUM_top_t, month, t_avg = t_avg, amplitude = amplitude, s_config )HUM_top_calculations( HUM_top_t, month, t_avg = t_avg, amplitude = amplitude, s_config )
HUM_top_t |
Numeric. Carbon content in the HUM topsoil pool (Mg C ha-1). |
month |
Integer. Month index (1-12). |
t_avg |
Numeric. Monthly mean air temperature (degrees C). |
amplitude |
Numeric. Annual historical temperature amplitude used in the soil temperature function. |
s_config |
List. Soil configuration parameters. |
A list with updated HUM topsoil pool values and associated fluxes.
HUM_top_calculations( HUM_top_t = 20, month = 7, t_avg = 15, amplitude = 10, s_config = soil_config() )HUM_top_calculations( HUM_top_t = 20, month = 7, t_avg = 15, amplitude = 10, s_config = soil_config() )
Initialize topsoil and subsoil carbon pools.
initialize_soil_pools(cn, soil_config)initialize_soil_pools(cn, soil_config)
cn |
Soil carbon:nitrogen ratio. |
soil_config |
Soil configuration list. |
A list containing initialized topsoil and subsoil pools.
s_config <- soil_config() initialize_soil_pools(cn=15, soil_config = s_config)s_config <- soil_config() initialize_soil_pools(cn=15, soil_config = s_config)
Prepares management configuration for monthly carbon input allocation.
management_config( management_filepath = NULL, plant_monthly_allocation = NULL, grain_monthly_allocation = NULL, grass_monthly_allocation = NULL, manure_monthly_allocation = NULL, f_man_humification = 0.12 )management_config( management_filepath = NULL, plant_monthly_allocation = NULL, grain_monthly_allocation = NULL, grass_monthly_allocation = NULL, manure_monthly_allocation = NULL, f_man_humification = 0.12 )
management_filepath |
Either a filepath to a management template or a data.frame containing management allocation variables. |
plant_monthly_allocation |
Monthly distribution of plant carbon inputs. |
grain_monthly_allocation |
Monthly distribution of grain carbon inputs. |
grass_monthly_allocation |
Monthly distribution of grass carbon inputs. |
manure_monthly_allocation |
Monthly distribution of manure carbon inputs. |
f_man_humification |
Fraction of manure already humidified. |
This function can be used in two ways: 1. from a management template file or data.frame, such as one exported with 'export_management_template()' 2. by directly providing fixed monthly allocation vectors of length 12.
In the first approach, the user can specify monthly allocation fractions directly in the input file. When no crop rotation is considered, 'plant_monthly_allocation' should be used. When crop rotation is considered, grain and grass allocation fractions can be specified separately.
In the second approach, the user can directly provide monthly allocation vectors of length 12.
A list containing management allocation settings.
management_config( f_man_humification=0.192, plant_monthly_allocation = c(0,0,0,.08,.12,.16,.64,0,0,0,0,0), manure_monthly_allocation = c(0,0,1,0,0,0,0,0,0,0,0,0) )management_config( f_man_humification=0.192, plant_monthly_allocation = c(0,0,0,.08,.12,.16,.64,0,0,0,0,0), manure_monthly_allocation = c(0,0,1,0,0,0,0,0,0,0,0,0) )
Calculate ROM decomposition and carbon fluxes in the subsoil layer.
ROM_sub_calculations(ROM_sub_t, month, t_avg, amplitude, s_config)ROM_sub_calculations(ROM_sub_t, month, t_avg, amplitude, s_config)
ROM_sub_t |
Numeric. Carbon content in the ROM subsoil pool (Mg C ha-1). |
month |
Integer. Month index (1-12). |
t_avg |
Numeric. Monthly mean air temperature (degrees C). |
amplitude |
Numeric. Annual historical temperature amplitude used in the soil temperature function. |
s_config |
List. Soil configuration parameters. |
A list with updated ROM subsoil pool values and associated fluxes.
ROM_sub_calculations( ROM_sub_t = 10, month = 7, t_avg = 15, amplitude = 10, s_config = soil_config() )ROM_sub_calculations( ROM_sub_t = 10, month = 7, t_avg = 15, amplitude = 10, s_config = soil_config() )
Calculate ROM decomposition and carbon fluxes in the topsoil layer.
ROM_top_calculations(ROM_top_t, month, t_avg, amplitude, s_config)ROM_top_calculations(ROM_top_t, month, t_avg, amplitude, s_config)
ROM_top_t |
Numeric. Carbon content in the ROM topsoil pool (Mg C ha-1). |
month |
Integer. Month index (1-12). |
t_avg |
Numeric. Monthly mean air temperature (degrees C). |
amplitude |
Numeric. Annual historical temperature amplitude used in the soil temperature function. |
s_config |
List. Soil configuration parameters. |
A list with updated ROM topsoil pool values and associated fluxes.
ROM_top_calculations( ROM_top_t = 10, month = 7, t_avg = 15, amplitude = 10, s_config = soil_config() )ROM_top_calculations( ROM_top_t = 10, month = 7, t_avg = 15, amplitude = 10, s_config = soil_config() )
Run C-TOOL over the full simulation period.
run_ctool( time_config, cin_config, m_config, t_config, s_config, soil_pools, verbose = FALSE )run_ctool( time_config, cin_config, m_config, t_config, s_config, soil_pools, verbose = FALSE )
time_config |
Time configuration object created by 'define_timeperiod()'. |
cin_config |
Carbon input configuration. |
m_config |
Management configuration with monthly allocation patterns. |
t_config |
Monthly temperature configuration containing at least 'month' and 'Tavg'. |
s_config |
Soil parameter configuration. |
soil_pools |
Initial soil pool configuration. |
verbose |
Logical; if 'TRUE', run balance checking. |
Iteratively applies 'turnover()' over all timesteps defined in 'time_config' and returns monthly carbon pool sizes, soil carbon stocks, transport fluxes and CO2 emissions.
The temperature configuration must provide monthly mean air temperature. A single historical annual temperature amplitude is calculated internally from the monthly climatology of 'Tavg' and is used in the soil temperature response function.
A data.frame containing the monthly simulation output across the full simulation period.
Example dataset used to demonstrate scenario simulations in rCTOOL.
scenarioscenario
A data frame.
Internal example dataset distributed with rCTOOL.
Monthly temperature dataset used in rCTOOL scenario simulations.
scenario_temperaturescenario_temperature
A data frame.
Internal example dataset distributed with rCTOOL.
Prepare monthly temperature input data for rCTOOL.
set_monthly_temperature_data(file = NULL, Tavg = NULL)set_monthly_temperature_data(file = NULL, Tavg = NULL)
file |
Either a filepath to a csv file or a data.frame containing monthly temperature data. |
Tavg |
Numeric vector of average monthly temperature values. |
Monthly temperature data can be provided in two ways: 1. directly through the argument 'file', as a filepath or data.frame containing monthly temperature data 2. directly through the argument 'Tavg', as a numeric vector of average monthly temperature values
A data.frame containing monthly temperature input data. The output always contains 'Tavg'.
df_temp <- data.frame(Tavg = c(5, 6, 7, 8, 9, 15, 14, 11, 10, 9, 5, 1)) set_monthly_temperature_data(file = df_temp) set_monthly_temperature_data( Tavg = c(5, 6, 7, 8, 9, 15, 14, 11, 10, 9, 5, 1) )df_temp <- data.frame(Tavg = c(5, 6, 7, 8, 9, 15, 14, 11, 10, 9, 5, 1)) set_monthly_temperature_data(file = df_temp) set_monthly_temperature_data( Tavg = c(5, 6, 7, 8, 9, 15, 14, 11, 10, 9, 5, 1) )
Prepare monthly temperature input with a single historical amplitude.
set_monthly_temperature_data_historical_amplitude(file = NULL, Tavg = NULL)set_monthly_temperature_data_historical_amplitude(file = NULL, Tavg = NULL)
file |
Either a filepath to a csv file or a data.frame containing monthly temperature data. |
Tavg |
Numeric vector of average monthly temperature values. |
Monthly 'Tavg' data can be provided either as a filepath/data.frame through 'file' or directly as a numeric vector through 'Tavg'.
A single historical amplitude is calculated from the full monthly 'Tavg' series as:
This historical amplitude is then assigned to the full series in the 'Amplitude' column.
A data.frame containing 'Tavg' and a single historical 'Amplitude' repeated over the full series.
set_monthly_temperature_data_historical_amplitude( Tavg = c(1, 2, 4, 7, 11, 15, 17, 16, 13, 9, 5, 2) )set_monthly_temperature_data_historical_amplitude( Tavg = c(1, 2, 4, 7, 11, 15, 17, 16, 13, 9, 5, 2) )
Prepare soil configuration parameters.
soil_config( Csoil_init = 70.4, f_hum_top = 0.48, f_rom_top = 0.49, f_hum_sub = 0.312, f_rom_sub = 0.6847, Cproptop = 0.47, clay_top = 0.1, clay_sub = 0.15, phi = 0.035, f_co2 = 0.628, f_romi = 0.012, k_fom = 0.12, k_hum = 0.0028, k_rom = 3.85e-05, ftr = 0.0025, temp_method = "rctool", temp_amplitude_hist = NA_real_, temp_offset = 0, temp_th_diff = 3.5e-07 )soil_config( Csoil_init = 70.4, f_hum_top = 0.48, f_rom_top = 0.49, f_hum_sub = 0.312, f_rom_sub = 0.6847, Cproptop = 0.47, clay_top = 0.1, clay_sub = 0.15, phi = 0.035, f_co2 = 0.628, f_romi = 0.012, k_fom = 0.12, k_hum = 0.0028, k_rom = 3.85e-05, ftr = 0.0025, temp_method = "rctool", temp_amplitude_hist = NA_real_, temp_offset = 0, temp_th_diff = 3.5e-07 )
Csoil_init |
Initial carbon stock at depth 1m (Mg C ha-1). |
f_hum_top |
Initial HUM fraction in the topsoil layer. |
f_rom_top |
Initial ROM fraction in the topsoil layer. |
f_hum_sub |
Initial HUM fraction in the bottom layer. |
f_rom_sub |
initial ROM fraction in the bottom layer. |
Cproptop |
Proportion of the total carbon allocated to the topsoil. |
clay_top |
Clay fraction in the top soil. |
clay_sub |
Clay fraction in the subsoil. |
phi |
Legacy diffusion parameter used in the original rCTOOL temperature formulation. |
f_co2 |
Respiration fraction. |
f_romi |
Romification fraction. |
k_fom |
FOM decomposition rate constant. |
k_hum |
HUM decomposition rate constant. |
k_rom |
ROM decomposition rate constant. |
ftr |
Vertical transport rate. |
temp_method |
Temperature method identifier. |
temp_amplitude_hist |
Optional historical annual amplitude to be used in the soil temperature calculation. |
temp_offset |
Phase offset used in the soil temperature calculation. |
temp_th_diff |
Thermal diffusivity used in the physical soil temperature formulation. |
Exports a template that can be used to provide management inputs for the model. The exported file includes monthly allocation variables and carbon input columns initialized with zeros, so they can be filled by the user before being read by the model.
Users should keep only the columns relevant to their workflow and avoid double accounting among allocation variables. For example, when 'plant_monthly_allocation' is used, grain and grass allocation columns should not be used simultaneously.
If monthly carbon inputs are provided directly, additional allocation columns may not be needed. These consistency checks are not enforced automatically and must be handled by the user when preparing the input file.
A list containing soil configuration parameters.
soil_config(Csoil_init=72, f_hum_top=0.5, clay_sub = 0.35, clay_top=0.25)soil_config(Csoil_init=72, f_hum_top=0.5, clay_sub = 0.35, clay_top=0.25)
Calculate temperature-modified decomposition of a soil carbon pool.
soil_pool_decomposition( soil_pool, k, soil_depth, month, t_avg, amplitude, s_config )soil_pool_decomposition( soil_pool, k, soil_depth, month, t_avg, amplitude, s_config )
soil_pool |
Carbon amount in the soil pool. |
k |
First-order decomposition rate constant. |
soil_depth |
Soil layer thickness in cm. In the default C-TOOL configuration, the model operates with two fixed layers: topsoil (25 cm) and subsoil (100 cm). |
month |
Month index from 1 to 12. |
t_avg |
Monthly mean air temperature. |
amplitude |
Historical annual temperature amplitude previously calculate from the monthly temperature series. |
s_config |
Soil parameter configuration. |
Carbon change in the pool due to temperature-modified first-order decomposition.
Perform one monthly turnover step of C-TOOL.
turnover( timestep, time_config, cin_config, m_config, t_config, s_config, out, amplitude_hist )turnover( timestep, time_config, cin_config, m_config, t_config, s_config, out, amplitude_hist )
timestep |
Integer index of the simulation timestep. |
time_config |
Time configuration object created by 'define_timeperiod()'. |
cin_config |
Carbon input configuration. |
m_config |
Management configuration with monthly allocation patterns. |
t_config |
Monthly temperature configuration containing at least 'month' and 'Tavg'. |
s_config |
Soil parameter configuration. |
out |
Data frame containing pool values from the previous timestep. |
amplitude_hist |
Numeric. Historical annual air temperature amplitude calculated from the monthly climatology of 'Tavg'. |
Updates FOM, HUM and ROM pools for one monthly timestep using carbon inputs, management allocations, monthly mean air temperature, soil parameters, and the previous pool state.
A data.frame containing updated monthly pool sizes, carbon stocks, transport fluxes and CO2 emissions for the current timestep.
Legacy monthly turnover routine retained for backward compatibility.
turnover_beta(i)turnover_beta(i)
i |
Integer index of the simulation timestep. |
This function updates FOM, HUM and ROM pools for one monthly timestep using the historical C-TOOL workflow. It relies on objects defined in the calling environment and is retained only for backward compatibility.
A one-row data.frame containing updated pool sizes, carbon stocks, transport fluxes and CO2 emissions for the current timestep.
update_monthly_FOM_sub
update_monthly_FOM_sub( FOM_sub_t1, FOM_transport, C_in_plant_sub, month, m_config )update_monthly_FOM_sub( FOM_sub_t1, FOM_transport, C_in_plant_sub, month, m_config )
FOM_sub_t1 |
FOM content in the subsoil layer from the previous timestep. |
FOM_transport |
FOM transported from the topsoil. |
C_in_plant_sub |
Plant carbon input to the subsoil. |
month |
Month index from 1 to 12. |
m_config |
Management configuration list. |
Updated FOM content in the subsoil layer after plant inputs and transport from the topsoil.
update_monthly_FOM_top
update_monthly_FOM_top(FOM_top_t1, Cin_plant_top, Cin_manure, month, m_config)update_monthly_FOM_top(FOM_top_t1, Cin_plant_top, Cin_manure, month, m_config)
FOM_top_t1 |
FOM content in the topsoil layer from the previous timestep. |
Cin_plant_top |
Plant carbon input to the topsoil. |
Cin_manure |
Manure carbon input. |
month |
Month index from 1 to 12. |
m_config |
Management configuration list. |
Updated FOM content in the topsoil layer after monthly carbon inputs.
update_monthly_HUM_sub
update_monthly_HUM_sub(HUM_sub_t1, HUM_transport, FOM_humified_sub)update_monthly_HUM_sub(HUM_sub_t1, HUM_transport, FOM_humified_sub)
HUM_sub_t1 |
HUM content in the subsoil layer from the previous timestep. |
HUM_transport |
HUM transported from the topsoil. |
FOM_humified_sub |
Humified FOM added to the subsoil HUM pool. |
Updated HUM content in the subsoil layer after transport and humified FOM additions.
update_monthly_HUM_top
update_monthly_HUM_top(HUM_top_t1, C_in_man, FOM_humified_top, month, m_config)update_monthly_HUM_top(HUM_top_t1, C_in_man, FOM_humified_top, month, m_config)
HUM_top_t1 |
HUM content in the topsoil layer from the previous timestep. |
C_in_man |
Manure carbon input. |
FOM_humified_top |
Humified FOM added to the topsoil HUM pool. |
month |
Month index from 1 to 12. |
m_config |
Management configuration list. |
Updated HUM content in the topsoil layer after manure inputs and humified FOM additions.
update_monthly_ROM_sub
update_monthly_ROM_sub(ROM_sub_t1, HUM_romified_sub, ROM_transport)update_monthly_ROM_sub(ROM_sub_t1, HUM_romified_sub, ROM_transport)
ROM_sub_t1 |
ROM content in the subsoil layer from the previous timestep. |
HUM_romified_sub |
Romified HUM added to the subsoil ROM pool. |
ROM_transport |
ROM transported from the topsoil. |
Updated ROM content in the subsoil layer after romified HUM additions and transport from the topsoil.
update_monthly_ROM_top
update_monthly_ROM_top(ROM_top_t1, HUM_romified_top)update_monthly_ROM_top(ROM_top_t1, HUM_romified_top)
ROM_top_t1 |
ROM content in the topsoil layer from the previous timestep. |
HUM_romified_top |
Romified HUM added to the topsoil ROM pool. |
Updated ROM content in the topsoil layer after romified HUM additions.