This repository corresponds to the R package in development for use of the Cohort Theory Model (CTM) which is a simple method for accounting for volume and mass changes in tidal systems. This package also contains a special implementation of CTM which uses the Marsh Equilibrium Model (MEM) to drive inorganic surface sedimentation and below ground organic matter addition, dynamically as a function of sea-level.
# Uninstall and reinstall developer branch from GitHub
# 1. If rCTM is already installed, uninstall rCTM
if ("rCTM" %in% installed.packages()) {
remove.packages('rCTM')
}
# 2. If rCTM is loaded and in the memory, forget rCTM
if ("rCTM" %in% (.packages())){
detach("package:rCTM", unload=TRUE)
}
# 3a. If devtools is not already installed, install it
if (! ("devtools" %in% installed.packages())) {
install.packages('devtools')
}
# 3. Install package from developer branch of GitHub
devtools::install_github("https://github.com/tilbud/rCTM/tree/JimH-dev")
# 4. Load most current version in the memory
library(rCTM)
# Check and install dependencies
# A column vector listing the packages needed
dependencies <- c("tidyverse",
"gganimate",
"gifski",
"png")
# Iterate through the necessary packages
for (i in 1:length(dependencies)) {
print(paste(dependencies[i], " ...", sep=""))
# If the package is not in the installed package ...
if (! (dependencies[i] %in% installed.packages())) {
# .. install it.
install.packages(dependencies[i])
} else {
print("... already installed.")
}
}
# Run rMEM with Cohorts example
memCohortExample <- runMemWithCohorts(startYear=2015, relSeaLevelRiseInit=0.3, relSeaLevelRiseTotal=100,
initElv=21.9, meanSeaLevel=7.4, meanHighWater=16.9, meanHighHighWater=25.4, meanHighHighWaterSpring=31.2,
suspendedSediment=3e-05, lunarNodalAmp=2.5, bMax=0.25,
zVegMin=-24.7, zVegMax=44.4, zVegPeak=22.1,
plantElevationType="orthometric", rootToShoot=2,
rootTurnover=0.5, rootDepthMax=30, omDecayRate=0.8,
recalcitrantFrac=0.2, settlingVelocity=2.8,
coreYear = 2050)
# look at the structure of the function output
str(memCohortExample)
# Look at the three tables making up the output
head(memCohortExample$annualTimeSteps)
head(memCohortExample$cohorts)
head(memCohortExample$core)
# run the animate cohorts function
# This will take a few minutes to run and then save an animation of accumulating cohorts
animateCohorts(cohorts=memCohortExample$cohorts,
scenario=memCohortExample$annualTimeSteps,
filename="MEM-Try_191212.gif")
#File descriptions
Citation:
Suggested acknowledgments:
- See Jim Morris' MEM web interface for inspiration
Guiding princples:
- "Equilibrium" in MEM is a target not a description of the current state.
- MEM tries to see how simple you can get the model and still be realistic.
- MEM ties elevation of marsh surface to ecosystem productivity.
- High elevation, stimulates biomass (to a point), and that causes marsh elevation to raise.
A lot of what underpins current versions of the Marsh Equilibrium Model and the Cohort Theory Model is the ideal mixing model, see Morris et al. 2016 and (Holmquist et al 2018](https://www.nature.com/articles/s41598-018-26948-7). This describes the density of a soil as the summation of the soils' relative organic and inorganic fractions, as well as the self-packing density of the organic (k1) and inorganic (k2) matter.
If you hold area constant, and you assume you know the input rates of organic and inorganic matter, you can use the ideal mixing model to calculate accretion rate (Morris et al. 2016, Morris 2006, Morris 2007).