Git Product home page Git Product logo

rctm-1's Introduction

Cohort Theory and Marsh Equilibrium Models

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.

To Download This Developer's Branch

To Uninstall and Reinstall the Latest Version

# 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)

To Make Sure You Have The Needed Dependencies

# 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.")
  }
}

Quick Example to Run MEM with Cohorts and Animate

# 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:

Relevant resources and literature

Equations and Fundamentals of MEM

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.

Ideal Mixing Model

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.

$$BD = {1 \over {{OM\over k1}+ {(1โˆ’OM) \over k2}}}$$

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).

rctm-1's People

Contributors

ktoddbrown avatar holmquistj avatar dklinges9 avatar faraharyan avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.