Description Usage Arguments Details Value
View source: R/gangsta_s3Objects.R
compoundFactory and processFactory are the primary functions
used to create gangsta objects. compoundFactory is a function that
creates a compound object and all associated pool objects for
use by the gangsta package. processFactory creates a
process object and all associated transfer objects.
1 2 3 4 5 6 | compoundFactory(compoundName, molarRatios, initialMolecules,
respirationRate = NA, infiniteCompound = F)
processFactory(gangstaObjects, processName, energyTerm, fromCompoundNames,
toCompoundNames, molarTerms, transferOptions = NULL, organismName = "",
limitToInitMolecules = T)
|
compoundName |
A character vector of |
molarRatios |
A named numeric vector. Vector names are the names of the
chemical elements (think 'periodic table in chemistry') that are in the
|
initialMolecules |
The number of mols (or umols, etc.) of the compound
available at the beginning of the simulation. If the |
respirationRate |
The respiration rate (in units of energy per unit of
biomass per model timestep); applies to |
infiniteCompound |
Boolean when set to |
gangstaObjects |
A list of objects of class |
processName |
A character vector of the name of the |
energyTerm |
The chemical affinity of the processs. A positive number represents a process that yeilds energy, a negative number represents a process that consumes energy. Units are kJ (or J, etc.) of energy per mol (or umol, etc.) of the reaction. |
fromCompoundNames |
Named |
toCompoundNames |
See |
molarTerms |
Named list containing the mols (or umols, etc.) of each
element that are transfered by the |
transferOptions |
When transferOptions is |
organismName |
Name of the organism carrying out the |
The gangsta uses several classes of S3 objects to represent
biogeochemical systems. All S3 objects in gangsta are built atop
named lists with the class arribute set. The list's names are used as
attribute names and the values in the lists are the attribute values.
compound objects represent chemical species (e.g., SO4 and HS) that
generally contain one or more chemical elements; the mols (or umols, etc.) of
each element of interest (i.e., tracked element) within a compound are
tracked using a pool. Each pool records the mols of a tracked
element in the compound.
The molarRatios describe the chemical composition of the
tracked elements contained in compounds. For example, the molarRatios
for water could be represented as c(H = 2, O = 1) because a molecule
of water is composed of two hydrogen atoms and one oxygen atom.
Not all elements in a compound must be tracked. The model developer
only creates pools for the elements of interest. For instance, when
creating a compound for SO4, passing c(S=1) to
compoundFactory as the molarRatios vector would create only a
pool for sulfur, not for oxygen. Two pools, one for sulfur and
one for oxygen, would be created by passing c(S=1, O=4).
compound objects have attributes named name,
initialMolecules which are the starting values for the model run, and
infiniteCompound which is a Boolean indicating whether the compound is
a source/sink.
compound objects are also used to represent organisms (which
assimilate elements as they grow) in gangsta-derived models.
organism objects inherit from compound and contain an extra
attribute called respirationRate For organisms, the
respirationRate is energy (J, KJ, etc.) per mol (or umol, etc.) of
compound per timestep.
pool objects have attributes called name, elementName which is
the chemical element stored in the pool, compoundName which
indicates the compound with which the pool is associated, and
molarRatio which describes the ratio of atoms in the pool per
unit molecule, i.e., compound.
process objects have attributes called name, energyTerm which
is equal to the energy generated or consumed by the process,
organismName which is the name of the organism carrying out the
process, and transferOptions which are indices for the
transfers associated with each process. Each process with
nonzero energyTerm is of class "metabolic."
transfer objects have attributes called name, from which is the
pool from which atoms are being transfered, to which is the
pool to which atoms are being transfered, molarTerm which
enforces the stoichiometry of the process, molarAffinity which
is equal to the energyTerm of the process divided by the
molarTerm of the transfer, processName which is the name
of the process that the transfer is associated with, and
limitToInitMolecules which is a Boolean that inherits from process.
gangsta-derived models can operate using any unit of atomic count unit
(mols, umols, etc.), unit of energy (Joules, KJ, etc.) over any time unit
defined by the user. However, it is critical that all units for values
passed to the model be consistent. For example, the units of
respirationRate and the units of atomic count used by pool
objects must be consistent with the units of all other values passed to
functions in the gangsta package.
compoundFactory returns a list of compound and pool
objects. processFactory return a list of process and
transfer objects.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.