Learn R Programming

SoilR (version 1.1-23)

getC: Calculates the C content of the pools

Description

This function computes the carbon content of the pools as function of time. Have a look at the methods for details.

Usage

getC(object, as.closures = F)

Arguments

object
some model object, the actual class depends on the method used.
as.closures
if set to TRUE instead of a matrix a list of functions will be returned.

Value

t in GeneralModel or another model creating function.

Details

This function takes a Model object, which represents a system of ODEs and solves the system for $C(t)$. The numerical solver used can be specified in the constructors of the Model classes e.g. Model,Model_14,GeneralModel.

See Also

See examples in GeneralModel, GeneralModel_14, TwopParallelModel, TwopSeriesModel, TwopFeedbackModel, etc.

Examples

Run this code
  t=seq(0,10,by=0.1) 
  k=0.8
  C0=100
  In = 30
  
  #Create two models with same arguments but calling two different model creation functions
  Cmodel=OnepModel(t,k,C0,In)
  C14model=OnepModel14(t,k,C0,In,F0=0,inputFc=IntCal09)
  
  #getC can extract the amount of C from these two type of models
  Ctmodel=getC(Cmodel)
  Ctmodel14=getC(C14model)
  
  #The output is identical because parameter values are the same
  plot(t,Ctmodel,type="l")
  lines(t,Ctmodel14,col=2,lty=2,lwd=2)
  legend("topright",c("OnepModel output","OnepModel14 output"),col=1:2,lty=1:2,bty="n")

Run the code above in your browser using DataLab