Each crop model definition is stored as a list with the following named
elements:
direct_modules: A list of direct module names; can be passed to
run_biocro as its direct_module_names argument.
differential_modules: A list of differential module names; can
be passed to run_biocro as its
differential_module_names argument.
ode_solver: A list specifying details of a numerical ODE
solver; can be passed to run_biocro as its ode_solver
argument.
initial_values: A list of named quantity values; can be passed
to run_biocro as its initial_values argument.
parameters: A list of named quantity values; can be passed to
run_biocro as its parameters argument, and also can be
passed to evaluate_module and
module_response_curve when investigating the behavior of one
of the crop's modules.
These model definitions are not sufficient for running a simulation because
run_biocro also requires drivers; for these crop growth models,
the drivers should be sets of weather data. The soybean model is
intended to be used along with the specialized soybean weather data
(see cmi_soybean_weather_data). The other crops should be used
with the other weather data (see cmi_weather_data).
Some quantities in the crop model definitions, such as the values of
photosynthetic parameters, would remain the same in any location; others, such
as the latitude or longitude, would need to change when simulating crop growth
in different locations. Care must be taken to understand each input quantity
before attempting to run simulations in other places or for other cultivars.
Typically, the modules in a crop model definition are defined as lists with
some named elements; the names facilitate on-the-fly module swapping via the
within function. For example, to change the soybean canopy
photosynthesis module to the BioCro:ten_layer_rue_canopy module, one
could pass within(soybean$direct_modules, {canopy_photosynthesis =
"BioCro:ten_layer_rue_canopy"}) as the direct_module_names argument
when calling run_biocro instead of
soybean$direct_modules.
Because each crop model definition is stored as a list with named elements,
it is possible to use the with function to save some typing when
calling run_biocro or related functions such as
partial_run_biocro or
validate_dynamical_system_inputs. For an example, compare
Example 1 and Example 2 below. Besides shortening the code,
using with also makes it easy to modify a command to simulate the
growth of a different crop; if the two models can use the same drivers, this
switch can be accomplished with one small change (Example 3).