Run a SocMo/RothC simulation from an input workbook (main entry point)
run.socmo.RdReads ./data_in/<input.sim.run>/input_<input.file>.xlsx, builds the
monthly RothC calendar for one or more rotation IDs (crop rotation,
cover crops, irrigation, tillage, organic amendments – see the
expand_* family), derives the carbon-input driving data, and runs
ROTH_C_SPIN_UP() + ROTH_C(). This is the "UK way" entry point: the
main documented way to run a simulation in socmor (as opposed to the
older, less consolidated socmo-run-french-way.R).
Usage
run.socmo(
input.sim.run,
input.file,
input.rotation.id,
input.case = NULL,
op.run = FALSE,
start_year = 2020,
n_years = 30,
op.export.data = NULL,
op.export.res = FALSE,
op.export.graphs = FALSE,
op.debug = FALSE,
op.soc.initial.adj = FALSE,
op.spin.up.sensitivity = 1e-06,
op.split.oa = "classic",
op.spin.out = "roth.c.example.file",
op.spin.up.analysis = FALSE,
op.spin.up.log.screen = FALSE,
op.adjust.cinput = NULL,
source.climate.data = "main.xlsx.file",
source.soil.data = "main.xlsx.file"
)Arguments
- input.sim.run
Name of the simulation run; also the subfolder of
./data_in/the input workbook is read from.- input.file
Base name of the input workbook, read from
./data_in/<input.sim.run>/input_<input.file>.xlsx.- input.rotation.id
Vector of rotation IDs to run (as found in the workbook's
Infosheet), or"all"to run every ID listed there.- input.case
Case label used to name the output container (
./data_out/<input.sim.run>/<input.case>/<input.case>_<id>/). Defaults toinput.filewhenNULL.- op.run
If
FALSE, only the input calendar is built (no model run) – useful to inspect/debug the calendar construction.- start_year
First simulation year.
- n_years
Number of years to simulate.
- op.export.data
Passed through for data export control (see call sites);
NULLdisables it.- op.export.res
If
TRUE, write result CSVs viaEXPORT_ROTHC_RES()into the run's output container.- op.export.graphs
If
TRUE, also render and save the rotation schematic plots (viaf.plot.rotation()) into the container'sfig/folder.- op.debug
If
TRUE, keep every intermediate calendar (rothc.calendar1torothc.calendar10) in the result, and run a sanity check on row counts.- op.soc.initial.adj
Observed total SOC (t C/ha). When set, forwarded to
ROTH_C()'sop.soc.initial.adj, which uniformly rescales the spin-up's active pools (DPM/RPM/Bio/Hum,IOMuntouched) so their sum matches this value – the spin-up shape (whicheverop.spin.outproduced it) is unchanged, only its total magnitude is corrected against a measured stock.- op.spin.up.sensitivity
Spin-up convergence threshold, forwarded to
ROTH_C_SPIN_UP().- op.split.oa
Organic amendment input format, forwarded to
ROTH_C_SPIN_UP()/ROTH_C():"classic"or extended (OA_kh/OA_rdpm).- op.spin.out
Which synthetic "year 1" driving data to prepend to the
.datfile and replay duringROTH_C_SPIN_UP()– i.e. what land use/management is assumed for the (unobserved) period beforestart_year. One of:"mean.first.rotation"– average the rotation's own months beforestart_year(closest to "take the data as given", only meaningful if the input calendar actually extends beforestart_year)."roth.c.example.file"(default) – the generic plant-cover/ carbon-input pattern shipped with RothC's own official example input file, used as a neutral default when no site history is assumed."historic.crop"– same pattern as"roth.c.example.file"with an explicit arableDPM_RPMof1.44."historic.grassland"/"historic.forest"– permanent plant cover (PC = 1, no bare months) with a smoother seasonal carbon input curve and a lowerDPM_RPM(0.67/0.25, more resistant plant material), for sites assumed to have carried grassland or forest before being converted to the current rotation. These push spin-up equilibrium SOC substantially higher than the arable-like defaults – the choice matters.
- op.spin.up.analysis
If
TRUE, keep the full per-cycle spin-up trace rather than just the end values, plot it withf.plot.spinup(), and savefig/spinup_analysis.png.- op.spin.up.log.screen
Whether
ROTH_C_SPIN_UP()prints progress to the console.- op.adjust.cinput
Optional named list (
PC,FYM,C_inp,DPM_RPM) that directly overrides the spin-up year's driving data, forwarded toROTH_C_SPIN_UP()– a finer-grained alternative toop.spin.out's presets, typically produced by calibrating one parameter (e.g. a single month'sC_inp) against a historic observed SOC value viaf.optim.param.c.input()rather than guessing a land-use preset.- source.climate.data
Either
"main.xlsx.file"to read climate data from the input workbook, or a path to a standalone climate CSV (e.g. one ofdata_in/climate/<station>.csv).- source.soil.data
Either
"main.xlsx.file"to read soil data from the input workbook, or a path to a standalone soil CSV.
Value
A named list, one entry per input.rotation.id (named by the
ID), each a list with: input (the parsed workbook data), res
(the ROTH_C() output), full.res (monthly calendar joined with
model output), param.model.run (the call's parameters), and, when
op.debug = TRUE, intermediate.calendars.
Details
Must be called with the working directory set to a project that has
./data_in/<input.sim.run>/input_<input.file>.xlsx on disk (e.g. a
consumer project such as socmo-sample-project/, not the socmor
package directory itself).