models of soil organic matter decomposition: the soilr ... · model development models of soil...

16
Geosci. Model Dev., 5, 1045–1060, 2012 www.geosci-model-dev.net/5/1045/2012/ doi:10.5194/gmd-5-1045-2012 © Author(s) 2012. CC Attribution 3.0 License. Geoscientific Model Development Models of soil organic matter decomposition: the S OIL R package, version 1.0 C. A. Sierra, M. M ¨ uller, and S. E. Trumbore Max Planck Institute for Biogeochemistry, Hans-Kn¨ oll-Str. 10, 07745 Jena, Germany Correspondence to: C. A. Sierra ([email protected]) Received: 29 March 2012 – Published in Geosci. Model Dev. Discuss.: 2 May 2012 Revised: 2 August 2012 – Accepted: 4 August 2012 – Published: 24 August 2012 Abstract. Soil organic matter decomposition is a very impor- tant process within the Earth system because it controls the rates of mineralization of carbon and other biogeochemical elements, determining their flux to the atmosphere and the hydrosphere. SOILR is a modeling framework that contains a library of functions and tools for modeling soil organic mat- ter decomposition under the R environment for computing. It implements a variety of model structures and tools to rep- resent carbon storage and release from soil organic matter. In SOILR, organic matter decomposition is represented as a linear system of ordinary differential equations that gener- alizes the structure of most compartment-based decomposi- tion models. A variety of functions is also available to repre- sent environmental effects on decomposition rates. This doc- ument presents the conceptual basis for the functions imple- mented in the package. It is complementary to the help pages released with the software. 1 Introduction Soil organic matter decomposition is a fundamental process within the Earth system (Swift et al., 1979; Schlesinger, 1997; Jacobson, 2000). Through this process, carbon and other biogeochemical elements fixed by plants in the process of photosynthesis are transferred to the atmosphere and the hydrosphere in mineral form. This release of biogeochemical elements is fundamental for other processes in the Earth sys- tem, such as the global energy balance, with important con- sequences for climate. Soil organic matter decomposition is also a basic process for the availability of biogeochemical el- ements necessary for plant growth, therefore it has important consequences for agriculture and humanity. Given the importance of soil organic matter decomposi- tion, many models have been developed describing its dy- namics (Manzoni and Porporato, 2009), but only few at- tempts have been made to synthesize them (e.g. Paustian et al., 1997; Wu and McGechan, 1998; Manzoni and Por- porato, 2009). Although more than 250 different models of soil organic matter decomposition have been proposed since the 1930s, most of these models share common mathemati- cal structures (Manzoni and Porporato, 2009). This suggests that it is possible to develop models that can generalize most of the models already proposed. In fact, ˚ Agren and Bosatta (1998) have made important contributions to a general theory of organic matter decomposition with the development of the continuous quality theory. In most models, soil organic matter is usually charac- terized by compartments with homogeneous decomposition rates, which in the continuous quality theory are approx- imated by a continuous function between a rank variable denoted as quality and the decomposition rate. The con- tinuous quality approach introduces a high level of gener- ality, but it also introduces limitations in terms of finding analytical solutions for complex representations of organic matter heterogeneity (Sierra et al., 2011). For this reason, the continuous quality theory has only been implemented to describe the average dynamics of soil organic matter de- composition. Furthermore, the description of microbial dy- namics in the continuous quality theory lacks the generality needed to encompass different mathematical representations of microbial-substrate interactions. A general theory of soil organic matter decomposition can benefit greatly from a synthesis of the different modeling ap- proaches already proposed. It would help to identify model Published by Copernicus Publications on behalf of the European Geosciences Union.

Upload: trantram

Post on 06-Sep-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

Geosci Model Dev 5 1045ndash1060 2012wwwgeosci-model-devnet510452012doi105194gmd-5-1045-2012copy Author(s) 2012 CC Attribution 30 License

GeoscientificModel Development

Models of soil organic matter decomposition the SOIL R packageversion 10

C A Sierra M M uller and S E Trumbore

Max Planck Institute for Biogeochemistry Hans-Knoll-Str 10 07745 Jena Germany

Correspondence toC A Sierra (csierrabgc-jenampgde)

Received 29 March 2012 ndash Published in Geosci Model Dev Discuss 2 May 2012Revised 2 August 2012 ndash Accepted 4 August 2012 ndash Published 24 August 2012

Abstract Soil organic matter decomposition is a very impor-tant process within the Earth system because it controls therates of mineralization of carbon and other biogeochemicalelements determining their flux to the atmosphere and thehydrosphere SOILR is a modeling framework that contains alibrary of functions and tools for modeling soil organic mat-ter decomposition under theR environment for computingIt implements a variety of model structures and tools to rep-resent carbon storage and release from soil organic matterIn SOILR organic matter decomposition is represented as alinear system of ordinary differential equations that gener-alizes the structure of most compartment-based decomposi-tion models A variety of functions is also available to repre-sent environmental effects on decomposition rates This doc-ument presents the conceptual basis for the functions imple-mented in the package It is complementary to the help pagesreleased with the software

1 Introduction

Soil organic matter decomposition is a fundamental processwithin the Earth system (Swift et al 1979 Schlesinger1997 Jacobson 2000) Through this process carbon andother biogeochemical elements fixed by plants in the processof photosynthesis are transferred to the atmosphere and thehydrosphere in mineral form This release of biogeochemicalelements is fundamental for other processes in the Earth sys-tem such as the global energy balance with important con-sequences for climate Soil organic matter decomposition isalso a basic process for the availability of biogeochemical el-ements necessary for plant growth therefore it has importantconsequences for agriculture and humanity

Given the importance of soil organic matter decomposi-tion many models have been developed describing its dy-namics (Manzoni and Porporato 2009) but only few at-tempts have been made to synthesize them (egPaustianet al 1997 Wu and McGechan 1998 Manzoni and Por-porato 2009) Although more than 250 different models ofsoil organic matter decomposition have been proposed sincethe 1930s most of these models share common mathemati-cal structures (Manzoni and Porporato 2009) This suggeststhat it is possible to develop models that can generalize mostof the models already proposed In factAgren and Bosatta(1998) have made important contributions to a general theoryof organic matter decomposition with the development of thecontinuous quality theory

In most models soil organic matter is usually charac-terized by compartments with homogeneous decompositionrates which in the continuous quality theory are approx-imated by a continuous function between a rank variabledenoted as quality and the decomposition rate The con-tinuous quality approach introduces a high level of gener-ality but it also introduces limitations in terms of findinganalytical solutions for complex representations of organicmatter heterogeneity (Sierra et al 2011) For this reasonthe continuous quality theory has only been implementedto describe the average dynamics of soil organic matter de-composition Furthermore the description of microbial dy-namics in the continuous quality theory lacks the generalityneeded to encompass different mathematical representationsof microbial-substrate interactions

A general theory of soil organic matter decomposition canbenefit greatly from a synthesis of the different modeling ap-proaches already proposed It would help to identify model

Published by Copernicus Publications on behalf of the European Geosciences Union

1046 C A Sierra et al SOIL R v 10

structures that have been used frequently with certain degreeof success to represent observed data

RecentlyHeld (2005) has called to attention a growinggap between high-end simulations and theoretical under-standing in climate modeling which we believe also appliesto Earth system modeling in general Current models arehighly complex and use sophisticated algorithms to repre-sent different processes within the Earth system However itis difficult to obtain a basic understanding of system behav-ior from these models due to their complexity Furthermorethese models include only one single set of functions to rep-resent a specific process which is equivalent to proposingone single hypothesis to explain system structure and func-tion ThereforeHeld (2005) proposed the development ofhierarchical models in which detailed models can be reducedin hierarchies that help to better understand system dynam-ics On the one hand the general model has a high level ofabstraction and helps to elucidate basic properties of the sys-tem On the other hand detailed models are specific realiza-tions of the general models that can help to predict systembehavior under specific conditions such as climate changeor emission scenarios

In this document we introduce SOILR a modeling frame-work to represent the process of soil organic matter decom-position in terrestrial ecosystems It was developed underthe idea of hierarchical models that synthesize different ap-proaches to represent the decomposition process The currentversion is built under the mathematical formalism of lineardynamical systems to represent in a very general form soilorganic matter as a state variable with time dependent inputsoutputs and internal transformations

A dynamical system in a broad sense is a system thatevolves in time through the iterated application of an under-lying dynamical rule (Jost 2005) To describe the evolutionof a dynamical system over time it is necessary to representthe actual state of the system and a mathematical rule thatdictates the change of state There are many different waysto represent both the state of the soil system and its transitionrules SOILR provides the basic framework to accommodatedifferent representations of state or system structure and itsdynamics This is accomplished by a library of different nu-merical functions that can represent many different possibil-ities of soil organic matter dynamics

This document presents the main structural characteristicsof SOILR and the quantitative tools that can be used to rep-resent different soil biogeochemical processes The first ver-sion of this tool is focused on organic matter decompositionand other versions of the package will include nutrient dy-namics and isotopic composition

11 General information about SOIL R and R

The modeling framework we describe in this document isimplemented in theR environment for computing (R Devel-opment Core Team 2011) However numerical ecosystem

models are frequently developed in low-level programinglanguages such asC or Fortran There are many advantagesof using these low-level languages specially in terms of com-putational efficiency however they are difficult to learn forscientists not formally trained in programing At a differentside of the spectrum of programing languages is theR en-vironment a high-level language in which ease of use maycompromise efficiency For many applications in ecosystemmodeling the nature and size of the problems are usually notlarge enough for this to be an important issue Ease of usehowever has been a major constraint for a wide adoption ofmodels in ecosystem science

Another important issue for model development is acces-sibility Models coded in licensed software impose limita-tions in accessibility and future developments of new toolsand models Open-source software is ideal for guaranteeingthat code can be freely distributed used and modified by ev-eryone

SOILR was developed in theR environment for comput-ing to provide simple access of soil organic matter decom-position models in an open-source platform where the codeis freely accessible To see source code and examples of thefunctions implemented in SOILR the user only needs to typethe name of the function in theR command shell To ob-tain more detailed documentation the user can simply type aquestion mark () followed by a function name

R allows the integration of concepts from functional andobject oriented programing and can interface with manyother low-level programing languages (Chambers 2008) Ralso allows the development of software using concepts ofliterate programing(Knuth 1984) allowing the productionof code and documentation within the same environmentModels and data analyzes inR are therefore easily repro-ducible

As an open-source tool SOILR is also open for contri-butions by users interested in improving the existing codemake corrections on bugs in the code add new functionsimprove efficiency and functionality etc

2 Theoretical framework

21 Brief history of SOM modeling

Although early models of soil organic matter decompositionemployed geometric series or difference equations (egNiki-foroff 1936 Jenny et al 1949) the predominant mathemat-ical formalism since the 1940s is that of ordinary differentialequations (Manzoni and Porporato 2009) Representing de-composition of chemical substances by differential equationswas introduced much earlier than that (Vanrsquot Hoff 1884)However within the ecological disciplinesOlson (1963)presented the first comprehensive treatment of mathemati-cal models of organic matter decomposition popularizing themodel

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1047

dX

dt= L minus kX (1)

whereX is either oven-dry weight organic carbon or energyin organic matterL is the income of organic matter andk adecay constant

Equation (1) treats soil organic matter as one single com-partment with an overall decomposition rate representative ofall substances within the soil matrix It has been commonlynoted that soil organic matter is heterogeneous and the singleexponential model of decomposition fails to account for thisheterogeneity (Minderman 1968 Swift et al 1979) EarlierHenin et al(1959) proposed a model to account for the dif-ferent rates of decomposition of labile and stable materialalso considering the process of humification ie the transferof material from the labile to the stable pool This model canbe expressed as

dX1

dt= L minus k1X1

dX2

dt= αk1X1 minus k2X2 (2)

whereX1 represents the labile pool andX2 the stable poolThe parameterα represents the humification or transfer rateA different version of a two-pool model has been widely usedfor studies of litter decomposition in which the system ofequations takes the form (Minderman 1968 Means et al1985)

dX1

dt= γL minus k1X1

dX2

dt= (1minus γ )L minus k2X2 (3)

In this case the two pools decompose independently fromone another and the amount of litter inputsL is partitionedbetween the pools according to the parameterγ

Different variations of these models can be found in theliterature with different number of pools and transfer amongcompartments

Two numerical compartment models have become stan-dard in representing organic matter decomposition these arethe RothC (Jenkinson and Rayner 1977 Jenkinson et al1990) and the Century (Parton et al 1987) models Thesetwo models have been used successfully to represent soil car-bon dynamics at different spatial and temporal scales (Pauland Clark 1996 Paustian et al 1997) Although these mod-els were developed on the grounds of pragmatism ratherthan based on strict mathematical formalisms (Bolker et al1998) they can be easily translated into systems of differ-ential equations with the general model (Bolker et al 1998Paustian et al 1997)

dX1

dt=f1(θ1k1X1 middot middot middot θmkmXm)

dXm

dt=fm(θ1k1X1 middot middot middot θmkmXm) (4)

whereθ is a parameter set modifying the decomposition ratek andm the total number of compartments representing thesystem

In general the number of compartments in this type ofmodels is less than 10 (Manzoni and Porporato 2009) andthe decomposition rate constant may be a function of tem-perature moisture andor other edaphic conditions

We make use of this mathematical abstraction (Eq4) topropose a general model of soil organic matter decomposi-tion

22 A general model of soil organic matterdecomposition

Models of soil organic matter decomposition are in theirlarge majority specific cases of linear dynamical systems(Bolker et al 1998 Manzoni and Porporato 2009 Luo andWeng 2011) Making use of this property we propose amodel that generalizes the majority of all previously pro-posed compartment models This general model is given by

dC(t)

dt= I (t) + A(t)C(t) (5)

whereC(t) is a m times 1 vector of carbon stores inm poolsat a given timet A(t) is am times m square matrix containingtime-dependent decomposition rates for each pool and trans-fer coefficients between pools andI (t) is a time-dependentcolumn vector describing the amount of inputs to each poolm

The matrixA(t) is particularly important because it de-fines both the model structure and the extrinsic effects ondecomposition and transfer rates For this reason we rewriteEq (5) as

dC(t)

dt= I (t) + ξ(t)A C(t) (6)

whereξ(t) is a time-dependent scalar containing the extrin-sic or environmental effects on decomposition rates Noticethat the matrixA contains now constant coefficients definingmodel structure

From this general Eq (6) it is possible to derive a largevariety of structures for compartment models

23 The matrix A and model structure

Organic matter decomposition can be represented with alarge variety of model structures and levels of connectivity

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1048 C A Sierra et al SOIL R v 10

among compartments (Swift et al 1979 Bruun et al 2008Manzoni and Porporato 2009) Different model structuresare determined by the matrixA in linear dynamical systems(Bolker et al 1998 Manzoni et al 2009) For instance theparallel or pure decay structure (Fig1) in compartment mod-els is defined by a diagonal matrix of the form

A =

minusk1 0 middot middot middot 0

0 minusk2 middot middot middot 0

0 0 middot middot middot minuskm

where the entries in the diagonal represent the decompositionratekj for each compartmentj A required condition is thatall kj ge 0

Compartments connected in series (Fig1) can be repre-sented with a matrix of the form

A =

minusk1 0 0 middot middot middot 0a21 minusk2 0 middot middot middot 00 a32 minusk3 middot middot middot 0

0 0 0 middot middot middot minuskm

where the entriesaij are the transfer coefficients of materialfrom poolj to pooli A required condition is that allaij ge 0

Similarly feedback between adjacent compartments(Fig 1) is defined by a matrix of the form

A =

minusk1 a12 0 0 middot middot middot 0a21 minusk2 a23 0 middot middot middot 00 a32 minusk3 a34 middot middot middot 00 0 a43 minusk4 middot middot middot 0

0 0 0 0 middot middot middot minuskm

(7)

More complex model structures are created by replacingzero entries in the matrixA representing transfers betweendifferent compartmentsi andj

An important characteristic of the entriesaij is that theyare proportional to the decomposition rate ieaij = αijki whereαij represents the proportion of the decompositionrate that is transferred to pooli from pool j Furthermore0 le αij le 1 and the column sum

sumi αij le 1 with

rj = 1minus

sumi

αij (8)

representing the proportion of the decomposed material thatgets released from the system from poolj

24 The environmental termξ(t)

The majority of organic matter decomposition models in-clude functionsf (x) that modify decomposition rates ac-cording to a set of time-varying environmental conditions

No Pools 1 2 3

Parallel

Series

Feedback

Fig 1Basic model structures implemented in SOILR Squares rep-resent the compartments and arrows represent inputs and outputsto and from the compartments These model structures are specialcases of the matrixA

x1(t) xn(t) such as temperature moisture evapotranspi-ration etc (Burke et al 2003 Adair et al 2008) In ourmodel (Eq6) the representation of these environmental ef-fects is done with the termξ(t) which is the result of theevaluation of the function or set of functionsf (xi(t)) yield-ing a scalar value that can be directly multiplied to the matrixA In this case

ξ(t) = f (x1(t) xn(t)) (9)

The values off (xi(t)) are determined by different func-tions that depend on temperature precipitation and other en-vironmental variables Time-dependence is therefore intro-duced with time series of these environmental variables asinput in the model SOILR contains a library of functionsthat calculate environmental effects on decomposition ratesbased on functions reported for different models (Table1)

More complex functions are also introduced in SOILR butare not included in Table1 due to space limitations The doc-umentation and help files of SOILR contain a more detaileddescription of all functions

25 Initial conditions

The linear dynamical system represented by Eq (6) hasmany different solutions but we are only interested in thesolution that satisfies

C(t = 0) = C0 (10)

whereC0 is amtimes1 vector with the value of carbon content inthe different compartmentsi C0 must be specified in SOILRto run any possible model structure

26 The vector of inputs

Inputs to the system from above and belowground compo-nents are represented by the vectorI (t) This vector can also

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1049

Table 1 Functions implemented in SOILR to represent the effects of temperatureT and moistureW on decomposition rates

f (x) Terms Function name Source

f (T ) =

Q(T minus10)1010 T mean temperature fTQ10

4791+exp( 106

T +183 )T monthly temperature (C) fTRothC Jenkinson et al(1990)(

TmaxminusTTmaxminusTopt

)02exp

(02263

(1minus

(TmaxminusT

TmaxminusTopt

)263))

T Tmax Toptmonthly average maximumand optimal temperature

fTCentury1 Burke et al(2003)

3439exp

(02263

(1minus

(TmaxminusT

TmaxminusTopt

)263)(

TmaxminusTTmaxminusTopt

)02)

T Tmax Toptmonthly average maximumand optimal temperature

fTCentury2 Adair et al(2008)

08exp(0095Ts) Ts Soil temperature fTDaycent1 Kelly et al (2000)

056+ (146arctan(π00309(Ts minus 157)))π Ts Soil temperature fTDaycent2 Parton et al (2001) Grossoet al(2005)

0198+ 0036T T monthly temperature fTlinear Adair et al(2008)

exp(30856

(1

5602 minus1

(T +273)minus22713

))T monthly temperature fTLandT Lloyd and Taylor(1994)

exp(minus3764+ 0204T (1minus 05T369)) T mean temperature fTKB Kirschbaum(1995)

exp((ln(Q10)10)(T minus 20)) T mean temperatureQ10temperature coefficient

fTDemeter Foley(2011)

exp(minus(T (Topt+ Tlag))Tshape)Q

(T minus10)1010 T Tmax Topt

monthly averagemaximum and optimaltemperature

fTStandcarb Harmon and Domingo(2001)

f (W) =

11+30exp(minus85W)

W = PPETP monthly precipitation PETmonthly potentialevapotranspiration

fWCentury Parton et al(2001) Adair et al(2008)

(Wminusbaminusb

)d((bminusa)(aminusc)) (Wminuscaminusc

)dW water filled pore spacea b c dempirical coefficients

fWDaycent1 Kelly et al (2000)

5(0287) + (arctan(π0009(RWC minus 1747))π) W volumetric water content fWDaycent2 Grosso et al(2005)

025+ 075(MMsat) M soil moistureMsatsaturated soil mositure

fWDemeter Foley(2011)

(1minus exp(minus(3Mmin)(M + a)))b exp(minus(M(Mmax+ c))d ) M Mmin Mmax average minimumand maximum moisturecontent in litter poolabcd empirical coefficients

fWStandcarb Harmon and Domingo(2001)

be expressed as

I (t) = I (t)

γ1

γi

γm

(11)

whereI (t) is a time-dependent scalar representing the totalamount of inputs and the coefficientsγi represent the par-titioning among the different pools In this representation0 le γi le 1 and

summi=1γi = 1

27 Carbon release

A variable of interest in modeling soil organic matter decom-position is the amount of carbon leaving the system over time

either in the form of CO2 gas or as dissolved organic carbonWe represent this flux with the general termr which is givenby

r = RC(t) (12)

wherer is amtimes1 vector containing the instantaneous releaseof carbon for all pools andR is amtimesm diagonal matrix withthe release coefficientsrj in its diagonal calculated from (8)

28 Analytical solution

Analytical solutions to Eq (5) are implemented in SOILRonly with the purpose of testing the performance of the nu-merical methods However we can only test cases under cer-tain simplifications of the general model of Eq (5) In partic-ular for a homogeneous system with constant coefficientswhich is analogous to the decomposition of a single cohort

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1050 C A Sierra et al SOIL R v 10

of organic matter (Agren and Bosatta 1998) Eq (5) simpli-fies to

dC(t)

dt= AC(t) (13)

With initial conditions as in Eq (10) the analytical solu-tion to this problem is given by

C(t) = eA(tminust0)C0 (14)

If I (t) is not identically zero then the solution of the linearsystem

dC(t)

dt= I (t) + AC(t)

with initial conditions as in Eq (10) is given by

C(t) = eA(tminust0)C0 +

tintt0

eA(tminusτ)I (τ )dτ (15)

3 Numerical implementation

The solution to the dynamical system described by Eq (6) isdiscretized over time withh denoting the time step andn thenumber of steps The time steph may or may not be constantInitial conditions are given at timet0 = 0 The solution to thesystem is then given by

Cn+1 = Cn + Dr [fprime(Cn)h] (16)

whereDr [fprime(Cn)h] is anr order finite difference approxi-

mation to the system of ODEs of Eq (6) for each time steph(LeVeque 2007) in other words an ODE solver

The choice for the ODE solver is flexible in SOILR Cur-rently we provide the option to use a simple Euler forwardmethod or an interface to thedeSolve package ofSoetaertet al (2010) The functiondeSolvelsodawrapperin SOILR is a wrapper to the functionlsoda in packagedeSolve

31 TheModel class

The general numerical model described by Eq (6) is rep-resented in SOILR by an object oriented design centeringaround the classModel Nearly all computations possible inSOILR are facilitated byModel itself or its building blocksThe class defines the information allModel objects containand how those objects behave when (generic) functions areapplied to them (Chambers 2008) Any model constructedwith SOILR provides then a stable and consistent interfacethat encapsulates details about its implementation This in-terface provide a number of advantages to the user

1 A level of abstraction close to the mathematical descrip-tion of the model being implemented focusing on thescientific content rather than on technical details

2 Stability of code generated by the user based on SOILRoutput We believe that the more essential and less re-dundant the interface the less likely it is to change infuture revisions

3 Safeguards against unreasonable (and therefore prob-ably unintentional) input from simple dimensionalchecks to mathematical consistency of all arguments ofthe general model described in Sects22through27

4 Smaller programs that are easier to read

Developers also benefit from this implementation design by

1 Freedom to change the implementation behind thescenes without breaking user code

2 Easier maintenance testing bug tracking and exceptionhandling by reduced duplication

Objects of classModel are initialized in SOILR by vari-ous functions which are listed with the commandModel Most of them provide shortcuts for the construction of stan-dard models such as those in Fig1 These functions usuallydo not require the user to consider the real building blocks ofaModel object but rather infer the needed information fromobjects more common inR such as data frames Howeverall these high-level functions callGeneralModel which isthe most general constructor The functionGeneralModelinitializes theModel object after applying various validitychecks but does not run the model itself which instead isdone by specific functions (methods) applied to objects ofclassModel

The functionGeneralModel takes five arguments rep-resenting a specific case of Eq (6)

1 A vector t which contains the time values where thesolution to the ODE system is sought It can be of anylength but must be of classnumeric

2 An object of classTimeMap which implements thematrix A of Eq (5) as a function of time (including itsdomain) thus allowing the same level of abstraction asthe most general ODE solvers (Soetaert et al 2010)The classTimeMap is native to SOILR and simply ex-tends a commonR function to a mathematical validfunction definition that includes the time domain wherethe function is defined Thus it contains the necessaryinformation to prevent extrapolations beyond the rangeof input data Details aboutTimeMap are discussed inAppendixA

3 A vector of classnumeric containing the initialvaluesC0 of the ODE system

4 Again an object of classTimeMap containing theinputs I (t) to the system as a vector valued functionof time The length of this vector must be equal to thedimension of the matrixA and is checked as well as thetime domain

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1051

5 A string choosing the solver to be used

Once a new object of classModel is intialized from a callto GeneralModel or one of its various wrappers the newobject can be queried by several generic functions For ex-ample to obtain the amount of carbon over time solving thesystem of ODEs any object of classModel (and thereforeall its subclasses) can be used as argument of the functiongetC The call to this function returns an times m matrix withthe amount of carbon for each poolm at each time stepnSimilarly to obtain the amount of carbon release over timethe functiongetReleaseFlux can be called with any ob-ject of classModel as argument The result will be an times m

matrix with the amount of released carbon for each poolm

at each time stepn It is also possible to use the typical op-erators[ ] and $ for our Model class given access tomethods even easier For examplegetC(mod) is equiva-lent tomod$Cand something like

df=asdataframe(cbind(getTime(mod)getC(mod)))

can also be expressed as

df=mod[c(time C)]

This avoids the necessity of the somewhat dangerous use ofthe operator in user code which we strongly discouragesince it attaches the code to implementational details thatmay change in the future

The implementation of specific models as subclasses ofModel with methods for the generic functions will allow theintegration of new functionality without major modificationsto our current implementation For example once nutrientcycling and isotope dynamics are incorporated into SOILRnew methods will be developed independently without majormodifications to the current implementation of carbon stocksand release

The vignette GeneralModel provided with SOILRpresents some further insight in the implementation of spe-cific model structures with the help of the general tool-setprovided by theModel class The examples therein mayalso serve as templates to implement new model structuresas desired by the user Examples on how to use these modelstructures as a function are presented in Sect4

32 Version control system unit testing and automaticdocumentation

The development of SOILR is aided by a significant amountof existing open- source software To solve the ordinary dif-ferential equations produced by our framework we rely onthe well tested and documenteddeSolve package devel-oped bySoetaert et al(2010) We also use the open-sourcesymbolic python library SymPy (SymPy Development Team2008) to compute analytical solutions for the models forwhich this is possible The analytical solutions obtained from

SymPy are used to automatically create unit tests for SOILRTo constantly run these tests we use another open-sourcesoftware theRunit package (Burger et al 2009) The testsare distributed with the release version of SOILR and thusadd to the transparency of its development In addition weuseSweave (Leisch 2002 2003) and theinlinedocspackage (Hocking et al 2012) to produce documentationand encourage a literate programing style (Knuth 1984)As a version control system we use Mercurial (OrsquoSullivan2009) and the Trac (Edgewall Software 2011) online projectmanagement tool which includes ticket system wiki andonline access to our source code

33 Documentation

There are different types of documentation for SOILR Thefirst source of information is this document which intro-duces the science and some general technical details Asecond source of information is the documentation to eachfunction provided within the package itself To view thisdocumentation the user only needs to openR and typehelpstart() This will open a help window on a web-browser There the user only needs to go to PackagesSoilR toview a list of all the functions implemented Clicking on eachfunction will show details about the arguments of each func-tion and examples on how to use them For specific functionsthe user can also just type the name of the function precededby the question mark on theR command shell For exampletyping TwopParallelModel in the R command shellwill open a help window with the description of the functionTo view the source code of the function the user only needsto type the name of the function (without the question mark)on theR command shell

A third source of information are the so called Package Vi-gnettes These are short documents illustrating the use of thepackage for specific purposes Currently we provide one vi-gnette with version 10 of SOILR This vignette illustratesthe implementation of any model structure within SOILRFor future versions we will provide vigenettes about fittingspecific model structures to data and how to use SOILR formodeling radiocarbon

34 Installing and loading SOIL R

SOILR can be obtained from the ComprehensiveR ArchiveNetwork (CRAN) the official repository forR packageswith mirrors in places all over the world Packages storedin CRAN can be downloaded directly from anR ses-sion It can also be obtained from R-Forge a repositoryfor package developers To install SOILR from CRANthe user simply needs to type in theR command shellinstallpackages(SoilR) To install from R-Forge the statement isinstallpackages(SoilRrepos=httpR-ForgeR-projectorg) After installing the package simply type

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1052 C A Sierra et al SOIL R v 10

library(SoilR) and the package is loaded intoyourR session

4 Examples

In this section we present examples on how to runsome of the functions implemented in SOILR basedon the theoretical framework presented previously Ad-ditional details about the implementations of each func-tion and instructions on how to implement new modelstructures are presented in the vignette lsquoImplementingCompartment Models in SOILR the GeneralModelFunctionrsquo provided with the package To view thisvignette simply typevignette(GeneralModelpackage=SoilR) in theR command shell

41 Implementation of a two pool model withconnection in series the ICBM model

One of the first models ever proposed to represent soil or-ganic matter dynamics was a two-pool model with connec-tion in series (cf Eq2 Henin et al 1959) More than50 yr laterAndren and Katterer(1997) proposed the ICBMmodel which is practically the same model proposed earlierby Henin et al(1959) but including a term for temperatureand moisture dependence of decomposition rates The set ofdifferential equations of the ICBM model are given by

dC1

dt= I minus k1ξC1

dC2

dt= αk1ξC1 minus k2ξC2 (17)

whereα is a humification or transfer coefficient andξ a pa-rameter representing external effects on decomposition ratesIn the ICBM modelC1 represents a ldquoyoungrdquo pool andC2 anldquooldrdquo pool This set of equations can be rewritten using ourmodel formulation which gives

dC

dt= I

(10

)+ ξ

(minusk1 0αk1 minusk2

)(C1C2

) (18)

with initial conditions(C10C20)T and where

A =

(minusk1 0a21 minusk2

)

with a21 = αk1 γ = 1 andξ(t) = ξ The function ICBMModel in SOILR implements this

model structure requiring as its arguments (1) a vector ofany length with the points in time when we are interested infinding a solution (2) a column vector of decomposition rates(k1k2)

T (3) the value ofα (4) the value ofξ (5) a columnvector with the initial amount of carbon at the beginning ofsimulation(C10C20)

T and (6) the mean annual carbon in-put to the soilI Andren and Katterer(1997) provided values

for these arguments from a 35-yr field experiment manipu-lating carbon and nitrogen inputs to an agricultural soil inSweden For the case of a treatment in which the soil wasleft as bare fallow without N or C inputs the ICBM modelcan be parameterized as

dC

dt= 0

(10

)+ 132

(minus08 0

013times 08 minus000605

)(C1C2

) (19)

with initial conditions(03396)T Assuming SOILR is already installed it is only necessary

to write the following lines of code to run the ICBM model

library(SoilR)times=seq(020by=01)Bare=ICBMModel(t=times ks=c(k1=08

k2=000605) h=013 r=132c0=c(C10=03C20=396) In=0)

The call toICBMModel simply initialize the model andchecks for consistency on its arguments In this example thedecomposition rates are given in units of yearminus1 and the ini-tial amounts of carbon in units of kg C mminus2

To obtain the amount of carbon over time it is necessary toinvoke the functiongetC storing the output into an objectFor example to store the amount of carbon from the objectBare the user can type

CtBare=getC(Bare)

This new objectCtBare is a matrix with 2 columns(2 pools) and 201 rows (201 points in time from 0 to 20in increments of 01) To obtain the total amount of carbonie the sum of the pools the R functionrowSums can beused For example plotting the total amount of carbon overtime as well as the carbon on each pool only requires theselines of code

plot(times rowSums(CtBare)type=lylim=c(05) ylab=Topsoil carbonmass (kg m-2)xlab=Time (years)lwd=2)

lines(times CtBare[1]lty=2)lines(timesCtBare[2]lty=3col=2lwd=2)legend(toprightc(Total carbon

Carbon in pool 1 Carbon in pool 2)lty=c(123)col=c(112)lwd=c(212)bty=n)

If the total amount of carbon is needed for further calcula-tions the output ofrowSums() can be stored in an objectwith any name

We implemented the different N and C treatments reportedin Andren and Katterer(1997) from the set of parametersreported by those authors The code necessary to reproduceFig 2 inAndren and Katterer(1997) is provided as an exam-ple with the functionICBMModel and can be accessed by

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1053

0 5 10 15 20

02

46

8

Time (years)

Tops

oil c

arbo

n m

ass

(kg

m-2

)

Bare fallow+N +Straw-N +Straw-N -Straw+N -StrawManureSludge

Fig 2 Model predictions with the version of the ICBM modelimplemented in SOILR This graph reproduces Fig 2 inAn-dren and Katterer(1997) This figure can be reproduced typ-ing example(ICBMModel) or attr(ICBMModelex) inSOILR

typing example(ICBMModel) or from the html help inR This code produces Fig2 which is identical to Fig 2 inAndren and Katterer(1997)

42 Alternative two-pool models

The ICBM model described in the previous section althoughuseful does not offer too much flexibility in terms of the in-put arguments For example the litter inputs to the systemcould vary over time as well as the temperature and moistureeffects on decomposition rates In addition there are otherpossibilities to implement a two pool model depending onthe type of connection between pools (Fig1)

The parallel pool model structure can be implemented withthe functionTwopParallelModel while a more gen-eral version of a series model structure can be implementedwith the functionTwopSeriesModel Similarly the feed-back model structure can be implemented with the functionTwopFeedbackModel The inputs of litter and the mod-ification of decomposition rates by external factors can beeither constant or a function of time Furthermore the func-tions presented in Table1 and their combinations can beused as arguments in the different model structures provid-ing a large variety of options to model decomposition withjust two pools In fact the same flexibility can be obtainedwith any number of pools with the application of the moregeneral functionGeneralModel

As an example we show the differences obtained by run-ning three different versions of a two-pool model with the

0 5 10 15 20

05

1015

20

Car

bon

stoc

ks (a

rbitr

ary

units

) Two-pool ParallelTwo-pool SeriesTwo-pool Feedback

0 5 10 15 20

00051015202530

Time

Car

bon

rele

ase

(arb

itrar

y un

its)

Fig 3 Examples of three different representations of a two-poolmodel with different model structures and environmental effects ondecomposition rates The upper panel shows carbon stocks and thelower panel carbon release Additional details about the implemen-tation are given in the text

same amount of carbon at the beginning of the simulationsimilar rates of litter inputs and equal decomposition rates(Fig 3) As an illustration we also ran the simulations withdifferent options for the time dependence of the litter inputsand the decomposition rates In the first simulation we ran amodel with a structure of parallel compartments In this sim-ulation the litter inputs and decomposition rates were con-stant but the decomposition rates were modified by averagevalues of temperature and moisture according to the func-tions proposed in the Daycent model (Table1) For the sec-ond simulation we ran a two-pool model with connectionin series introducing temporal variability in the amount ofinputs using a sine function that artificially represents an an-nual cycle In the third simulation we ran a two-pool modelwith connection in series among compartments The amountof litter inputs over time were calculated using random num-bers over time In this simulation we also produced ran-dom numbers of temperature and moisture and applied thefunctions to modify decomposition rates according to theCentury and the Demeter models (Fig3) The code to re-produce Fig3 is provided in the example of the functionTwopFeedbackModel

These simulations without being necessarily realisticsimply show that small differences in model structure canproduce very different predictions even when the main pa-rameters of the model remain unchanged The simulationsalso serve to illustrate different possibilities in the use of the

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1054 C A Sierra et al SOIL R v 10

basic functions of SOILR to represent the process of organicmatter decomposition over time

To implement more sophisticated models with a higher de-gree of complexity it is possible to specify a larger amount ofpools with complex functions representing the dependence oflitter inputs decomposition rates and transfer between poolswith other external variables such as temperature moisturesoil texture nutrient status among many other

43 Implementation of the RothC model

RothC is a popular and widely used model for predicting or-ganic matter dynamics over time Although earlier versionsof the model included five active pools and one inert pool(Jenkinson and Rayner 1977) more recent versions only in-clude four active pools plus the inert pool (Jenkinson et al1990) RothC is implemented within SOILR and we providedetails here about this implementation to illustrate the useand potential implementation of any other model RothC canbe described by the following set of differential equations

dC1

dt= γ I minus k1C1

dC2

dt= (1minus γ )I minus k2C2

dC3

dt= α31k1C1 + α32k2C2 minus k3C3 + α33k3C3 + α34k4C4

dC4

dt= α41k1C1 + α42k2C2 + α43k3C3 minus k4C4 + α44k4C4

dC5

dt= 0 (20)

whereC1 represents the decomposable plant material (DPM)poolC2 the resistant plant material (RPM) poolC3 the mi-crobial biomass (BIO) poolC4 the humified organic matter(HUM) pool andC5 the inert organic matter pool (IOM)This set of equations can be rewritten in the form

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0α31k1 α32k2 minusk3(1minus α33) α34k4 0α41k1 α42k2 α43k3 minusk4(1minus α44) 0

0 0 0 0 0

C1C2C3C4C5

or as

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0a31 a32 minusk3 + a33 a34 0a41 a42 a43 minusk4 + a44 00 0 0 0 0

C1C2C3C4C5

(21)

The values of the decomposition rates are constant and givenby k1 = 10 k2 = 03 k3 = 066 andk4 = 002 (Jenkinsonet al 1990 Coleman and Jenkinson 1999) The value ofthe transfer coefficients is determined by a function of soiltexture For the microbial biomass pool transfer coefficientsare calculated as

a3j = kj

046

x + 1(22)

wherex is a value that determines the proportion of decom-posed material that is respired as CO2 and is given by

x = 167(185+ 160exp(minus00786pClay)) (23)

wherepClay is percent clay in mineral soil (Jenkinson et al1990) Similarly the transfer coefficients for the humifiedpool are given by

a4j = kj

054

x + 1 (24)

The partitioning of incoming plant material is determinedby the ratio DPMRPM which in RothC is set as 144 There-foreγ = 059 Now the basic structure of the RothC modelcan be written as

dC

dt= I

059041

000

+

minus10 0 0 0 0

0 minus03 0 0 0102 003 minus059 001 0119 004 008 minus002 0

0 0 0 0 0

C1C2C3C4C5

(25)

The annual amount of inputs is set in the RothC model asI = 17 Mg C haminus1 yrminus1

With this parameterization it is possible to run the RothCmodel without varying environmental effects on decompo-sition rates and observe how the system approaches steady-state for the different pools (Fig4) Parameter values ini-tial conditions and litter inputs can be changed easily withinSOILR to compare different predictions from this model

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1055

0 100 200 300 400 500

05

1015

2025

Time (years)

Car

bon

stor

es (M

g Cha

minus1)

Pool 1 DPMPool 2 RPMPool 3 BIOPool 4 HUMPool 5 IOMTotal Carbon

Fig 4 Carbon accumulation for the different pools included in theRothC model DPM the decomposable plant material pool RPMresistant plant material BIO microbial biomass pool HUM humi-fied organic matterpool and IOM inert organic matter pool

44 Applications for large-scale modeling

R can handle a large variety of data structures which offersinteresting possibilities for the application of the functionsimplemented in SOILR One important type of data structureis spatial data with global coverage There is a large numberof R packages to import and manipulate spatial data whichfacilitates the technical aspects for running SOILR functionsat the global scale

As an example we show here a simple calculation of cli-mate decomposition indexes (CDIs) (Adair et al 2008) us-ing a global dataset of temperature precipitation and po-tential evapotranspiration available at 05 degree resolutionon NetCDF files from the WATCH dataset (Weedon et al2011) The input dataset contained monthly average tempera-ture precipitation and evapotranspiration for the period 1958to 2001 We calculated the CDIs as

CDI = ξ(t) = f (T )f (W) (26)

with f (T ) implemented by the functionfTCentury1 andf (W) by the functionfWCentury as described in Ta-ble 1 Results can be easily plotted on a map (Fig5) andexported again to NetCDF files Different combinations ofthe functions described in Table1 can be used to calculateCDIs (Adair et al 2008) and evaluate different hypothesesabout the response of decomposition rates to moisture tem-perature and other variables

Longitude

Latit

ude

02

04

06

08

Fig 5 Climate decomposition index (CDI) calculated as the prod-uct of a function of temperature (fTCentury1 ) and a function ofprecipitation and potential evapotranspiration (fWCentury ) us-ing monthly data from the WATCH dataset (Weedon et al 2011)

5 Discussion

Many models of soil organic matter decomposition have beenproposed previously and there even exist some open-sourcetools to implement some of these models (egEaster et al2007) We have developed a tool for implementing and run-ning a large variety of these models with the idea of facili-tating comparison among multiple models in an easy to useinterface In this section we discuss some of the advantagesand disadvantages of our approach

51 Parameter space and structural domain

Models of organic matter decomposition are basically hypo-thetical abstractions about the structure and dynamics of soilorganic matter The multitude of models previously devel-oped suggests that there exists a large number of hypothesesabout the structure and functioning of soil organic matterbut there is basically little consensus on whether one modelstructure (hypothesis) would have more support on observa-tions than other model structures (Manzoni and Porporato2009)

The majority of modeling studies have focused on findingthe set of parameter values of a particular model that bestfit some observed data This approach is useful and has pro-vided much insight on understanding the rates of soil organicmatter decomposition However from the perspective of as-sessing different hypotheses about the structure and dynam-ics of soil organic matter parameter estimation can only givea narrow view of the more complex spectrum resulting from

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1056 C A Sierra et al SOIL R v 10

the combination of structure domain and the parameter spaceof models

SOILR provides the possibility of assessing both modelstructure and parameter values broadening the spectrum ofideas that can be assessed within one single analytical frame-work

We believe this approach complements well and could beeven more powerful than previous approaches to assess per-formance of model structure with inter-comparisons amongdifferent modeling groups (egMelillo et al 1995 Wu andMcGechan 1998 Cramer et al 2001 Randerson et al2009) Multi-model inter-comparison projects do not neces-sarily cover the whole domain of model structures and maybe subject to important issues such as independence of codebias of the whole model ensemble inappropriate metrics todefine model performance etc (Knutti et al 2009 Knutti2010) SOILR can partially help to overcome some of theseproblems for assessing the performance of model structurethrough the option of using alternative functions to representthe same process Philosophically this approach is also sim-ilar to testing multiple working hypotheses

52 Model hierarchies and functional programing

The gap between simulations and understanding describedby Held (2005) is currently exacerbated by the continuousincrease in detail and complexity of simulation modelsHeld(2005) suggests that a way forward to close the gap be-tween simulations and understanding is by the developmentof model hierarchies in which large-scale complex modelsare particular cases of general models that are more amenablefor understanding of system structure and behavior

SOILR can also be viewed as a system for hierarchicalmodeling of soil processes Consider for example the envi-ronmental or external effects on decomposition rates whichhere are denoted by the termξ(t) In its more simple andgeneral case the external effects can be simply a constant(ξ(t) = c) that allows the understanding of model behaviorwithout changes in environmental conditions Simulationscan then be run with a changing environment for exam-ple with variable soil moisture (ξ(t) = f (W(t))) Soil mois-ture could depend on other variables such as precipitationand potential evapotranspiration (W(t) = f (P (t)PET(t)))which in turn can be dependent on other functions In thisform a hierarchy of models is build with the dependence ofdifferent functions on other functions

In terms of programing this concept of model hierarchiescan be easily implemented in a functional programing styleA function that performs certain tasks can have as its argu-ments other functions that perform other tasks These func-tions can be independent among each other so many differentfunctions that perform the same task can be available withinthe same modeling environment This is one of our goals withSOILR to provide a modeling environment that serves as arepository of different functions that can perform the same

task so their performance can be easily compared It also al-lows building soil organic matter decomposition models ina hierarchical framework because functions can have a largenumber of dependences on other functions creating a bridgebetween simple general models and detailed modeling con-structions under the same basic principles

53 Scope and limitations

Our approach to soil organic matter decomposition modelingwith SOILR may have some limitations One potential limi-tation is the use of a high-level programing language that canhave issues in terms of computational efficiency This couldbe an important problem if specific models structures witha large number of computations per time step are applied toa large number of points such as a large spatial grid Otherprograming languages such asC or Fortran may be moresuitable for these tasks although a good programing stylecan avoid many issues of computational efficiency inR It isimportant to keep in mind that the scope of SOILR is morefor the exploration of different model structures and hypothe-ses about soil processes rather than for large computationaltasks however some parallelization tools withinR could beused for this purpose We recommend that once a specificmodel structure is identified as useful for a large computa-tion the entire model object is translated to other languageor optimized for running inR We are exploring these possi-bilities to include in future releases of SOILR

Another potential limitation is the incompatibility of ourconceptual framework to represent the decomposition pro-cess as a non-linear dynamical system Non-linear dynamicsare important for representing microbial processes such aspriming and are very relevant for simulations at short timescales (Wutzler and Reichstein 2008 Manzoni and Porpo-rato 2007 2009) Non-linear models however can be eas-ily implemented inR with the deSolve package We areconsidering two possibilities to include non-linear dynamicalsystems within our theoretical framework One possibility isto provide a framework to specify and linearize non-linearsystems and solve the linear equations as presented here An-other possibility is to include a set of non-linear models solv-ing them directly withdeSolve We aim for further releasesto include this additional functionality

6 Conclusions

We have developed a modeling environment for represent-ing the process of soil organic matter decomposition Thistool SOILR is an open- source package for the implemen-tation and testing of different representations of the processof soil organic matter decomposition The main character-istic of SOILR is its hierarchical structure in which we de-scribe a general model that can accommodate any possiblemodel structure of a multi-pool model of decomposition

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1057

More detailed models can be implemented to simulate spe-cific controls on the decomposition process This allows fortesting of multiple working hypotheses about the structureand functioning of soils and their behavior over time SOILRnot only allows for exploring dynamics on the parameterspace of a model but also on the structural domain

This first version of SOILR allows simulations of organicmatter decomposition and future versions will include rep-resentations of other biogeochemical elements such as nitro-gen and phosphorus as well as their isotopic composition Amodule for parameter fitting will also be included in futurereleases

Appendix A

Implementation details and design decisions regardingSOIL R

A1 The choice of the object-oriented programing(OOP) system

While in object oriented languages the implementation of ob-ject oriented design principles is usually hardwired inR itis a choice between at least three different approaches thusforcing the user to explain why a particular system was usedIn our case the choice ofS4 is a compromise On one handthere is very limited support inS4 for real encapsulation ex-pressed most notably by the possibility to read and even writethe values of slots from outside the class by theslot func-tion or theoperator respectively This default behavior isactually not even trivially changed On the other hand thereare some important advantages

1 Compatibility with the functional paradigm ofR and itsassociated benefits such as lazy evaluation concurrencyand in the future maybe even automatic parallelizationwhich depends on the absence of side effects (unavoid-able with a reference based system likeR5)

2 The integration withRrsquos standard library which in-creases

a the probability of future maintenance and

b acceptance by otherR users

3 The relative seamless integration to commonR work-flows without in depth knowledge of object orientedprograming

Considering that ifR is capable to implement an OOPsystem by means of on board tools it will probably be flexibleenough to change the default behavior of this OOP systemwith on board tools as well SOILR is a rather small packageand we thinkS4 is and appropriate choice for our needs

A2 Comparison betweenSIMECOL and SOIL R

SIMECOL (Petzoldt and Rinke 2007) an R package for theimplementation of ecological models is an alternative to ourown implementation Here we compare the two approachesin terms of their design

A21 Scope

SOILR is focused solely on soil organic matter decompo-sition while SIMECOL aims to be a general framework forecological modeling inR SIMECOL represents an abstrac-tion level somewhere between SOILR andRrsquos S4 systemHence the obvious way for SOILR to make use ofSIMECOL

would be to implement ourModel class as a subclass ofSIMECOL rsquos simObj One motivation to do so consists in thepossibility to inherit functionality from the ancestor which isusually additionally shared by other subclasses thus enablingeasier communication between them Whether subclassing isthe appropriate strategy thus depends on the amount of in-heritable code and the number of subclasses We found thatwithin SOILR Model would be the only one subclass ofSIMECOLrsquos model with nearly no code shared owing to dif-ferences in functionality and design goals (see below)

A22 Functionality

One major difference withSIMECOLrsquos simObj is thatSOILRrsquos Model initialize method requires objects of classTimeMap or its subclasses thus guaranteeing that the dif-ferent objects conforming a model share a common supportin the time domain even if the creation ofTimeMap ob-jects usually takes place far away from the initialization of aModel object since this usually happens behind the sceneseg by conversion ofdataframes the user provides asinput This is a significant difference fromSIMECOLrsquos ap-proach Implementing this functionality in a subclass ofSIMECOLrsquos model would be misleading and would not con-form well with our design goals

A23 Design goals

The main aim of SOILRrsquos Model class is to provide a fencebetween interface and implementation While the interfaceshould change as little as possible to protect code using theclass we want to have as much freedom as possible to changeits implementation We strive to achieve this by avoiding ev-ery possible syntactic distinction between references to ob-ject data and object methods from the outside WithRrsquos S4system one (and maybe the only) way to do so is to wrapall access to object data with get and set methods This isone aspect of a concept often referred to asencapsulationand regarded as one of the key components of OOP In lan-guages such asSmalltalk (Kay 1993) or Ruby (Matsumotoand Ishituka 2002) fully dedicated to OOP this approach ismandatory A method call (a message send to an object) is

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1058 C A Sierra et al SOIL R v 10

the one and only way for objects to communicate with eachother

The S4 approach inR is much less strict and allowsdirect manipulation of the data belonging to an object bymeans of the operator(or the slot function respectively)thus revealing the implementation of an object to the out-side code using this object User code based onwill breakif the implementation changes and the desired slot disap-pears while a get method may be able to retrieve the de-sired information from other data The use of the slot op-erator from outside should therefore be avoided (Genolini2008 Gentleman 2003) Imagine for instance acircle ob-ject c thatstoresits radius andcomputesthe diameter whengetDiameter(c) is called If the radius is accessed solelyby calls ofgetRadius(c) the implementation of the circleclass can later be changed to store the diameter and computethe radiuswithoutany affect to outside code using the class

Applications to SOILRrsquosModel occur if one considers theincreasing number of constructors with redundant parametersets The distinction between parameters and derived vari-ables may even become difficult Differing fromSIMECOL

we unify access toModel elements and avoid a syntacticdifference of parameters and derived values as expressed bySIMECOLrsquos functionsparams andout In addition to theget functions we provide for all data intended to be ac-cessed from outside access through the typical operators[]and$ for our Model class This gives access to all data themodel can provide either during the initialization or com-puted by the methods of the class In fact[] and $ inter-nally use theget methods and may perform any numberof checks and computations to provide a consistent outputThis facility is powerful enough to avoid the use ofcom-pletely for our class This is exactly our intention since theimplementation of the class may change accessing its ele-ments viais strongly discouraged While we will maintainthe defined interface via[] $ and theget functionswe cannot guarantee that code relying onwill work in fu-ture versions of SOILR

Another difference withSIMECOL is also related to the[]operator It enables the user to create the desired output ondemand thus avoiding duplication between output objectsIf the user asks forC shehe getsC and nottimeandC which sometimes may not be intended if the user isconcerned about issues of memory or duplication Howeverit may be very useful to have both in other situations whenthe times argument to the constructor that created themodel in the first place is not available anymore With[]the user can decide which fields the output should contain

An additional intended feature of our[] operator is to al-ways producedataframes and not aResult objectthat would (or at least should) be more protective of its dataagainst alterations post simulation than adataframe Ifwe provided code to post-process results we would certainlyimplement such aResult class to make sure that ourpost-processing is based on valid data Since at the moment

we donrsquot we also do not force a structured output object tothe user

At the moment we do not even provide output asdeSolve objects since every structured output is part of theinterface and may be relied on by user code Although weare happy and thankful to usedeSolve extensively withinSOILR making it a part of the interface would be a promiseto the user that we will keep on supporting it which is a muchbigger commitment

Until now the responsibility beyond the scope of classModel stays with the user

Supplementary material related to this article isavailable online athttpwwwgeosci-model-devnet510452012gmd-5-1045-2012-supplementzip

AcknowledgementsFinancial support for the development of thisproject was provided by the Max Planck Society We would like tothank Ulrich Weber and Martin Jung for providing global climatedata used in the example Maarten Braakhekke provided helpfulcomments on a previous version of this manuscript

The service charges for this open access publicationhave been covered by the Max Planck Society

Edited by S Arndt

References

Adair E Parton W Del Grosso S Silver W Harmon MHall S Burke I and Hart S Simple three-pool modelaccurately describes patterns of long-term litter decomposi-tion in diverse climates Glob Change Biol 14 2636ndash2660doi101111j1365-2486200801674x 2008

Agren G and Bosatta E Theoretical ecosystem ecology under-standing element cycles Cambridge University Press 1998

Andren O and Katterer T ICBM The Introductory Carbon Bal-ance Model for Exploration of Soil Carbon Balances EcolAppl 7 1226ndash1236httpwwwjstororgstable2641210 1997

Bolker B M Pacala S W and Parton W J Linearanalysis of soil decomposition insights from the CEN-TURY model Ecol Appl 8 425ndash439doi1018901051-0761(1998)008[0425LAOSDI]20CO2 1998

Bruun S Six J Jensen L and Paustian K Estimating turnoverof soil organic carbon fractions based on radiocarbon measure-ments Radiocarbon 47 99ndash113 2008

Burger M Juenemann K and Koenig T RUnit R Unit testframework R package version 04 25 2009

Burke I Kaye J Bird S Hall S McCulley R and Som-merville G Evaluating and testing models of terrestrial biogeo-chemistry the role of temperature in controlling decompositionModels in ecosystem science Princeton University Press Prince-ton New Jersey USA 225ndash253 2003

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

1046 C A Sierra et al SOIL R v 10

structures that have been used frequently with certain degreeof success to represent observed data

RecentlyHeld (2005) has called to attention a growinggap between high-end simulations and theoretical under-standing in climate modeling which we believe also appliesto Earth system modeling in general Current models arehighly complex and use sophisticated algorithms to repre-sent different processes within the Earth system However itis difficult to obtain a basic understanding of system behav-ior from these models due to their complexity Furthermorethese models include only one single set of functions to rep-resent a specific process which is equivalent to proposingone single hypothesis to explain system structure and func-tion ThereforeHeld (2005) proposed the development ofhierarchical models in which detailed models can be reducedin hierarchies that help to better understand system dynam-ics On the one hand the general model has a high level ofabstraction and helps to elucidate basic properties of the sys-tem On the other hand detailed models are specific realiza-tions of the general models that can help to predict systembehavior under specific conditions such as climate changeor emission scenarios

In this document we introduce SOILR a modeling frame-work to represent the process of soil organic matter decom-position in terrestrial ecosystems It was developed underthe idea of hierarchical models that synthesize different ap-proaches to represent the decomposition process The currentversion is built under the mathematical formalism of lineardynamical systems to represent in a very general form soilorganic matter as a state variable with time dependent inputsoutputs and internal transformations

A dynamical system in a broad sense is a system thatevolves in time through the iterated application of an under-lying dynamical rule (Jost 2005) To describe the evolutionof a dynamical system over time it is necessary to representthe actual state of the system and a mathematical rule thatdictates the change of state There are many different waysto represent both the state of the soil system and its transitionrules SOILR provides the basic framework to accommodatedifferent representations of state or system structure and itsdynamics This is accomplished by a library of different nu-merical functions that can represent many different possibil-ities of soil organic matter dynamics

This document presents the main structural characteristicsof SOILR and the quantitative tools that can be used to rep-resent different soil biogeochemical processes The first ver-sion of this tool is focused on organic matter decompositionand other versions of the package will include nutrient dy-namics and isotopic composition

11 General information about SOIL R and R

The modeling framework we describe in this document isimplemented in theR environment for computing (R Devel-opment Core Team 2011) However numerical ecosystem

models are frequently developed in low-level programinglanguages such asC or Fortran There are many advantagesof using these low-level languages specially in terms of com-putational efficiency however they are difficult to learn forscientists not formally trained in programing At a differentside of the spectrum of programing languages is theR en-vironment a high-level language in which ease of use maycompromise efficiency For many applications in ecosystemmodeling the nature and size of the problems are usually notlarge enough for this to be an important issue Ease of usehowever has been a major constraint for a wide adoption ofmodels in ecosystem science

Another important issue for model development is acces-sibility Models coded in licensed software impose limita-tions in accessibility and future developments of new toolsand models Open-source software is ideal for guaranteeingthat code can be freely distributed used and modified by ev-eryone

SOILR was developed in theR environment for comput-ing to provide simple access of soil organic matter decom-position models in an open-source platform where the codeis freely accessible To see source code and examples of thefunctions implemented in SOILR the user only needs to typethe name of the function in theR command shell To ob-tain more detailed documentation the user can simply type aquestion mark () followed by a function name

R allows the integration of concepts from functional andobject oriented programing and can interface with manyother low-level programing languages (Chambers 2008) Ralso allows the development of software using concepts ofliterate programing(Knuth 1984) allowing the productionof code and documentation within the same environmentModels and data analyzes inR are therefore easily repro-ducible

As an open-source tool SOILR is also open for contri-butions by users interested in improving the existing codemake corrections on bugs in the code add new functionsimprove efficiency and functionality etc

2 Theoretical framework

21 Brief history of SOM modeling

Although early models of soil organic matter decompositionemployed geometric series or difference equations (egNiki-foroff 1936 Jenny et al 1949) the predominant mathemat-ical formalism since the 1940s is that of ordinary differentialequations (Manzoni and Porporato 2009) Representing de-composition of chemical substances by differential equationswas introduced much earlier than that (Vanrsquot Hoff 1884)However within the ecological disciplinesOlson (1963)presented the first comprehensive treatment of mathemati-cal models of organic matter decomposition popularizing themodel

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1047

dX

dt= L minus kX (1)

whereX is either oven-dry weight organic carbon or energyin organic matterL is the income of organic matter andk adecay constant

Equation (1) treats soil organic matter as one single com-partment with an overall decomposition rate representative ofall substances within the soil matrix It has been commonlynoted that soil organic matter is heterogeneous and the singleexponential model of decomposition fails to account for thisheterogeneity (Minderman 1968 Swift et al 1979) EarlierHenin et al(1959) proposed a model to account for the dif-ferent rates of decomposition of labile and stable materialalso considering the process of humification ie the transferof material from the labile to the stable pool This model canbe expressed as

dX1

dt= L minus k1X1

dX2

dt= αk1X1 minus k2X2 (2)

whereX1 represents the labile pool andX2 the stable poolThe parameterα represents the humification or transfer rateA different version of a two-pool model has been widely usedfor studies of litter decomposition in which the system ofequations takes the form (Minderman 1968 Means et al1985)

dX1

dt= γL minus k1X1

dX2

dt= (1minus γ )L minus k2X2 (3)

In this case the two pools decompose independently fromone another and the amount of litter inputsL is partitionedbetween the pools according to the parameterγ

Different variations of these models can be found in theliterature with different number of pools and transfer amongcompartments

Two numerical compartment models have become stan-dard in representing organic matter decomposition these arethe RothC (Jenkinson and Rayner 1977 Jenkinson et al1990) and the Century (Parton et al 1987) models Thesetwo models have been used successfully to represent soil car-bon dynamics at different spatial and temporal scales (Pauland Clark 1996 Paustian et al 1997) Although these mod-els were developed on the grounds of pragmatism ratherthan based on strict mathematical formalisms (Bolker et al1998) they can be easily translated into systems of differ-ential equations with the general model (Bolker et al 1998Paustian et al 1997)

dX1

dt=f1(θ1k1X1 middot middot middot θmkmXm)

dXm

dt=fm(θ1k1X1 middot middot middot θmkmXm) (4)

whereθ is a parameter set modifying the decomposition ratek andm the total number of compartments representing thesystem

In general the number of compartments in this type ofmodels is less than 10 (Manzoni and Porporato 2009) andthe decomposition rate constant may be a function of tem-perature moisture andor other edaphic conditions

We make use of this mathematical abstraction (Eq4) topropose a general model of soil organic matter decomposi-tion

22 A general model of soil organic matterdecomposition

Models of soil organic matter decomposition are in theirlarge majority specific cases of linear dynamical systems(Bolker et al 1998 Manzoni and Porporato 2009 Luo andWeng 2011) Making use of this property we propose amodel that generalizes the majority of all previously pro-posed compartment models This general model is given by

dC(t)

dt= I (t) + A(t)C(t) (5)

whereC(t) is a m times 1 vector of carbon stores inm poolsat a given timet A(t) is am times m square matrix containingtime-dependent decomposition rates for each pool and trans-fer coefficients between pools andI (t) is a time-dependentcolumn vector describing the amount of inputs to each poolm

The matrixA(t) is particularly important because it de-fines both the model structure and the extrinsic effects ondecomposition and transfer rates For this reason we rewriteEq (5) as

dC(t)

dt= I (t) + ξ(t)A C(t) (6)

whereξ(t) is a time-dependent scalar containing the extrin-sic or environmental effects on decomposition rates Noticethat the matrixA contains now constant coefficients definingmodel structure

From this general Eq (6) it is possible to derive a largevariety of structures for compartment models

23 The matrix A and model structure

Organic matter decomposition can be represented with alarge variety of model structures and levels of connectivity

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1048 C A Sierra et al SOIL R v 10

among compartments (Swift et al 1979 Bruun et al 2008Manzoni and Porporato 2009) Different model structuresare determined by the matrixA in linear dynamical systems(Bolker et al 1998 Manzoni et al 2009) For instance theparallel or pure decay structure (Fig1) in compartment mod-els is defined by a diagonal matrix of the form

A =

minusk1 0 middot middot middot 0

0 minusk2 middot middot middot 0

0 0 middot middot middot minuskm

where the entries in the diagonal represent the decompositionratekj for each compartmentj A required condition is thatall kj ge 0

Compartments connected in series (Fig1) can be repre-sented with a matrix of the form

A =

minusk1 0 0 middot middot middot 0a21 minusk2 0 middot middot middot 00 a32 minusk3 middot middot middot 0

0 0 0 middot middot middot minuskm

where the entriesaij are the transfer coefficients of materialfrom poolj to pooli A required condition is that allaij ge 0

Similarly feedback between adjacent compartments(Fig 1) is defined by a matrix of the form

A =

minusk1 a12 0 0 middot middot middot 0a21 minusk2 a23 0 middot middot middot 00 a32 minusk3 a34 middot middot middot 00 0 a43 minusk4 middot middot middot 0

0 0 0 0 middot middot middot minuskm

(7)

More complex model structures are created by replacingzero entries in the matrixA representing transfers betweendifferent compartmentsi andj

An important characteristic of the entriesaij is that theyare proportional to the decomposition rate ieaij = αijki whereαij represents the proportion of the decompositionrate that is transferred to pooli from pool j Furthermore0 le αij le 1 and the column sum

sumi αij le 1 with

rj = 1minus

sumi

αij (8)

representing the proportion of the decomposed material thatgets released from the system from poolj

24 The environmental termξ(t)

The majority of organic matter decomposition models in-clude functionsf (x) that modify decomposition rates ac-cording to a set of time-varying environmental conditions

No Pools 1 2 3

Parallel

Series

Feedback

Fig 1Basic model structures implemented in SOILR Squares rep-resent the compartments and arrows represent inputs and outputsto and from the compartments These model structures are specialcases of the matrixA

x1(t) xn(t) such as temperature moisture evapotranspi-ration etc (Burke et al 2003 Adair et al 2008) In ourmodel (Eq6) the representation of these environmental ef-fects is done with the termξ(t) which is the result of theevaluation of the function or set of functionsf (xi(t)) yield-ing a scalar value that can be directly multiplied to the matrixA In this case

ξ(t) = f (x1(t) xn(t)) (9)

The values off (xi(t)) are determined by different func-tions that depend on temperature precipitation and other en-vironmental variables Time-dependence is therefore intro-duced with time series of these environmental variables asinput in the model SOILR contains a library of functionsthat calculate environmental effects on decomposition ratesbased on functions reported for different models (Table1)

More complex functions are also introduced in SOILR butare not included in Table1 due to space limitations The doc-umentation and help files of SOILR contain a more detaileddescription of all functions

25 Initial conditions

The linear dynamical system represented by Eq (6) hasmany different solutions but we are only interested in thesolution that satisfies

C(t = 0) = C0 (10)

whereC0 is amtimes1 vector with the value of carbon content inthe different compartmentsi C0 must be specified in SOILRto run any possible model structure

26 The vector of inputs

Inputs to the system from above and belowground compo-nents are represented by the vectorI (t) This vector can also

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1049

Table 1 Functions implemented in SOILR to represent the effects of temperatureT and moistureW on decomposition rates

f (x) Terms Function name Source

f (T ) =

Q(T minus10)1010 T mean temperature fTQ10

4791+exp( 106

T +183 )T monthly temperature (C) fTRothC Jenkinson et al(1990)(

TmaxminusTTmaxminusTopt

)02exp

(02263

(1minus

(TmaxminusT

TmaxminusTopt

)263))

T Tmax Toptmonthly average maximumand optimal temperature

fTCentury1 Burke et al(2003)

3439exp

(02263

(1minus

(TmaxminusT

TmaxminusTopt

)263)(

TmaxminusTTmaxminusTopt

)02)

T Tmax Toptmonthly average maximumand optimal temperature

fTCentury2 Adair et al(2008)

08exp(0095Ts) Ts Soil temperature fTDaycent1 Kelly et al (2000)

056+ (146arctan(π00309(Ts minus 157)))π Ts Soil temperature fTDaycent2 Parton et al (2001) Grossoet al(2005)

0198+ 0036T T monthly temperature fTlinear Adair et al(2008)

exp(30856

(1

5602 minus1

(T +273)minus22713

))T monthly temperature fTLandT Lloyd and Taylor(1994)

exp(minus3764+ 0204T (1minus 05T369)) T mean temperature fTKB Kirschbaum(1995)

exp((ln(Q10)10)(T minus 20)) T mean temperatureQ10temperature coefficient

fTDemeter Foley(2011)

exp(minus(T (Topt+ Tlag))Tshape)Q

(T minus10)1010 T Tmax Topt

monthly averagemaximum and optimaltemperature

fTStandcarb Harmon and Domingo(2001)

f (W) =

11+30exp(minus85W)

W = PPETP monthly precipitation PETmonthly potentialevapotranspiration

fWCentury Parton et al(2001) Adair et al(2008)

(Wminusbaminusb

)d((bminusa)(aminusc)) (Wminuscaminusc

)dW water filled pore spacea b c dempirical coefficients

fWDaycent1 Kelly et al (2000)

5(0287) + (arctan(π0009(RWC minus 1747))π) W volumetric water content fWDaycent2 Grosso et al(2005)

025+ 075(MMsat) M soil moistureMsatsaturated soil mositure

fWDemeter Foley(2011)

(1minus exp(minus(3Mmin)(M + a)))b exp(minus(M(Mmax+ c))d ) M Mmin Mmax average minimumand maximum moisturecontent in litter poolabcd empirical coefficients

fWStandcarb Harmon and Domingo(2001)

be expressed as

I (t) = I (t)

γ1

γi

γm

(11)

whereI (t) is a time-dependent scalar representing the totalamount of inputs and the coefficientsγi represent the par-titioning among the different pools In this representation0 le γi le 1 and

summi=1γi = 1

27 Carbon release

A variable of interest in modeling soil organic matter decom-position is the amount of carbon leaving the system over time

either in the form of CO2 gas or as dissolved organic carbonWe represent this flux with the general termr which is givenby

r = RC(t) (12)

wherer is amtimes1 vector containing the instantaneous releaseof carbon for all pools andR is amtimesm diagonal matrix withthe release coefficientsrj in its diagonal calculated from (8)

28 Analytical solution

Analytical solutions to Eq (5) are implemented in SOILRonly with the purpose of testing the performance of the nu-merical methods However we can only test cases under cer-tain simplifications of the general model of Eq (5) In partic-ular for a homogeneous system with constant coefficientswhich is analogous to the decomposition of a single cohort

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1050 C A Sierra et al SOIL R v 10

of organic matter (Agren and Bosatta 1998) Eq (5) simpli-fies to

dC(t)

dt= AC(t) (13)

With initial conditions as in Eq (10) the analytical solu-tion to this problem is given by

C(t) = eA(tminust0)C0 (14)

If I (t) is not identically zero then the solution of the linearsystem

dC(t)

dt= I (t) + AC(t)

with initial conditions as in Eq (10) is given by

C(t) = eA(tminust0)C0 +

tintt0

eA(tminusτ)I (τ )dτ (15)

3 Numerical implementation

The solution to the dynamical system described by Eq (6) isdiscretized over time withh denoting the time step andn thenumber of steps The time steph may or may not be constantInitial conditions are given at timet0 = 0 The solution to thesystem is then given by

Cn+1 = Cn + Dr [fprime(Cn)h] (16)

whereDr [fprime(Cn)h] is anr order finite difference approxi-

mation to the system of ODEs of Eq (6) for each time steph(LeVeque 2007) in other words an ODE solver

The choice for the ODE solver is flexible in SOILR Cur-rently we provide the option to use a simple Euler forwardmethod or an interface to thedeSolve package ofSoetaertet al (2010) The functiondeSolvelsodawrapperin SOILR is a wrapper to the functionlsoda in packagedeSolve

31 TheModel class

The general numerical model described by Eq (6) is rep-resented in SOILR by an object oriented design centeringaround the classModel Nearly all computations possible inSOILR are facilitated byModel itself or its building blocksThe class defines the information allModel objects containand how those objects behave when (generic) functions areapplied to them (Chambers 2008) Any model constructedwith SOILR provides then a stable and consistent interfacethat encapsulates details about its implementation This in-terface provide a number of advantages to the user

1 A level of abstraction close to the mathematical descrip-tion of the model being implemented focusing on thescientific content rather than on technical details

2 Stability of code generated by the user based on SOILRoutput We believe that the more essential and less re-dundant the interface the less likely it is to change infuture revisions

3 Safeguards against unreasonable (and therefore prob-ably unintentional) input from simple dimensionalchecks to mathematical consistency of all arguments ofthe general model described in Sects22through27

4 Smaller programs that are easier to read

Developers also benefit from this implementation design by

1 Freedom to change the implementation behind thescenes without breaking user code

2 Easier maintenance testing bug tracking and exceptionhandling by reduced duplication

Objects of classModel are initialized in SOILR by vari-ous functions which are listed with the commandModel Most of them provide shortcuts for the construction of stan-dard models such as those in Fig1 These functions usuallydo not require the user to consider the real building blocks ofaModel object but rather infer the needed information fromobjects more common inR such as data frames Howeverall these high-level functions callGeneralModel which isthe most general constructor The functionGeneralModelinitializes theModel object after applying various validitychecks but does not run the model itself which instead isdone by specific functions (methods) applied to objects ofclassModel

The functionGeneralModel takes five arguments rep-resenting a specific case of Eq (6)

1 A vector t which contains the time values where thesolution to the ODE system is sought It can be of anylength but must be of classnumeric

2 An object of classTimeMap which implements thematrix A of Eq (5) as a function of time (including itsdomain) thus allowing the same level of abstraction asthe most general ODE solvers (Soetaert et al 2010)The classTimeMap is native to SOILR and simply ex-tends a commonR function to a mathematical validfunction definition that includes the time domain wherethe function is defined Thus it contains the necessaryinformation to prevent extrapolations beyond the rangeof input data Details aboutTimeMap are discussed inAppendixA

3 A vector of classnumeric containing the initialvaluesC0 of the ODE system

4 Again an object of classTimeMap containing theinputs I (t) to the system as a vector valued functionof time The length of this vector must be equal to thedimension of the matrixA and is checked as well as thetime domain

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1051

5 A string choosing the solver to be used

Once a new object of classModel is intialized from a callto GeneralModel or one of its various wrappers the newobject can be queried by several generic functions For ex-ample to obtain the amount of carbon over time solving thesystem of ODEs any object of classModel (and thereforeall its subclasses) can be used as argument of the functiongetC The call to this function returns an times m matrix withthe amount of carbon for each poolm at each time stepnSimilarly to obtain the amount of carbon release over timethe functiongetReleaseFlux can be called with any ob-ject of classModel as argument The result will be an times m

matrix with the amount of released carbon for each poolm

at each time stepn It is also possible to use the typical op-erators[ ] and $ for our Model class given access tomethods even easier For examplegetC(mod) is equiva-lent tomod$Cand something like

df=asdataframe(cbind(getTime(mod)getC(mod)))

can also be expressed as

df=mod[c(time C)]

This avoids the necessity of the somewhat dangerous use ofthe operator in user code which we strongly discouragesince it attaches the code to implementational details thatmay change in the future

The implementation of specific models as subclasses ofModel with methods for the generic functions will allow theintegration of new functionality without major modificationsto our current implementation For example once nutrientcycling and isotope dynamics are incorporated into SOILRnew methods will be developed independently without majormodifications to the current implementation of carbon stocksand release

The vignette GeneralModel provided with SOILRpresents some further insight in the implementation of spe-cific model structures with the help of the general tool-setprovided by theModel class The examples therein mayalso serve as templates to implement new model structuresas desired by the user Examples on how to use these modelstructures as a function are presented in Sect4

32 Version control system unit testing and automaticdocumentation

The development of SOILR is aided by a significant amountof existing open- source software To solve the ordinary dif-ferential equations produced by our framework we rely onthe well tested and documenteddeSolve package devel-oped bySoetaert et al(2010) We also use the open-sourcesymbolic python library SymPy (SymPy Development Team2008) to compute analytical solutions for the models forwhich this is possible The analytical solutions obtained from

SymPy are used to automatically create unit tests for SOILRTo constantly run these tests we use another open-sourcesoftware theRunit package (Burger et al 2009) The testsare distributed with the release version of SOILR and thusadd to the transparency of its development In addition weuseSweave (Leisch 2002 2003) and theinlinedocspackage (Hocking et al 2012) to produce documentationand encourage a literate programing style (Knuth 1984)As a version control system we use Mercurial (OrsquoSullivan2009) and the Trac (Edgewall Software 2011) online projectmanagement tool which includes ticket system wiki andonline access to our source code

33 Documentation

There are different types of documentation for SOILR Thefirst source of information is this document which intro-duces the science and some general technical details Asecond source of information is the documentation to eachfunction provided within the package itself To view thisdocumentation the user only needs to openR and typehelpstart() This will open a help window on a web-browser There the user only needs to go to PackagesSoilR toview a list of all the functions implemented Clicking on eachfunction will show details about the arguments of each func-tion and examples on how to use them For specific functionsthe user can also just type the name of the function precededby the question mark on theR command shell For exampletyping TwopParallelModel in the R command shellwill open a help window with the description of the functionTo view the source code of the function the user only needsto type the name of the function (without the question mark)on theR command shell

A third source of information are the so called Package Vi-gnettes These are short documents illustrating the use of thepackage for specific purposes Currently we provide one vi-gnette with version 10 of SOILR This vignette illustratesthe implementation of any model structure within SOILRFor future versions we will provide vigenettes about fittingspecific model structures to data and how to use SOILR formodeling radiocarbon

34 Installing and loading SOIL R

SOILR can be obtained from the ComprehensiveR ArchiveNetwork (CRAN) the official repository forR packageswith mirrors in places all over the world Packages storedin CRAN can be downloaded directly from anR ses-sion It can also be obtained from R-Forge a repositoryfor package developers To install SOILR from CRANthe user simply needs to type in theR command shellinstallpackages(SoilR) To install from R-Forge the statement isinstallpackages(SoilRrepos=httpR-ForgeR-projectorg) After installing the package simply type

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1052 C A Sierra et al SOIL R v 10

library(SoilR) and the package is loaded intoyourR session

4 Examples

In this section we present examples on how to runsome of the functions implemented in SOILR basedon the theoretical framework presented previously Ad-ditional details about the implementations of each func-tion and instructions on how to implement new modelstructures are presented in the vignette lsquoImplementingCompartment Models in SOILR the GeneralModelFunctionrsquo provided with the package To view thisvignette simply typevignette(GeneralModelpackage=SoilR) in theR command shell

41 Implementation of a two pool model withconnection in series the ICBM model

One of the first models ever proposed to represent soil or-ganic matter dynamics was a two-pool model with connec-tion in series (cf Eq2 Henin et al 1959) More than50 yr laterAndren and Katterer(1997) proposed the ICBMmodel which is practically the same model proposed earlierby Henin et al(1959) but including a term for temperatureand moisture dependence of decomposition rates The set ofdifferential equations of the ICBM model are given by

dC1

dt= I minus k1ξC1

dC2

dt= αk1ξC1 minus k2ξC2 (17)

whereα is a humification or transfer coefficient andξ a pa-rameter representing external effects on decomposition ratesIn the ICBM modelC1 represents a ldquoyoungrdquo pool andC2 anldquooldrdquo pool This set of equations can be rewritten using ourmodel formulation which gives

dC

dt= I

(10

)+ ξ

(minusk1 0αk1 minusk2

)(C1C2

) (18)

with initial conditions(C10C20)T and where

A =

(minusk1 0a21 minusk2

)

with a21 = αk1 γ = 1 andξ(t) = ξ The function ICBMModel in SOILR implements this

model structure requiring as its arguments (1) a vector ofany length with the points in time when we are interested infinding a solution (2) a column vector of decomposition rates(k1k2)

T (3) the value ofα (4) the value ofξ (5) a columnvector with the initial amount of carbon at the beginning ofsimulation(C10C20)

T and (6) the mean annual carbon in-put to the soilI Andren and Katterer(1997) provided values

for these arguments from a 35-yr field experiment manipu-lating carbon and nitrogen inputs to an agricultural soil inSweden For the case of a treatment in which the soil wasleft as bare fallow without N or C inputs the ICBM modelcan be parameterized as

dC

dt= 0

(10

)+ 132

(minus08 0

013times 08 minus000605

)(C1C2

) (19)

with initial conditions(03396)T Assuming SOILR is already installed it is only necessary

to write the following lines of code to run the ICBM model

library(SoilR)times=seq(020by=01)Bare=ICBMModel(t=times ks=c(k1=08

k2=000605) h=013 r=132c0=c(C10=03C20=396) In=0)

The call toICBMModel simply initialize the model andchecks for consistency on its arguments In this example thedecomposition rates are given in units of yearminus1 and the ini-tial amounts of carbon in units of kg C mminus2

To obtain the amount of carbon over time it is necessary toinvoke the functiongetC storing the output into an objectFor example to store the amount of carbon from the objectBare the user can type

CtBare=getC(Bare)

This new objectCtBare is a matrix with 2 columns(2 pools) and 201 rows (201 points in time from 0 to 20in increments of 01) To obtain the total amount of carbonie the sum of the pools the R functionrowSums can beused For example plotting the total amount of carbon overtime as well as the carbon on each pool only requires theselines of code

plot(times rowSums(CtBare)type=lylim=c(05) ylab=Topsoil carbonmass (kg m-2)xlab=Time (years)lwd=2)

lines(times CtBare[1]lty=2)lines(timesCtBare[2]lty=3col=2lwd=2)legend(toprightc(Total carbon

Carbon in pool 1 Carbon in pool 2)lty=c(123)col=c(112)lwd=c(212)bty=n)

If the total amount of carbon is needed for further calcula-tions the output ofrowSums() can be stored in an objectwith any name

We implemented the different N and C treatments reportedin Andren and Katterer(1997) from the set of parametersreported by those authors The code necessary to reproduceFig 2 inAndren and Katterer(1997) is provided as an exam-ple with the functionICBMModel and can be accessed by

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1053

0 5 10 15 20

02

46

8

Time (years)

Tops

oil c

arbo

n m

ass

(kg

m-2

)

Bare fallow+N +Straw-N +Straw-N -Straw+N -StrawManureSludge

Fig 2 Model predictions with the version of the ICBM modelimplemented in SOILR This graph reproduces Fig 2 inAn-dren and Katterer(1997) This figure can be reproduced typ-ing example(ICBMModel) or attr(ICBMModelex) inSOILR

typing example(ICBMModel) or from the html help inR This code produces Fig2 which is identical to Fig 2 inAndren and Katterer(1997)

42 Alternative two-pool models

The ICBM model described in the previous section althoughuseful does not offer too much flexibility in terms of the in-put arguments For example the litter inputs to the systemcould vary over time as well as the temperature and moistureeffects on decomposition rates In addition there are otherpossibilities to implement a two pool model depending onthe type of connection between pools (Fig1)

The parallel pool model structure can be implemented withthe functionTwopParallelModel while a more gen-eral version of a series model structure can be implementedwith the functionTwopSeriesModel Similarly the feed-back model structure can be implemented with the functionTwopFeedbackModel The inputs of litter and the mod-ification of decomposition rates by external factors can beeither constant or a function of time Furthermore the func-tions presented in Table1 and their combinations can beused as arguments in the different model structures provid-ing a large variety of options to model decomposition withjust two pools In fact the same flexibility can be obtainedwith any number of pools with the application of the moregeneral functionGeneralModel

As an example we show the differences obtained by run-ning three different versions of a two-pool model with the

0 5 10 15 20

05

1015

20

Car

bon

stoc

ks (a

rbitr

ary

units

) Two-pool ParallelTwo-pool SeriesTwo-pool Feedback

0 5 10 15 20

00051015202530

Time

Car

bon

rele

ase

(arb

itrar

y un

its)

Fig 3 Examples of three different representations of a two-poolmodel with different model structures and environmental effects ondecomposition rates The upper panel shows carbon stocks and thelower panel carbon release Additional details about the implemen-tation are given in the text

same amount of carbon at the beginning of the simulationsimilar rates of litter inputs and equal decomposition rates(Fig 3) As an illustration we also ran the simulations withdifferent options for the time dependence of the litter inputsand the decomposition rates In the first simulation we ran amodel with a structure of parallel compartments In this sim-ulation the litter inputs and decomposition rates were con-stant but the decomposition rates were modified by averagevalues of temperature and moisture according to the func-tions proposed in the Daycent model (Table1) For the sec-ond simulation we ran a two-pool model with connectionin series introducing temporal variability in the amount ofinputs using a sine function that artificially represents an an-nual cycle In the third simulation we ran a two-pool modelwith connection in series among compartments The amountof litter inputs over time were calculated using random num-bers over time In this simulation we also produced ran-dom numbers of temperature and moisture and applied thefunctions to modify decomposition rates according to theCentury and the Demeter models (Fig3) The code to re-produce Fig3 is provided in the example of the functionTwopFeedbackModel

These simulations without being necessarily realisticsimply show that small differences in model structure canproduce very different predictions even when the main pa-rameters of the model remain unchanged The simulationsalso serve to illustrate different possibilities in the use of the

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1054 C A Sierra et al SOIL R v 10

basic functions of SOILR to represent the process of organicmatter decomposition over time

To implement more sophisticated models with a higher de-gree of complexity it is possible to specify a larger amount ofpools with complex functions representing the dependence oflitter inputs decomposition rates and transfer between poolswith other external variables such as temperature moisturesoil texture nutrient status among many other

43 Implementation of the RothC model

RothC is a popular and widely used model for predicting or-ganic matter dynamics over time Although earlier versionsof the model included five active pools and one inert pool(Jenkinson and Rayner 1977) more recent versions only in-clude four active pools plus the inert pool (Jenkinson et al1990) RothC is implemented within SOILR and we providedetails here about this implementation to illustrate the useand potential implementation of any other model RothC canbe described by the following set of differential equations

dC1

dt= γ I minus k1C1

dC2

dt= (1minus γ )I minus k2C2

dC3

dt= α31k1C1 + α32k2C2 minus k3C3 + α33k3C3 + α34k4C4

dC4

dt= α41k1C1 + α42k2C2 + α43k3C3 minus k4C4 + α44k4C4

dC5

dt= 0 (20)

whereC1 represents the decomposable plant material (DPM)poolC2 the resistant plant material (RPM) poolC3 the mi-crobial biomass (BIO) poolC4 the humified organic matter(HUM) pool andC5 the inert organic matter pool (IOM)This set of equations can be rewritten in the form

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0α31k1 α32k2 minusk3(1minus α33) α34k4 0α41k1 α42k2 α43k3 minusk4(1minus α44) 0

0 0 0 0 0

C1C2C3C4C5

or as

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0a31 a32 minusk3 + a33 a34 0a41 a42 a43 minusk4 + a44 00 0 0 0 0

C1C2C3C4C5

(21)

The values of the decomposition rates are constant and givenby k1 = 10 k2 = 03 k3 = 066 andk4 = 002 (Jenkinsonet al 1990 Coleman and Jenkinson 1999) The value ofthe transfer coefficients is determined by a function of soiltexture For the microbial biomass pool transfer coefficientsare calculated as

a3j = kj

046

x + 1(22)

wherex is a value that determines the proportion of decom-posed material that is respired as CO2 and is given by

x = 167(185+ 160exp(minus00786pClay)) (23)

wherepClay is percent clay in mineral soil (Jenkinson et al1990) Similarly the transfer coefficients for the humifiedpool are given by

a4j = kj

054

x + 1 (24)

The partitioning of incoming plant material is determinedby the ratio DPMRPM which in RothC is set as 144 There-foreγ = 059 Now the basic structure of the RothC modelcan be written as

dC

dt= I

059041

000

+

minus10 0 0 0 0

0 minus03 0 0 0102 003 minus059 001 0119 004 008 minus002 0

0 0 0 0 0

C1C2C3C4C5

(25)

The annual amount of inputs is set in the RothC model asI = 17 Mg C haminus1 yrminus1

With this parameterization it is possible to run the RothCmodel without varying environmental effects on decompo-sition rates and observe how the system approaches steady-state for the different pools (Fig4) Parameter values ini-tial conditions and litter inputs can be changed easily withinSOILR to compare different predictions from this model

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1055

0 100 200 300 400 500

05

1015

2025

Time (years)

Car

bon

stor

es (M

g Cha

minus1)

Pool 1 DPMPool 2 RPMPool 3 BIOPool 4 HUMPool 5 IOMTotal Carbon

Fig 4 Carbon accumulation for the different pools included in theRothC model DPM the decomposable plant material pool RPMresistant plant material BIO microbial biomass pool HUM humi-fied organic matterpool and IOM inert organic matter pool

44 Applications for large-scale modeling

R can handle a large variety of data structures which offersinteresting possibilities for the application of the functionsimplemented in SOILR One important type of data structureis spatial data with global coverage There is a large numberof R packages to import and manipulate spatial data whichfacilitates the technical aspects for running SOILR functionsat the global scale

As an example we show here a simple calculation of cli-mate decomposition indexes (CDIs) (Adair et al 2008) us-ing a global dataset of temperature precipitation and po-tential evapotranspiration available at 05 degree resolutionon NetCDF files from the WATCH dataset (Weedon et al2011) The input dataset contained monthly average tempera-ture precipitation and evapotranspiration for the period 1958to 2001 We calculated the CDIs as

CDI = ξ(t) = f (T )f (W) (26)

with f (T ) implemented by the functionfTCentury1 andf (W) by the functionfWCentury as described in Ta-ble 1 Results can be easily plotted on a map (Fig5) andexported again to NetCDF files Different combinations ofthe functions described in Table1 can be used to calculateCDIs (Adair et al 2008) and evaluate different hypothesesabout the response of decomposition rates to moisture tem-perature and other variables

Longitude

Latit

ude

02

04

06

08

Fig 5 Climate decomposition index (CDI) calculated as the prod-uct of a function of temperature (fTCentury1 ) and a function ofprecipitation and potential evapotranspiration (fWCentury ) us-ing monthly data from the WATCH dataset (Weedon et al 2011)

5 Discussion

Many models of soil organic matter decomposition have beenproposed previously and there even exist some open-sourcetools to implement some of these models (egEaster et al2007) We have developed a tool for implementing and run-ning a large variety of these models with the idea of facili-tating comparison among multiple models in an easy to useinterface In this section we discuss some of the advantagesand disadvantages of our approach

51 Parameter space and structural domain

Models of organic matter decomposition are basically hypo-thetical abstractions about the structure and dynamics of soilorganic matter The multitude of models previously devel-oped suggests that there exists a large number of hypothesesabout the structure and functioning of soil organic matterbut there is basically little consensus on whether one modelstructure (hypothesis) would have more support on observa-tions than other model structures (Manzoni and Porporato2009)

The majority of modeling studies have focused on findingthe set of parameter values of a particular model that bestfit some observed data This approach is useful and has pro-vided much insight on understanding the rates of soil organicmatter decomposition However from the perspective of as-sessing different hypotheses about the structure and dynam-ics of soil organic matter parameter estimation can only givea narrow view of the more complex spectrum resulting from

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1056 C A Sierra et al SOIL R v 10

the combination of structure domain and the parameter spaceof models

SOILR provides the possibility of assessing both modelstructure and parameter values broadening the spectrum ofideas that can be assessed within one single analytical frame-work

We believe this approach complements well and could beeven more powerful than previous approaches to assess per-formance of model structure with inter-comparisons amongdifferent modeling groups (egMelillo et al 1995 Wu andMcGechan 1998 Cramer et al 2001 Randerson et al2009) Multi-model inter-comparison projects do not neces-sarily cover the whole domain of model structures and maybe subject to important issues such as independence of codebias of the whole model ensemble inappropriate metrics todefine model performance etc (Knutti et al 2009 Knutti2010) SOILR can partially help to overcome some of theseproblems for assessing the performance of model structurethrough the option of using alternative functions to representthe same process Philosophically this approach is also sim-ilar to testing multiple working hypotheses

52 Model hierarchies and functional programing

The gap between simulations and understanding describedby Held (2005) is currently exacerbated by the continuousincrease in detail and complexity of simulation modelsHeld(2005) suggests that a way forward to close the gap be-tween simulations and understanding is by the developmentof model hierarchies in which large-scale complex modelsare particular cases of general models that are more amenablefor understanding of system structure and behavior

SOILR can also be viewed as a system for hierarchicalmodeling of soil processes Consider for example the envi-ronmental or external effects on decomposition rates whichhere are denoted by the termξ(t) In its more simple andgeneral case the external effects can be simply a constant(ξ(t) = c) that allows the understanding of model behaviorwithout changes in environmental conditions Simulationscan then be run with a changing environment for exam-ple with variable soil moisture (ξ(t) = f (W(t))) Soil mois-ture could depend on other variables such as precipitationand potential evapotranspiration (W(t) = f (P (t)PET(t)))which in turn can be dependent on other functions In thisform a hierarchy of models is build with the dependence ofdifferent functions on other functions

In terms of programing this concept of model hierarchiescan be easily implemented in a functional programing styleA function that performs certain tasks can have as its argu-ments other functions that perform other tasks These func-tions can be independent among each other so many differentfunctions that perform the same task can be available withinthe same modeling environment This is one of our goals withSOILR to provide a modeling environment that serves as arepository of different functions that can perform the same

task so their performance can be easily compared It also al-lows building soil organic matter decomposition models ina hierarchical framework because functions can have a largenumber of dependences on other functions creating a bridgebetween simple general models and detailed modeling con-structions under the same basic principles

53 Scope and limitations

Our approach to soil organic matter decomposition modelingwith SOILR may have some limitations One potential limi-tation is the use of a high-level programing language that canhave issues in terms of computational efficiency This couldbe an important problem if specific models structures witha large number of computations per time step are applied toa large number of points such as a large spatial grid Otherprograming languages such asC or Fortran may be moresuitable for these tasks although a good programing stylecan avoid many issues of computational efficiency inR It isimportant to keep in mind that the scope of SOILR is morefor the exploration of different model structures and hypothe-ses about soil processes rather than for large computationaltasks however some parallelization tools withinR could beused for this purpose We recommend that once a specificmodel structure is identified as useful for a large computa-tion the entire model object is translated to other languageor optimized for running inR We are exploring these possi-bilities to include in future releases of SOILR

Another potential limitation is the incompatibility of ourconceptual framework to represent the decomposition pro-cess as a non-linear dynamical system Non-linear dynamicsare important for representing microbial processes such aspriming and are very relevant for simulations at short timescales (Wutzler and Reichstein 2008 Manzoni and Porpo-rato 2007 2009) Non-linear models however can be eas-ily implemented inR with the deSolve package We areconsidering two possibilities to include non-linear dynamicalsystems within our theoretical framework One possibility isto provide a framework to specify and linearize non-linearsystems and solve the linear equations as presented here An-other possibility is to include a set of non-linear models solv-ing them directly withdeSolve We aim for further releasesto include this additional functionality

6 Conclusions

We have developed a modeling environment for represent-ing the process of soil organic matter decomposition Thistool SOILR is an open- source package for the implemen-tation and testing of different representations of the processof soil organic matter decomposition The main character-istic of SOILR is its hierarchical structure in which we de-scribe a general model that can accommodate any possiblemodel structure of a multi-pool model of decomposition

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1057

More detailed models can be implemented to simulate spe-cific controls on the decomposition process This allows fortesting of multiple working hypotheses about the structureand functioning of soils and their behavior over time SOILRnot only allows for exploring dynamics on the parameterspace of a model but also on the structural domain

This first version of SOILR allows simulations of organicmatter decomposition and future versions will include rep-resentations of other biogeochemical elements such as nitro-gen and phosphorus as well as their isotopic composition Amodule for parameter fitting will also be included in futurereleases

Appendix A

Implementation details and design decisions regardingSOIL R

A1 The choice of the object-oriented programing(OOP) system

While in object oriented languages the implementation of ob-ject oriented design principles is usually hardwired inR itis a choice between at least three different approaches thusforcing the user to explain why a particular system was usedIn our case the choice ofS4 is a compromise On one handthere is very limited support inS4 for real encapsulation ex-pressed most notably by the possibility to read and even writethe values of slots from outside the class by theslot func-tion or theoperator respectively This default behavior isactually not even trivially changed On the other hand thereare some important advantages

1 Compatibility with the functional paradigm ofR and itsassociated benefits such as lazy evaluation concurrencyand in the future maybe even automatic parallelizationwhich depends on the absence of side effects (unavoid-able with a reference based system likeR5)

2 The integration withRrsquos standard library which in-creases

a the probability of future maintenance and

b acceptance by otherR users

3 The relative seamless integration to commonR work-flows without in depth knowledge of object orientedprograming

Considering that ifR is capable to implement an OOPsystem by means of on board tools it will probably be flexibleenough to change the default behavior of this OOP systemwith on board tools as well SOILR is a rather small packageand we thinkS4 is and appropriate choice for our needs

A2 Comparison betweenSIMECOL and SOIL R

SIMECOL (Petzoldt and Rinke 2007) an R package for theimplementation of ecological models is an alternative to ourown implementation Here we compare the two approachesin terms of their design

A21 Scope

SOILR is focused solely on soil organic matter decompo-sition while SIMECOL aims to be a general framework forecological modeling inR SIMECOL represents an abstrac-tion level somewhere between SOILR andRrsquos S4 systemHence the obvious way for SOILR to make use ofSIMECOL

would be to implement ourModel class as a subclass ofSIMECOL rsquos simObj One motivation to do so consists in thepossibility to inherit functionality from the ancestor which isusually additionally shared by other subclasses thus enablingeasier communication between them Whether subclassing isthe appropriate strategy thus depends on the amount of in-heritable code and the number of subclasses We found thatwithin SOILR Model would be the only one subclass ofSIMECOLrsquos model with nearly no code shared owing to dif-ferences in functionality and design goals (see below)

A22 Functionality

One major difference withSIMECOLrsquos simObj is thatSOILRrsquos Model initialize method requires objects of classTimeMap or its subclasses thus guaranteeing that the dif-ferent objects conforming a model share a common supportin the time domain even if the creation ofTimeMap ob-jects usually takes place far away from the initialization of aModel object since this usually happens behind the sceneseg by conversion ofdataframes the user provides asinput This is a significant difference fromSIMECOLrsquos ap-proach Implementing this functionality in a subclass ofSIMECOLrsquos model would be misleading and would not con-form well with our design goals

A23 Design goals

The main aim of SOILRrsquos Model class is to provide a fencebetween interface and implementation While the interfaceshould change as little as possible to protect code using theclass we want to have as much freedom as possible to changeits implementation We strive to achieve this by avoiding ev-ery possible syntactic distinction between references to ob-ject data and object methods from the outside WithRrsquos S4system one (and maybe the only) way to do so is to wrapall access to object data with get and set methods This isone aspect of a concept often referred to asencapsulationand regarded as one of the key components of OOP In lan-guages such asSmalltalk (Kay 1993) or Ruby (Matsumotoand Ishituka 2002) fully dedicated to OOP this approach ismandatory A method call (a message send to an object) is

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1058 C A Sierra et al SOIL R v 10

the one and only way for objects to communicate with eachother

The S4 approach inR is much less strict and allowsdirect manipulation of the data belonging to an object bymeans of the operator(or the slot function respectively)thus revealing the implementation of an object to the out-side code using this object User code based onwill breakif the implementation changes and the desired slot disap-pears while a get method may be able to retrieve the de-sired information from other data The use of the slot op-erator from outside should therefore be avoided (Genolini2008 Gentleman 2003) Imagine for instance acircle ob-ject c thatstoresits radius andcomputesthe diameter whengetDiameter(c) is called If the radius is accessed solelyby calls ofgetRadius(c) the implementation of the circleclass can later be changed to store the diameter and computethe radiuswithoutany affect to outside code using the class

Applications to SOILRrsquosModel occur if one considers theincreasing number of constructors with redundant parametersets The distinction between parameters and derived vari-ables may even become difficult Differing fromSIMECOL

we unify access toModel elements and avoid a syntacticdifference of parameters and derived values as expressed bySIMECOLrsquos functionsparams andout In addition to theget functions we provide for all data intended to be ac-cessed from outside access through the typical operators[]and$ for our Model class This gives access to all data themodel can provide either during the initialization or com-puted by the methods of the class In fact[] and $ inter-nally use theget methods and may perform any numberof checks and computations to provide a consistent outputThis facility is powerful enough to avoid the use ofcom-pletely for our class This is exactly our intention since theimplementation of the class may change accessing its ele-ments viais strongly discouraged While we will maintainthe defined interface via[] $ and theget functionswe cannot guarantee that code relying onwill work in fu-ture versions of SOILR

Another difference withSIMECOL is also related to the[]operator It enables the user to create the desired output ondemand thus avoiding duplication between output objectsIf the user asks forC shehe getsC and nottimeandC which sometimes may not be intended if the user isconcerned about issues of memory or duplication Howeverit may be very useful to have both in other situations whenthe times argument to the constructor that created themodel in the first place is not available anymore With[]the user can decide which fields the output should contain

An additional intended feature of our[] operator is to al-ways producedataframes and not aResult objectthat would (or at least should) be more protective of its dataagainst alterations post simulation than adataframe Ifwe provided code to post-process results we would certainlyimplement such aResult class to make sure that ourpost-processing is based on valid data Since at the moment

we donrsquot we also do not force a structured output object tothe user

At the moment we do not even provide output asdeSolve objects since every structured output is part of theinterface and may be relied on by user code Although weare happy and thankful to usedeSolve extensively withinSOILR making it a part of the interface would be a promiseto the user that we will keep on supporting it which is a muchbigger commitment

Until now the responsibility beyond the scope of classModel stays with the user

Supplementary material related to this article isavailable online athttpwwwgeosci-model-devnet510452012gmd-5-1045-2012-supplementzip

AcknowledgementsFinancial support for the development of thisproject was provided by the Max Planck Society We would like tothank Ulrich Weber and Martin Jung for providing global climatedata used in the example Maarten Braakhekke provided helpfulcomments on a previous version of this manuscript

The service charges for this open access publicationhave been covered by the Max Planck Society

Edited by S Arndt

References

Adair E Parton W Del Grosso S Silver W Harmon MHall S Burke I and Hart S Simple three-pool modelaccurately describes patterns of long-term litter decomposi-tion in diverse climates Glob Change Biol 14 2636ndash2660doi101111j1365-2486200801674x 2008

Agren G and Bosatta E Theoretical ecosystem ecology under-standing element cycles Cambridge University Press 1998

Andren O and Katterer T ICBM The Introductory Carbon Bal-ance Model for Exploration of Soil Carbon Balances EcolAppl 7 1226ndash1236httpwwwjstororgstable2641210 1997

Bolker B M Pacala S W and Parton W J Linearanalysis of soil decomposition insights from the CEN-TURY model Ecol Appl 8 425ndash439doi1018901051-0761(1998)008[0425LAOSDI]20CO2 1998

Bruun S Six J Jensen L and Paustian K Estimating turnoverof soil organic carbon fractions based on radiocarbon measure-ments Radiocarbon 47 99ndash113 2008

Burger M Juenemann K and Koenig T RUnit R Unit testframework R package version 04 25 2009

Burke I Kaye J Bird S Hall S McCulley R and Som-merville G Evaluating and testing models of terrestrial biogeo-chemistry the role of temperature in controlling decompositionModels in ecosystem science Princeton University Press Prince-ton New Jersey USA 225ndash253 2003

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1047

dX

dt= L minus kX (1)

whereX is either oven-dry weight organic carbon or energyin organic matterL is the income of organic matter andk adecay constant

Equation (1) treats soil organic matter as one single com-partment with an overall decomposition rate representative ofall substances within the soil matrix It has been commonlynoted that soil organic matter is heterogeneous and the singleexponential model of decomposition fails to account for thisheterogeneity (Minderman 1968 Swift et al 1979) EarlierHenin et al(1959) proposed a model to account for the dif-ferent rates of decomposition of labile and stable materialalso considering the process of humification ie the transferof material from the labile to the stable pool This model canbe expressed as

dX1

dt= L minus k1X1

dX2

dt= αk1X1 minus k2X2 (2)

whereX1 represents the labile pool andX2 the stable poolThe parameterα represents the humification or transfer rateA different version of a two-pool model has been widely usedfor studies of litter decomposition in which the system ofequations takes the form (Minderman 1968 Means et al1985)

dX1

dt= γL minus k1X1

dX2

dt= (1minus γ )L minus k2X2 (3)

In this case the two pools decompose independently fromone another and the amount of litter inputsL is partitionedbetween the pools according to the parameterγ

Different variations of these models can be found in theliterature with different number of pools and transfer amongcompartments

Two numerical compartment models have become stan-dard in representing organic matter decomposition these arethe RothC (Jenkinson and Rayner 1977 Jenkinson et al1990) and the Century (Parton et al 1987) models Thesetwo models have been used successfully to represent soil car-bon dynamics at different spatial and temporal scales (Pauland Clark 1996 Paustian et al 1997) Although these mod-els were developed on the grounds of pragmatism ratherthan based on strict mathematical formalisms (Bolker et al1998) they can be easily translated into systems of differ-ential equations with the general model (Bolker et al 1998Paustian et al 1997)

dX1

dt=f1(θ1k1X1 middot middot middot θmkmXm)

dXm

dt=fm(θ1k1X1 middot middot middot θmkmXm) (4)

whereθ is a parameter set modifying the decomposition ratek andm the total number of compartments representing thesystem

In general the number of compartments in this type ofmodels is less than 10 (Manzoni and Porporato 2009) andthe decomposition rate constant may be a function of tem-perature moisture andor other edaphic conditions

We make use of this mathematical abstraction (Eq4) topropose a general model of soil organic matter decomposi-tion

22 A general model of soil organic matterdecomposition

Models of soil organic matter decomposition are in theirlarge majority specific cases of linear dynamical systems(Bolker et al 1998 Manzoni and Porporato 2009 Luo andWeng 2011) Making use of this property we propose amodel that generalizes the majority of all previously pro-posed compartment models This general model is given by

dC(t)

dt= I (t) + A(t)C(t) (5)

whereC(t) is a m times 1 vector of carbon stores inm poolsat a given timet A(t) is am times m square matrix containingtime-dependent decomposition rates for each pool and trans-fer coefficients between pools andI (t) is a time-dependentcolumn vector describing the amount of inputs to each poolm

The matrixA(t) is particularly important because it de-fines both the model structure and the extrinsic effects ondecomposition and transfer rates For this reason we rewriteEq (5) as

dC(t)

dt= I (t) + ξ(t)A C(t) (6)

whereξ(t) is a time-dependent scalar containing the extrin-sic or environmental effects on decomposition rates Noticethat the matrixA contains now constant coefficients definingmodel structure

From this general Eq (6) it is possible to derive a largevariety of structures for compartment models

23 The matrix A and model structure

Organic matter decomposition can be represented with alarge variety of model structures and levels of connectivity

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1048 C A Sierra et al SOIL R v 10

among compartments (Swift et al 1979 Bruun et al 2008Manzoni and Porporato 2009) Different model structuresare determined by the matrixA in linear dynamical systems(Bolker et al 1998 Manzoni et al 2009) For instance theparallel or pure decay structure (Fig1) in compartment mod-els is defined by a diagonal matrix of the form

A =

minusk1 0 middot middot middot 0

0 minusk2 middot middot middot 0

0 0 middot middot middot minuskm

where the entries in the diagonal represent the decompositionratekj for each compartmentj A required condition is thatall kj ge 0

Compartments connected in series (Fig1) can be repre-sented with a matrix of the form

A =

minusk1 0 0 middot middot middot 0a21 minusk2 0 middot middot middot 00 a32 minusk3 middot middot middot 0

0 0 0 middot middot middot minuskm

where the entriesaij are the transfer coefficients of materialfrom poolj to pooli A required condition is that allaij ge 0

Similarly feedback between adjacent compartments(Fig 1) is defined by a matrix of the form

A =

minusk1 a12 0 0 middot middot middot 0a21 minusk2 a23 0 middot middot middot 00 a32 minusk3 a34 middot middot middot 00 0 a43 minusk4 middot middot middot 0

0 0 0 0 middot middot middot minuskm

(7)

More complex model structures are created by replacingzero entries in the matrixA representing transfers betweendifferent compartmentsi andj

An important characteristic of the entriesaij is that theyare proportional to the decomposition rate ieaij = αijki whereαij represents the proportion of the decompositionrate that is transferred to pooli from pool j Furthermore0 le αij le 1 and the column sum

sumi αij le 1 with

rj = 1minus

sumi

αij (8)

representing the proportion of the decomposed material thatgets released from the system from poolj

24 The environmental termξ(t)

The majority of organic matter decomposition models in-clude functionsf (x) that modify decomposition rates ac-cording to a set of time-varying environmental conditions

No Pools 1 2 3

Parallel

Series

Feedback

Fig 1Basic model structures implemented in SOILR Squares rep-resent the compartments and arrows represent inputs and outputsto and from the compartments These model structures are specialcases of the matrixA

x1(t) xn(t) such as temperature moisture evapotranspi-ration etc (Burke et al 2003 Adair et al 2008) In ourmodel (Eq6) the representation of these environmental ef-fects is done with the termξ(t) which is the result of theevaluation of the function or set of functionsf (xi(t)) yield-ing a scalar value that can be directly multiplied to the matrixA In this case

ξ(t) = f (x1(t) xn(t)) (9)

The values off (xi(t)) are determined by different func-tions that depend on temperature precipitation and other en-vironmental variables Time-dependence is therefore intro-duced with time series of these environmental variables asinput in the model SOILR contains a library of functionsthat calculate environmental effects on decomposition ratesbased on functions reported for different models (Table1)

More complex functions are also introduced in SOILR butare not included in Table1 due to space limitations The doc-umentation and help files of SOILR contain a more detaileddescription of all functions

25 Initial conditions

The linear dynamical system represented by Eq (6) hasmany different solutions but we are only interested in thesolution that satisfies

C(t = 0) = C0 (10)

whereC0 is amtimes1 vector with the value of carbon content inthe different compartmentsi C0 must be specified in SOILRto run any possible model structure

26 The vector of inputs

Inputs to the system from above and belowground compo-nents are represented by the vectorI (t) This vector can also

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1049

Table 1 Functions implemented in SOILR to represent the effects of temperatureT and moistureW on decomposition rates

f (x) Terms Function name Source

f (T ) =

Q(T minus10)1010 T mean temperature fTQ10

4791+exp( 106

T +183 )T monthly temperature (C) fTRothC Jenkinson et al(1990)(

TmaxminusTTmaxminusTopt

)02exp

(02263

(1minus

(TmaxminusT

TmaxminusTopt

)263))

T Tmax Toptmonthly average maximumand optimal temperature

fTCentury1 Burke et al(2003)

3439exp

(02263

(1minus

(TmaxminusT

TmaxminusTopt

)263)(

TmaxminusTTmaxminusTopt

)02)

T Tmax Toptmonthly average maximumand optimal temperature

fTCentury2 Adair et al(2008)

08exp(0095Ts) Ts Soil temperature fTDaycent1 Kelly et al (2000)

056+ (146arctan(π00309(Ts minus 157)))π Ts Soil temperature fTDaycent2 Parton et al (2001) Grossoet al(2005)

0198+ 0036T T monthly temperature fTlinear Adair et al(2008)

exp(30856

(1

5602 minus1

(T +273)minus22713

))T monthly temperature fTLandT Lloyd and Taylor(1994)

exp(minus3764+ 0204T (1minus 05T369)) T mean temperature fTKB Kirschbaum(1995)

exp((ln(Q10)10)(T minus 20)) T mean temperatureQ10temperature coefficient

fTDemeter Foley(2011)

exp(minus(T (Topt+ Tlag))Tshape)Q

(T minus10)1010 T Tmax Topt

monthly averagemaximum and optimaltemperature

fTStandcarb Harmon and Domingo(2001)

f (W) =

11+30exp(minus85W)

W = PPETP monthly precipitation PETmonthly potentialevapotranspiration

fWCentury Parton et al(2001) Adair et al(2008)

(Wminusbaminusb

)d((bminusa)(aminusc)) (Wminuscaminusc

)dW water filled pore spacea b c dempirical coefficients

fWDaycent1 Kelly et al (2000)

5(0287) + (arctan(π0009(RWC minus 1747))π) W volumetric water content fWDaycent2 Grosso et al(2005)

025+ 075(MMsat) M soil moistureMsatsaturated soil mositure

fWDemeter Foley(2011)

(1minus exp(minus(3Mmin)(M + a)))b exp(minus(M(Mmax+ c))d ) M Mmin Mmax average minimumand maximum moisturecontent in litter poolabcd empirical coefficients

fWStandcarb Harmon and Domingo(2001)

be expressed as

I (t) = I (t)

γ1

γi

γm

(11)

whereI (t) is a time-dependent scalar representing the totalamount of inputs and the coefficientsγi represent the par-titioning among the different pools In this representation0 le γi le 1 and

summi=1γi = 1

27 Carbon release

A variable of interest in modeling soil organic matter decom-position is the amount of carbon leaving the system over time

either in the form of CO2 gas or as dissolved organic carbonWe represent this flux with the general termr which is givenby

r = RC(t) (12)

wherer is amtimes1 vector containing the instantaneous releaseof carbon for all pools andR is amtimesm diagonal matrix withthe release coefficientsrj in its diagonal calculated from (8)

28 Analytical solution

Analytical solutions to Eq (5) are implemented in SOILRonly with the purpose of testing the performance of the nu-merical methods However we can only test cases under cer-tain simplifications of the general model of Eq (5) In partic-ular for a homogeneous system with constant coefficientswhich is analogous to the decomposition of a single cohort

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1050 C A Sierra et al SOIL R v 10

of organic matter (Agren and Bosatta 1998) Eq (5) simpli-fies to

dC(t)

dt= AC(t) (13)

With initial conditions as in Eq (10) the analytical solu-tion to this problem is given by

C(t) = eA(tminust0)C0 (14)

If I (t) is not identically zero then the solution of the linearsystem

dC(t)

dt= I (t) + AC(t)

with initial conditions as in Eq (10) is given by

C(t) = eA(tminust0)C0 +

tintt0

eA(tminusτ)I (τ )dτ (15)

3 Numerical implementation

The solution to the dynamical system described by Eq (6) isdiscretized over time withh denoting the time step andn thenumber of steps The time steph may or may not be constantInitial conditions are given at timet0 = 0 The solution to thesystem is then given by

Cn+1 = Cn + Dr [fprime(Cn)h] (16)

whereDr [fprime(Cn)h] is anr order finite difference approxi-

mation to the system of ODEs of Eq (6) for each time steph(LeVeque 2007) in other words an ODE solver

The choice for the ODE solver is flexible in SOILR Cur-rently we provide the option to use a simple Euler forwardmethod or an interface to thedeSolve package ofSoetaertet al (2010) The functiondeSolvelsodawrapperin SOILR is a wrapper to the functionlsoda in packagedeSolve

31 TheModel class

The general numerical model described by Eq (6) is rep-resented in SOILR by an object oriented design centeringaround the classModel Nearly all computations possible inSOILR are facilitated byModel itself or its building blocksThe class defines the information allModel objects containand how those objects behave when (generic) functions areapplied to them (Chambers 2008) Any model constructedwith SOILR provides then a stable and consistent interfacethat encapsulates details about its implementation This in-terface provide a number of advantages to the user

1 A level of abstraction close to the mathematical descrip-tion of the model being implemented focusing on thescientific content rather than on technical details

2 Stability of code generated by the user based on SOILRoutput We believe that the more essential and less re-dundant the interface the less likely it is to change infuture revisions

3 Safeguards against unreasonable (and therefore prob-ably unintentional) input from simple dimensionalchecks to mathematical consistency of all arguments ofthe general model described in Sects22through27

4 Smaller programs that are easier to read

Developers also benefit from this implementation design by

1 Freedom to change the implementation behind thescenes without breaking user code

2 Easier maintenance testing bug tracking and exceptionhandling by reduced duplication

Objects of classModel are initialized in SOILR by vari-ous functions which are listed with the commandModel Most of them provide shortcuts for the construction of stan-dard models such as those in Fig1 These functions usuallydo not require the user to consider the real building blocks ofaModel object but rather infer the needed information fromobjects more common inR such as data frames Howeverall these high-level functions callGeneralModel which isthe most general constructor The functionGeneralModelinitializes theModel object after applying various validitychecks but does not run the model itself which instead isdone by specific functions (methods) applied to objects ofclassModel

The functionGeneralModel takes five arguments rep-resenting a specific case of Eq (6)

1 A vector t which contains the time values where thesolution to the ODE system is sought It can be of anylength but must be of classnumeric

2 An object of classTimeMap which implements thematrix A of Eq (5) as a function of time (including itsdomain) thus allowing the same level of abstraction asthe most general ODE solvers (Soetaert et al 2010)The classTimeMap is native to SOILR and simply ex-tends a commonR function to a mathematical validfunction definition that includes the time domain wherethe function is defined Thus it contains the necessaryinformation to prevent extrapolations beyond the rangeof input data Details aboutTimeMap are discussed inAppendixA

3 A vector of classnumeric containing the initialvaluesC0 of the ODE system

4 Again an object of classTimeMap containing theinputs I (t) to the system as a vector valued functionof time The length of this vector must be equal to thedimension of the matrixA and is checked as well as thetime domain

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1051

5 A string choosing the solver to be used

Once a new object of classModel is intialized from a callto GeneralModel or one of its various wrappers the newobject can be queried by several generic functions For ex-ample to obtain the amount of carbon over time solving thesystem of ODEs any object of classModel (and thereforeall its subclasses) can be used as argument of the functiongetC The call to this function returns an times m matrix withthe amount of carbon for each poolm at each time stepnSimilarly to obtain the amount of carbon release over timethe functiongetReleaseFlux can be called with any ob-ject of classModel as argument The result will be an times m

matrix with the amount of released carbon for each poolm

at each time stepn It is also possible to use the typical op-erators[ ] and $ for our Model class given access tomethods even easier For examplegetC(mod) is equiva-lent tomod$Cand something like

df=asdataframe(cbind(getTime(mod)getC(mod)))

can also be expressed as

df=mod[c(time C)]

This avoids the necessity of the somewhat dangerous use ofthe operator in user code which we strongly discouragesince it attaches the code to implementational details thatmay change in the future

The implementation of specific models as subclasses ofModel with methods for the generic functions will allow theintegration of new functionality without major modificationsto our current implementation For example once nutrientcycling and isotope dynamics are incorporated into SOILRnew methods will be developed independently without majormodifications to the current implementation of carbon stocksand release

The vignette GeneralModel provided with SOILRpresents some further insight in the implementation of spe-cific model structures with the help of the general tool-setprovided by theModel class The examples therein mayalso serve as templates to implement new model structuresas desired by the user Examples on how to use these modelstructures as a function are presented in Sect4

32 Version control system unit testing and automaticdocumentation

The development of SOILR is aided by a significant amountof existing open- source software To solve the ordinary dif-ferential equations produced by our framework we rely onthe well tested and documenteddeSolve package devel-oped bySoetaert et al(2010) We also use the open-sourcesymbolic python library SymPy (SymPy Development Team2008) to compute analytical solutions for the models forwhich this is possible The analytical solutions obtained from

SymPy are used to automatically create unit tests for SOILRTo constantly run these tests we use another open-sourcesoftware theRunit package (Burger et al 2009) The testsare distributed with the release version of SOILR and thusadd to the transparency of its development In addition weuseSweave (Leisch 2002 2003) and theinlinedocspackage (Hocking et al 2012) to produce documentationand encourage a literate programing style (Knuth 1984)As a version control system we use Mercurial (OrsquoSullivan2009) and the Trac (Edgewall Software 2011) online projectmanagement tool which includes ticket system wiki andonline access to our source code

33 Documentation

There are different types of documentation for SOILR Thefirst source of information is this document which intro-duces the science and some general technical details Asecond source of information is the documentation to eachfunction provided within the package itself To view thisdocumentation the user only needs to openR and typehelpstart() This will open a help window on a web-browser There the user only needs to go to PackagesSoilR toview a list of all the functions implemented Clicking on eachfunction will show details about the arguments of each func-tion and examples on how to use them For specific functionsthe user can also just type the name of the function precededby the question mark on theR command shell For exampletyping TwopParallelModel in the R command shellwill open a help window with the description of the functionTo view the source code of the function the user only needsto type the name of the function (without the question mark)on theR command shell

A third source of information are the so called Package Vi-gnettes These are short documents illustrating the use of thepackage for specific purposes Currently we provide one vi-gnette with version 10 of SOILR This vignette illustratesthe implementation of any model structure within SOILRFor future versions we will provide vigenettes about fittingspecific model structures to data and how to use SOILR formodeling radiocarbon

34 Installing and loading SOIL R

SOILR can be obtained from the ComprehensiveR ArchiveNetwork (CRAN) the official repository forR packageswith mirrors in places all over the world Packages storedin CRAN can be downloaded directly from anR ses-sion It can also be obtained from R-Forge a repositoryfor package developers To install SOILR from CRANthe user simply needs to type in theR command shellinstallpackages(SoilR) To install from R-Forge the statement isinstallpackages(SoilRrepos=httpR-ForgeR-projectorg) After installing the package simply type

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1052 C A Sierra et al SOIL R v 10

library(SoilR) and the package is loaded intoyourR session

4 Examples

In this section we present examples on how to runsome of the functions implemented in SOILR basedon the theoretical framework presented previously Ad-ditional details about the implementations of each func-tion and instructions on how to implement new modelstructures are presented in the vignette lsquoImplementingCompartment Models in SOILR the GeneralModelFunctionrsquo provided with the package To view thisvignette simply typevignette(GeneralModelpackage=SoilR) in theR command shell

41 Implementation of a two pool model withconnection in series the ICBM model

One of the first models ever proposed to represent soil or-ganic matter dynamics was a two-pool model with connec-tion in series (cf Eq2 Henin et al 1959) More than50 yr laterAndren and Katterer(1997) proposed the ICBMmodel which is practically the same model proposed earlierby Henin et al(1959) but including a term for temperatureand moisture dependence of decomposition rates The set ofdifferential equations of the ICBM model are given by

dC1

dt= I minus k1ξC1

dC2

dt= αk1ξC1 minus k2ξC2 (17)

whereα is a humification or transfer coefficient andξ a pa-rameter representing external effects on decomposition ratesIn the ICBM modelC1 represents a ldquoyoungrdquo pool andC2 anldquooldrdquo pool This set of equations can be rewritten using ourmodel formulation which gives

dC

dt= I

(10

)+ ξ

(minusk1 0αk1 minusk2

)(C1C2

) (18)

with initial conditions(C10C20)T and where

A =

(minusk1 0a21 minusk2

)

with a21 = αk1 γ = 1 andξ(t) = ξ The function ICBMModel in SOILR implements this

model structure requiring as its arguments (1) a vector ofany length with the points in time when we are interested infinding a solution (2) a column vector of decomposition rates(k1k2)

T (3) the value ofα (4) the value ofξ (5) a columnvector with the initial amount of carbon at the beginning ofsimulation(C10C20)

T and (6) the mean annual carbon in-put to the soilI Andren and Katterer(1997) provided values

for these arguments from a 35-yr field experiment manipu-lating carbon and nitrogen inputs to an agricultural soil inSweden For the case of a treatment in which the soil wasleft as bare fallow without N or C inputs the ICBM modelcan be parameterized as

dC

dt= 0

(10

)+ 132

(minus08 0

013times 08 minus000605

)(C1C2

) (19)

with initial conditions(03396)T Assuming SOILR is already installed it is only necessary

to write the following lines of code to run the ICBM model

library(SoilR)times=seq(020by=01)Bare=ICBMModel(t=times ks=c(k1=08

k2=000605) h=013 r=132c0=c(C10=03C20=396) In=0)

The call toICBMModel simply initialize the model andchecks for consistency on its arguments In this example thedecomposition rates are given in units of yearminus1 and the ini-tial amounts of carbon in units of kg C mminus2

To obtain the amount of carbon over time it is necessary toinvoke the functiongetC storing the output into an objectFor example to store the amount of carbon from the objectBare the user can type

CtBare=getC(Bare)

This new objectCtBare is a matrix with 2 columns(2 pools) and 201 rows (201 points in time from 0 to 20in increments of 01) To obtain the total amount of carbonie the sum of the pools the R functionrowSums can beused For example plotting the total amount of carbon overtime as well as the carbon on each pool only requires theselines of code

plot(times rowSums(CtBare)type=lylim=c(05) ylab=Topsoil carbonmass (kg m-2)xlab=Time (years)lwd=2)

lines(times CtBare[1]lty=2)lines(timesCtBare[2]lty=3col=2lwd=2)legend(toprightc(Total carbon

Carbon in pool 1 Carbon in pool 2)lty=c(123)col=c(112)lwd=c(212)bty=n)

If the total amount of carbon is needed for further calcula-tions the output ofrowSums() can be stored in an objectwith any name

We implemented the different N and C treatments reportedin Andren and Katterer(1997) from the set of parametersreported by those authors The code necessary to reproduceFig 2 inAndren and Katterer(1997) is provided as an exam-ple with the functionICBMModel and can be accessed by

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1053

0 5 10 15 20

02

46

8

Time (years)

Tops

oil c

arbo

n m

ass

(kg

m-2

)

Bare fallow+N +Straw-N +Straw-N -Straw+N -StrawManureSludge

Fig 2 Model predictions with the version of the ICBM modelimplemented in SOILR This graph reproduces Fig 2 inAn-dren and Katterer(1997) This figure can be reproduced typ-ing example(ICBMModel) or attr(ICBMModelex) inSOILR

typing example(ICBMModel) or from the html help inR This code produces Fig2 which is identical to Fig 2 inAndren and Katterer(1997)

42 Alternative two-pool models

The ICBM model described in the previous section althoughuseful does not offer too much flexibility in terms of the in-put arguments For example the litter inputs to the systemcould vary over time as well as the temperature and moistureeffects on decomposition rates In addition there are otherpossibilities to implement a two pool model depending onthe type of connection between pools (Fig1)

The parallel pool model structure can be implemented withthe functionTwopParallelModel while a more gen-eral version of a series model structure can be implementedwith the functionTwopSeriesModel Similarly the feed-back model structure can be implemented with the functionTwopFeedbackModel The inputs of litter and the mod-ification of decomposition rates by external factors can beeither constant or a function of time Furthermore the func-tions presented in Table1 and their combinations can beused as arguments in the different model structures provid-ing a large variety of options to model decomposition withjust two pools In fact the same flexibility can be obtainedwith any number of pools with the application of the moregeneral functionGeneralModel

As an example we show the differences obtained by run-ning three different versions of a two-pool model with the

0 5 10 15 20

05

1015

20

Car

bon

stoc

ks (a

rbitr

ary

units

) Two-pool ParallelTwo-pool SeriesTwo-pool Feedback

0 5 10 15 20

00051015202530

Time

Car

bon

rele

ase

(arb

itrar

y un

its)

Fig 3 Examples of three different representations of a two-poolmodel with different model structures and environmental effects ondecomposition rates The upper panel shows carbon stocks and thelower panel carbon release Additional details about the implemen-tation are given in the text

same amount of carbon at the beginning of the simulationsimilar rates of litter inputs and equal decomposition rates(Fig 3) As an illustration we also ran the simulations withdifferent options for the time dependence of the litter inputsand the decomposition rates In the first simulation we ran amodel with a structure of parallel compartments In this sim-ulation the litter inputs and decomposition rates were con-stant but the decomposition rates were modified by averagevalues of temperature and moisture according to the func-tions proposed in the Daycent model (Table1) For the sec-ond simulation we ran a two-pool model with connectionin series introducing temporal variability in the amount ofinputs using a sine function that artificially represents an an-nual cycle In the third simulation we ran a two-pool modelwith connection in series among compartments The amountof litter inputs over time were calculated using random num-bers over time In this simulation we also produced ran-dom numbers of temperature and moisture and applied thefunctions to modify decomposition rates according to theCentury and the Demeter models (Fig3) The code to re-produce Fig3 is provided in the example of the functionTwopFeedbackModel

These simulations without being necessarily realisticsimply show that small differences in model structure canproduce very different predictions even when the main pa-rameters of the model remain unchanged The simulationsalso serve to illustrate different possibilities in the use of the

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1054 C A Sierra et al SOIL R v 10

basic functions of SOILR to represent the process of organicmatter decomposition over time

To implement more sophisticated models with a higher de-gree of complexity it is possible to specify a larger amount ofpools with complex functions representing the dependence oflitter inputs decomposition rates and transfer between poolswith other external variables such as temperature moisturesoil texture nutrient status among many other

43 Implementation of the RothC model

RothC is a popular and widely used model for predicting or-ganic matter dynamics over time Although earlier versionsof the model included five active pools and one inert pool(Jenkinson and Rayner 1977) more recent versions only in-clude four active pools plus the inert pool (Jenkinson et al1990) RothC is implemented within SOILR and we providedetails here about this implementation to illustrate the useand potential implementation of any other model RothC canbe described by the following set of differential equations

dC1

dt= γ I minus k1C1

dC2

dt= (1minus γ )I minus k2C2

dC3

dt= α31k1C1 + α32k2C2 minus k3C3 + α33k3C3 + α34k4C4

dC4

dt= α41k1C1 + α42k2C2 + α43k3C3 minus k4C4 + α44k4C4

dC5

dt= 0 (20)

whereC1 represents the decomposable plant material (DPM)poolC2 the resistant plant material (RPM) poolC3 the mi-crobial biomass (BIO) poolC4 the humified organic matter(HUM) pool andC5 the inert organic matter pool (IOM)This set of equations can be rewritten in the form

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0α31k1 α32k2 minusk3(1minus α33) α34k4 0α41k1 α42k2 α43k3 minusk4(1minus α44) 0

0 0 0 0 0

C1C2C3C4C5

or as

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0a31 a32 minusk3 + a33 a34 0a41 a42 a43 minusk4 + a44 00 0 0 0 0

C1C2C3C4C5

(21)

The values of the decomposition rates are constant and givenby k1 = 10 k2 = 03 k3 = 066 andk4 = 002 (Jenkinsonet al 1990 Coleman and Jenkinson 1999) The value ofthe transfer coefficients is determined by a function of soiltexture For the microbial biomass pool transfer coefficientsare calculated as

a3j = kj

046

x + 1(22)

wherex is a value that determines the proportion of decom-posed material that is respired as CO2 and is given by

x = 167(185+ 160exp(minus00786pClay)) (23)

wherepClay is percent clay in mineral soil (Jenkinson et al1990) Similarly the transfer coefficients for the humifiedpool are given by

a4j = kj

054

x + 1 (24)

The partitioning of incoming plant material is determinedby the ratio DPMRPM which in RothC is set as 144 There-foreγ = 059 Now the basic structure of the RothC modelcan be written as

dC

dt= I

059041

000

+

minus10 0 0 0 0

0 minus03 0 0 0102 003 minus059 001 0119 004 008 minus002 0

0 0 0 0 0

C1C2C3C4C5

(25)

The annual amount of inputs is set in the RothC model asI = 17 Mg C haminus1 yrminus1

With this parameterization it is possible to run the RothCmodel without varying environmental effects on decompo-sition rates and observe how the system approaches steady-state for the different pools (Fig4) Parameter values ini-tial conditions and litter inputs can be changed easily withinSOILR to compare different predictions from this model

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1055

0 100 200 300 400 500

05

1015

2025

Time (years)

Car

bon

stor

es (M

g Cha

minus1)

Pool 1 DPMPool 2 RPMPool 3 BIOPool 4 HUMPool 5 IOMTotal Carbon

Fig 4 Carbon accumulation for the different pools included in theRothC model DPM the decomposable plant material pool RPMresistant plant material BIO microbial biomass pool HUM humi-fied organic matterpool and IOM inert organic matter pool

44 Applications for large-scale modeling

R can handle a large variety of data structures which offersinteresting possibilities for the application of the functionsimplemented in SOILR One important type of data structureis spatial data with global coverage There is a large numberof R packages to import and manipulate spatial data whichfacilitates the technical aspects for running SOILR functionsat the global scale

As an example we show here a simple calculation of cli-mate decomposition indexes (CDIs) (Adair et al 2008) us-ing a global dataset of temperature precipitation and po-tential evapotranspiration available at 05 degree resolutionon NetCDF files from the WATCH dataset (Weedon et al2011) The input dataset contained monthly average tempera-ture precipitation and evapotranspiration for the period 1958to 2001 We calculated the CDIs as

CDI = ξ(t) = f (T )f (W) (26)

with f (T ) implemented by the functionfTCentury1 andf (W) by the functionfWCentury as described in Ta-ble 1 Results can be easily plotted on a map (Fig5) andexported again to NetCDF files Different combinations ofthe functions described in Table1 can be used to calculateCDIs (Adair et al 2008) and evaluate different hypothesesabout the response of decomposition rates to moisture tem-perature and other variables

Longitude

Latit

ude

02

04

06

08

Fig 5 Climate decomposition index (CDI) calculated as the prod-uct of a function of temperature (fTCentury1 ) and a function ofprecipitation and potential evapotranspiration (fWCentury ) us-ing monthly data from the WATCH dataset (Weedon et al 2011)

5 Discussion

Many models of soil organic matter decomposition have beenproposed previously and there even exist some open-sourcetools to implement some of these models (egEaster et al2007) We have developed a tool for implementing and run-ning a large variety of these models with the idea of facili-tating comparison among multiple models in an easy to useinterface In this section we discuss some of the advantagesand disadvantages of our approach

51 Parameter space and structural domain

Models of organic matter decomposition are basically hypo-thetical abstractions about the structure and dynamics of soilorganic matter The multitude of models previously devel-oped suggests that there exists a large number of hypothesesabout the structure and functioning of soil organic matterbut there is basically little consensus on whether one modelstructure (hypothesis) would have more support on observa-tions than other model structures (Manzoni and Porporato2009)

The majority of modeling studies have focused on findingthe set of parameter values of a particular model that bestfit some observed data This approach is useful and has pro-vided much insight on understanding the rates of soil organicmatter decomposition However from the perspective of as-sessing different hypotheses about the structure and dynam-ics of soil organic matter parameter estimation can only givea narrow view of the more complex spectrum resulting from

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1056 C A Sierra et al SOIL R v 10

the combination of structure domain and the parameter spaceof models

SOILR provides the possibility of assessing both modelstructure and parameter values broadening the spectrum ofideas that can be assessed within one single analytical frame-work

We believe this approach complements well and could beeven more powerful than previous approaches to assess per-formance of model structure with inter-comparisons amongdifferent modeling groups (egMelillo et al 1995 Wu andMcGechan 1998 Cramer et al 2001 Randerson et al2009) Multi-model inter-comparison projects do not neces-sarily cover the whole domain of model structures and maybe subject to important issues such as independence of codebias of the whole model ensemble inappropriate metrics todefine model performance etc (Knutti et al 2009 Knutti2010) SOILR can partially help to overcome some of theseproblems for assessing the performance of model structurethrough the option of using alternative functions to representthe same process Philosophically this approach is also sim-ilar to testing multiple working hypotheses

52 Model hierarchies and functional programing

The gap between simulations and understanding describedby Held (2005) is currently exacerbated by the continuousincrease in detail and complexity of simulation modelsHeld(2005) suggests that a way forward to close the gap be-tween simulations and understanding is by the developmentof model hierarchies in which large-scale complex modelsare particular cases of general models that are more amenablefor understanding of system structure and behavior

SOILR can also be viewed as a system for hierarchicalmodeling of soil processes Consider for example the envi-ronmental or external effects on decomposition rates whichhere are denoted by the termξ(t) In its more simple andgeneral case the external effects can be simply a constant(ξ(t) = c) that allows the understanding of model behaviorwithout changes in environmental conditions Simulationscan then be run with a changing environment for exam-ple with variable soil moisture (ξ(t) = f (W(t))) Soil mois-ture could depend on other variables such as precipitationand potential evapotranspiration (W(t) = f (P (t)PET(t)))which in turn can be dependent on other functions In thisform a hierarchy of models is build with the dependence ofdifferent functions on other functions

In terms of programing this concept of model hierarchiescan be easily implemented in a functional programing styleA function that performs certain tasks can have as its argu-ments other functions that perform other tasks These func-tions can be independent among each other so many differentfunctions that perform the same task can be available withinthe same modeling environment This is one of our goals withSOILR to provide a modeling environment that serves as arepository of different functions that can perform the same

task so their performance can be easily compared It also al-lows building soil organic matter decomposition models ina hierarchical framework because functions can have a largenumber of dependences on other functions creating a bridgebetween simple general models and detailed modeling con-structions under the same basic principles

53 Scope and limitations

Our approach to soil organic matter decomposition modelingwith SOILR may have some limitations One potential limi-tation is the use of a high-level programing language that canhave issues in terms of computational efficiency This couldbe an important problem if specific models structures witha large number of computations per time step are applied toa large number of points such as a large spatial grid Otherprograming languages such asC or Fortran may be moresuitable for these tasks although a good programing stylecan avoid many issues of computational efficiency inR It isimportant to keep in mind that the scope of SOILR is morefor the exploration of different model structures and hypothe-ses about soil processes rather than for large computationaltasks however some parallelization tools withinR could beused for this purpose We recommend that once a specificmodel structure is identified as useful for a large computa-tion the entire model object is translated to other languageor optimized for running inR We are exploring these possi-bilities to include in future releases of SOILR

Another potential limitation is the incompatibility of ourconceptual framework to represent the decomposition pro-cess as a non-linear dynamical system Non-linear dynamicsare important for representing microbial processes such aspriming and are very relevant for simulations at short timescales (Wutzler and Reichstein 2008 Manzoni and Porpo-rato 2007 2009) Non-linear models however can be eas-ily implemented inR with the deSolve package We areconsidering two possibilities to include non-linear dynamicalsystems within our theoretical framework One possibility isto provide a framework to specify and linearize non-linearsystems and solve the linear equations as presented here An-other possibility is to include a set of non-linear models solv-ing them directly withdeSolve We aim for further releasesto include this additional functionality

6 Conclusions

We have developed a modeling environment for represent-ing the process of soil organic matter decomposition Thistool SOILR is an open- source package for the implemen-tation and testing of different representations of the processof soil organic matter decomposition The main character-istic of SOILR is its hierarchical structure in which we de-scribe a general model that can accommodate any possiblemodel structure of a multi-pool model of decomposition

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1057

More detailed models can be implemented to simulate spe-cific controls on the decomposition process This allows fortesting of multiple working hypotheses about the structureand functioning of soils and their behavior over time SOILRnot only allows for exploring dynamics on the parameterspace of a model but also on the structural domain

This first version of SOILR allows simulations of organicmatter decomposition and future versions will include rep-resentations of other biogeochemical elements such as nitro-gen and phosphorus as well as their isotopic composition Amodule for parameter fitting will also be included in futurereleases

Appendix A

Implementation details and design decisions regardingSOIL R

A1 The choice of the object-oriented programing(OOP) system

While in object oriented languages the implementation of ob-ject oriented design principles is usually hardwired inR itis a choice between at least three different approaches thusforcing the user to explain why a particular system was usedIn our case the choice ofS4 is a compromise On one handthere is very limited support inS4 for real encapsulation ex-pressed most notably by the possibility to read and even writethe values of slots from outside the class by theslot func-tion or theoperator respectively This default behavior isactually not even trivially changed On the other hand thereare some important advantages

1 Compatibility with the functional paradigm ofR and itsassociated benefits such as lazy evaluation concurrencyand in the future maybe even automatic parallelizationwhich depends on the absence of side effects (unavoid-able with a reference based system likeR5)

2 The integration withRrsquos standard library which in-creases

a the probability of future maintenance and

b acceptance by otherR users

3 The relative seamless integration to commonR work-flows without in depth knowledge of object orientedprograming

Considering that ifR is capable to implement an OOPsystem by means of on board tools it will probably be flexibleenough to change the default behavior of this OOP systemwith on board tools as well SOILR is a rather small packageand we thinkS4 is and appropriate choice for our needs

A2 Comparison betweenSIMECOL and SOIL R

SIMECOL (Petzoldt and Rinke 2007) an R package for theimplementation of ecological models is an alternative to ourown implementation Here we compare the two approachesin terms of their design

A21 Scope

SOILR is focused solely on soil organic matter decompo-sition while SIMECOL aims to be a general framework forecological modeling inR SIMECOL represents an abstrac-tion level somewhere between SOILR andRrsquos S4 systemHence the obvious way for SOILR to make use ofSIMECOL

would be to implement ourModel class as a subclass ofSIMECOL rsquos simObj One motivation to do so consists in thepossibility to inherit functionality from the ancestor which isusually additionally shared by other subclasses thus enablingeasier communication between them Whether subclassing isthe appropriate strategy thus depends on the amount of in-heritable code and the number of subclasses We found thatwithin SOILR Model would be the only one subclass ofSIMECOLrsquos model with nearly no code shared owing to dif-ferences in functionality and design goals (see below)

A22 Functionality

One major difference withSIMECOLrsquos simObj is thatSOILRrsquos Model initialize method requires objects of classTimeMap or its subclasses thus guaranteeing that the dif-ferent objects conforming a model share a common supportin the time domain even if the creation ofTimeMap ob-jects usually takes place far away from the initialization of aModel object since this usually happens behind the sceneseg by conversion ofdataframes the user provides asinput This is a significant difference fromSIMECOLrsquos ap-proach Implementing this functionality in a subclass ofSIMECOLrsquos model would be misleading and would not con-form well with our design goals

A23 Design goals

The main aim of SOILRrsquos Model class is to provide a fencebetween interface and implementation While the interfaceshould change as little as possible to protect code using theclass we want to have as much freedom as possible to changeits implementation We strive to achieve this by avoiding ev-ery possible syntactic distinction between references to ob-ject data and object methods from the outside WithRrsquos S4system one (and maybe the only) way to do so is to wrapall access to object data with get and set methods This isone aspect of a concept often referred to asencapsulationand regarded as one of the key components of OOP In lan-guages such asSmalltalk (Kay 1993) or Ruby (Matsumotoand Ishituka 2002) fully dedicated to OOP this approach ismandatory A method call (a message send to an object) is

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1058 C A Sierra et al SOIL R v 10

the one and only way for objects to communicate with eachother

The S4 approach inR is much less strict and allowsdirect manipulation of the data belonging to an object bymeans of the operator(or the slot function respectively)thus revealing the implementation of an object to the out-side code using this object User code based onwill breakif the implementation changes and the desired slot disap-pears while a get method may be able to retrieve the de-sired information from other data The use of the slot op-erator from outside should therefore be avoided (Genolini2008 Gentleman 2003) Imagine for instance acircle ob-ject c thatstoresits radius andcomputesthe diameter whengetDiameter(c) is called If the radius is accessed solelyby calls ofgetRadius(c) the implementation of the circleclass can later be changed to store the diameter and computethe radiuswithoutany affect to outside code using the class

Applications to SOILRrsquosModel occur if one considers theincreasing number of constructors with redundant parametersets The distinction between parameters and derived vari-ables may even become difficult Differing fromSIMECOL

we unify access toModel elements and avoid a syntacticdifference of parameters and derived values as expressed bySIMECOLrsquos functionsparams andout In addition to theget functions we provide for all data intended to be ac-cessed from outside access through the typical operators[]and$ for our Model class This gives access to all data themodel can provide either during the initialization or com-puted by the methods of the class In fact[] and $ inter-nally use theget methods and may perform any numberof checks and computations to provide a consistent outputThis facility is powerful enough to avoid the use ofcom-pletely for our class This is exactly our intention since theimplementation of the class may change accessing its ele-ments viais strongly discouraged While we will maintainthe defined interface via[] $ and theget functionswe cannot guarantee that code relying onwill work in fu-ture versions of SOILR

Another difference withSIMECOL is also related to the[]operator It enables the user to create the desired output ondemand thus avoiding duplication between output objectsIf the user asks forC shehe getsC and nottimeandC which sometimes may not be intended if the user isconcerned about issues of memory or duplication Howeverit may be very useful to have both in other situations whenthe times argument to the constructor that created themodel in the first place is not available anymore With[]the user can decide which fields the output should contain

An additional intended feature of our[] operator is to al-ways producedataframes and not aResult objectthat would (or at least should) be more protective of its dataagainst alterations post simulation than adataframe Ifwe provided code to post-process results we would certainlyimplement such aResult class to make sure that ourpost-processing is based on valid data Since at the moment

we donrsquot we also do not force a structured output object tothe user

At the moment we do not even provide output asdeSolve objects since every structured output is part of theinterface and may be relied on by user code Although weare happy and thankful to usedeSolve extensively withinSOILR making it a part of the interface would be a promiseto the user that we will keep on supporting it which is a muchbigger commitment

Until now the responsibility beyond the scope of classModel stays with the user

Supplementary material related to this article isavailable online athttpwwwgeosci-model-devnet510452012gmd-5-1045-2012-supplementzip

AcknowledgementsFinancial support for the development of thisproject was provided by the Max Planck Society We would like tothank Ulrich Weber and Martin Jung for providing global climatedata used in the example Maarten Braakhekke provided helpfulcomments on a previous version of this manuscript

The service charges for this open access publicationhave been covered by the Max Planck Society

Edited by S Arndt

References

Adair E Parton W Del Grosso S Silver W Harmon MHall S Burke I and Hart S Simple three-pool modelaccurately describes patterns of long-term litter decomposi-tion in diverse climates Glob Change Biol 14 2636ndash2660doi101111j1365-2486200801674x 2008

Agren G and Bosatta E Theoretical ecosystem ecology under-standing element cycles Cambridge University Press 1998

Andren O and Katterer T ICBM The Introductory Carbon Bal-ance Model for Exploration of Soil Carbon Balances EcolAppl 7 1226ndash1236httpwwwjstororgstable2641210 1997

Bolker B M Pacala S W and Parton W J Linearanalysis of soil decomposition insights from the CEN-TURY model Ecol Appl 8 425ndash439doi1018901051-0761(1998)008[0425LAOSDI]20CO2 1998

Bruun S Six J Jensen L and Paustian K Estimating turnoverof soil organic carbon fractions based on radiocarbon measure-ments Radiocarbon 47 99ndash113 2008

Burger M Juenemann K and Koenig T RUnit R Unit testframework R package version 04 25 2009

Burke I Kaye J Bird S Hall S McCulley R and Som-merville G Evaluating and testing models of terrestrial biogeo-chemistry the role of temperature in controlling decompositionModels in ecosystem science Princeton University Press Prince-ton New Jersey USA 225ndash253 2003

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

1048 C A Sierra et al SOIL R v 10

among compartments (Swift et al 1979 Bruun et al 2008Manzoni and Porporato 2009) Different model structuresare determined by the matrixA in linear dynamical systems(Bolker et al 1998 Manzoni et al 2009) For instance theparallel or pure decay structure (Fig1) in compartment mod-els is defined by a diagonal matrix of the form

A =

minusk1 0 middot middot middot 0

0 minusk2 middot middot middot 0

0 0 middot middot middot minuskm

where the entries in the diagonal represent the decompositionratekj for each compartmentj A required condition is thatall kj ge 0

Compartments connected in series (Fig1) can be repre-sented with a matrix of the form

A =

minusk1 0 0 middot middot middot 0a21 minusk2 0 middot middot middot 00 a32 minusk3 middot middot middot 0

0 0 0 middot middot middot minuskm

where the entriesaij are the transfer coefficients of materialfrom poolj to pooli A required condition is that allaij ge 0

Similarly feedback between adjacent compartments(Fig 1) is defined by a matrix of the form

A =

minusk1 a12 0 0 middot middot middot 0a21 minusk2 a23 0 middot middot middot 00 a32 minusk3 a34 middot middot middot 00 0 a43 minusk4 middot middot middot 0

0 0 0 0 middot middot middot minuskm

(7)

More complex model structures are created by replacingzero entries in the matrixA representing transfers betweendifferent compartmentsi andj

An important characteristic of the entriesaij is that theyare proportional to the decomposition rate ieaij = αijki whereαij represents the proportion of the decompositionrate that is transferred to pooli from pool j Furthermore0 le αij le 1 and the column sum

sumi αij le 1 with

rj = 1minus

sumi

αij (8)

representing the proportion of the decomposed material thatgets released from the system from poolj

24 The environmental termξ(t)

The majority of organic matter decomposition models in-clude functionsf (x) that modify decomposition rates ac-cording to a set of time-varying environmental conditions

No Pools 1 2 3

Parallel

Series

Feedback

Fig 1Basic model structures implemented in SOILR Squares rep-resent the compartments and arrows represent inputs and outputsto and from the compartments These model structures are specialcases of the matrixA

x1(t) xn(t) such as temperature moisture evapotranspi-ration etc (Burke et al 2003 Adair et al 2008) In ourmodel (Eq6) the representation of these environmental ef-fects is done with the termξ(t) which is the result of theevaluation of the function or set of functionsf (xi(t)) yield-ing a scalar value that can be directly multiplied to the matrixA In this case

ξ(t) = f (x1(t) xn(t)) (9)

The values off (xi(t)) are determined by different func-tions that depend on temperature precipitation and other en-vironmental variables Time-dependence is therefore intro-duced with time series of these environmental variables asinput in the model SOILR contains a library of functionsthat calculate environmental effects on decomposition ratesbased on functions reported for different models (Table1)

More complex functions are also introduced in SOILR butare not included in Table1 due to space limitations The doc-umentation and help files of SOILR contain a more detaileddescription of all functions

25 Initial conditions

The linear dynamical system represented by Eq (6) hasmany different solutions but we are only interested in thesolution that satisfies

C(t = 0) = C0 (10)

whereC0 is amtimes1 vector with the value of carbon content inthe different compartmentsi C0 must be specified in SOILRto run any possible model structure

26 The vector of inputs

Inputs to the system from above and belowground compo-nents are represented by the vectorI (t) This vector can also

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1049

Table 1 Functions implemented in SOILR to represent the effects of temperatureT and moistureW on decomposition rates

f (x) Terms Function name Source

f (T ) =

Q(T minus10)1010 T mean temperature fTQ10

4791+exp( 106

T +183 )T monthly temperature (C) fTRothC Jenkinson et al(1990)(

TmaxminusTTmaxminusTopt

)02exp

(02263

(1minus

(TmaxminusT

TmaxminusTopt

)263))

T Tmax Toptmonthly average maximumand optimal temperature

fTCentury1 Burke et al(2003)

3439exp

(02263

(1minus

(TmaxminusT

TmaxminusTopt

)263)(

TmaxminusTTmaxminusTopt

)02)

T Tmax Toptmonthly average maximumand optimal temperature

fTCentury2 Adair et al(2008)

08exp(0095Ts) Ts Soil temperature fTDaycent1 Kelly et al (2000)

056+ (146arctan(π00309(Ts minus 157)))π Ts Soil temperature fTDaycent2 Parton et al (2001) Grossoet al(2005)

0198+ 0036T T monthly temperature fTlinear Adair et al(2008)

exp(30856

(1

5602 minus1

(T +273)minus22713

))T monthly temperature fTLandT Lloyd and Taylor(1994)

exp(minus3764+ 0204T (1minus 05T369)) T mean temperature fTKB Kirschbaum(1995)

exp((ln(Q10)10)(T minus 20)) T mean temperatureQ10temperature coefficient

fTDemeter Foley(2011)

exp(minus(T (Topt+ Tlag))Tshape)Q

(T minus10)1010 T Tmax Topt

monthly averagemaximum and optimaltemperature

fTStandcarb Harmon and Domingo(2001)

f (W) =

11+30exp(minus85W)

W = PPETP monthly precipitation PETmonthly potentialevapotranspiration

fWCentury Parton et al(2001) Adair et al(2008)

(Wminusbaminusb

)d((bminusa)(aminusc)) (Wminuscaminusc

)dW water filled pore spacea b c dempirical coefficients

fWDaycent1 Kelly et al (2000)

5(0287) + (arctan(π0009(RWC minus 1747))π) W volumetric water content fWDaycent2 Grosso et al(2005)

025+ 075(MMsat) M soil moistureMsatsaturated soil mositure

fWDemeter Foley(2011)

(1minus exp(minus(3Mmin)(M + a)))b exp(minus(M(Mmax+ c))d ) M Mmin Mmax average minimumand maximum moisturecontent in litter poolabcd empirical coefficients

fWStandcarb Harmon and Domingo(2001)

be expressed as

I (t) = I (t)

γ1

γi

γm

(11)

whereI (t) is a time-dependent scalar representing the totalamount of inputs and the coefficientsγi represent the par-titioning among the different pools In this representation0 le γi le 1 and

summi=1γi = 1

27 Carbon release

A variable of interest in modeling soil organic matter decom-position is the amount of carbon leaving the system over time

either in the form of CO2 gas or as dissolved organic carbonWe represent this flux with the general termr which is givenby

r = RC(t) (12)

wherer is amtimes1 vector containing the instantaneous releaseof carbon for all pools andR is amtimesm diagonal matrix withthe release coefficientsrj in its diagonal calculated from (8)

28 Analytical solution

Analytical solutions to Eq (5) are implemented in SOILRonly with the purpose of testing the performance of the nu-merical methods However we can only test cases under cer-tain simplifications of the general model of Eq (5) In partic-ular for a homogeneous system with constant coefficientswhich is analogous to the decomposition of a single cohort

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1050 C A Sierra et al SOIL R v 10

of organic matter (Agren and Bosatta 1998) Eq (5) simpli-fies to

dC(t)

dt= AC(t) (13)

With initial conditions as in Eq (10) the analytical solu-tion to this problem is given by

C(t) = eA(tminust0)C0 (14)

If I (t) is not identically zero then the solution of the linearsystem

dC(t)

dt= I (t) + AC(t)

with initial conditions as in Eq (10) is given by

C(t) = eA(tminust0)C0 +

tintt0

eA(tminusτ)I (τ )dτ (15)

3 Numerical implementation

The solution to the dynamical system described by Eq (6) isdiscretized over time withh denoting the time step andn thenumber of steps The time steph may or may not be constantInitial conditions are given at timet0 = 0 The solution to thesystem is then given by

Cn+1 = Cn + Dr [fprime(Cn)h] (16)

whereDr [fprime(Cn)h] is anr order finite difference approxi-

mation to the system of ODEs of Eq (6) for each time steph(LeVeque 2007) in other words an ODE solver

The choice for the ODE solver is flexible in SOILR Cur-rently we provide the option to use a simple Euler forwardmethod or an interface to thedeSolve package ofSoetaertet al (2010) The functiondeSolvelsodawrapperin SOILR is a wrapper to the functionlsoda in packagedeSolve

31 TheModel class

The general numerical model described by Eq (6) is rep-resented in SOILR by an object oriented design centeringaround the classModel Nearly all computations possible inSOILR are facilitated byModel itself or its building blocksThe class defines the information allModel objects containand how those objects behave when (generic) functions areapplied to them (Chambers 2008) Any model constructedwith SOILR provides then a stable and consistent interfacethat encapsulates details about its implementation This in-terface provide a number of advantages to the user

1 A level of abstraction close to the mathematical descrip-tion of the model being implemented focusing on thescientific content rather than on technical details

2 Stability of code generated by the user based on SOILRoutput We believe that the more essential and less re-dundant the interface the less likely it is to change infuture revisions

3 Safeguards against unreasonable (and therefore prob-ably unintentional) input from simple dimensionalchecks to mathematical consistency of all arguments ofthe general model described in Sects22through27

4 Smaller programs that are easier to read

Developers also benefit from this implementation design by

1 Freedom to change the implementation behind thescenes without breaking user code

2 Easier maintenance testing bug tracking and exceptionhandling by reduced duplication

Objects of classModel are initialized in SOILR by vari-ous functions which are listed with the commandModel Most of them provide shortcuts for the construction of stan-dard models such as those in Fig1 These functions usuallydo not require the user to consider the real building blocks ofaModel object but rather infer the needed information fromobjects more common inR such as data frames Howeverall these high-level functions callGeneralModel which isthe most general constructor The functionGeneralModelinitializes theModel object after applying various validitychecks but does not run the model itself which instead isdone by specific functions (methods) applied to objects ofclassModel

The functionGeneralModel takes five arguments rep-resenting a specific case of Eq (6)

1 A vector t which contains the time values where thesolution to the ODE system is sought It can be of anylength but must be of classnumeric

2 An object of classTimeMap which implements thematrix A of Eq (5) as a function of time (including itsdomain) thus allowing the same level of abstraction asthe most general ODE solvers (Soetaert et al 2010)The classTimeMap is native to SOILR and simply ex-tends a commonR function to a mathematical validfunction definition that includes the time domain wherethe function is defined Thus it contains the necessaryinformation to prevent extrapolations beyond the rangeof input data Details aboutTimeMap are discussed inAppendixA

3 A vector of classnumeric containing the initialvaluesC0 of the ODE system

4 Again an object of classTimeMap containing theinputs I (t) to the system as a vector valued functionof time The length of this vector must be equal to thedimension of the matrixA and is checked as well as thetime domain

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1051

5 A string choosing the solver to be used

Once a new object of classModel is intialized from a callto GeneralModel or one of its various wrappers the newobject can be queried by several generic functions For ex-ample to obtain the amount of carbon over time solving thesystem of ODEs any object of classModel (and thereforeall its subclasses) can be used as argument of the functiongetC The call to this function returns an times m matrix withthe amount of carbon for each poolm at each time stepnSimilarly to obtain the amount of carbon release over timethe functiongetReleaseFlux can be called with any ob-ject of classModel as argument The result will be an times m

matrix with the amount of released carbon for each poolm

at each time stepn It is also possible to use the typical op-erators[ ] and $ for our Model class given access tomethods even easier For examplegetC(mod) is equiva-lent tomod$Cand something like

df=asdataframe(cbind(getTime(mod)getC(mod)))

can also be expressed as

df=mod[c(time C)]

This avoids the necessity of the somewhat dangerous use ofthe operator in user code which we strongly discouragesince it attaches the code to implementational details thatmay change in the future

The implementation of specific models as subclasses ofModel with methods for the generic functions will allow theintegration of new functionality without major modificationsto our current implementation For example once nutrientcycling and isotope dynamics are incorporated into SOILRnew methods will be developed independently without majormodifications to the current implementation of carbon stocksand release

The vignette GeneralModel provided with SOILRpresents some further insight in the implementation of spe-cific model structures with the help of the general tool-setprovided by theModel class The examples therein mayalso serve as templates to implement new model structuresas desired by the user Examples on how to use these modelstructures as a function are presented in Sect4

32 Version control system unit testing and automaticdocumentation

The development of SOILR is aided by a significant amountof existing open- source software To solve the ordinary dif-ferential equations produced by our framework we rely onthe well tested and documenteddeSolve package devel-oped bySoetaert et al(2010) We also use the open-sourcesymbolic python library SymPy (SymPy Development Team2008) to compute analytical solutions for the models forwhich this is possible The analytical solutions obtained from

SymPy are used to automatically create unit tests for SOILRTo constantly run these tests we use another open-sourcesoftware theRunit package (Burger et al 2009) The testsare distributed with the release version of SOILR and thusadd to the transparency of its development In addition weuseSweave (Leisch 2002 2003) and theinlinedocspackage (Hocking et al 2012) to produce documentationand encourage a literate programing style (Knuth 1984)As a version control system we use Mercurial (OrsquoSullivan2009) and the Trac (Edgewall Software 2011) online projectmanagement tool which includes ticket system wiki andonline access to our source code

33 Documentation

There are different types of documentation for SOILR Thefirst source of information is this document which intro-duces the science and some general technical details Asecond source of information is the documentation to eachfunction provided within the package itself To view thisdocumentation the user only needs to openR and typehelpstart() This will open a help window on a web-browser There the user only needs to go to PackagesSoilR toview a list of all the functions implemented Clicking on eachfunction will show details about the arguments of each func-tion and examples on how to use them For specific functionsthe user can also just type the name of the function precededby the question mark on theR command shell For exampletyping TwopParallelModel in the R command shellwill open a help window with the description of the functionTo view the source code of the function the user only needsto type the name of the function (without the question mark)on theR command shell

A third source of information are the so called Package Vi-gnettes These are short documents illustrating the use of thepackage for specific purposes Currently we provide one vi-gnette with version 10 of SOILR This vignette illustratesthe implementation of any model structure within SOILRFor future versions we will provide vigenettes about fittingspecific model structures to data and how to use SOILR formodeling radiocarbon

34 Installing and loading SOIL R

SOILR can be obtained from the ComprehensiveR ArchiveNetwork (CRAN) the official repository forR packageswith mirrors in places all over the world Packages storedin CRAN can be downloaded directly from anR ses-sion It can also be obtained from R-Forge a repositoryfor package developers To install SOILR from CRANthe user simply needs to type in theR command shellinstallpackages(SoilR) To install from R-Forge the statement isinstallpackages(SoilRrepos=httpR-ForgeR-projectorg) After installing the package simply type

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1052 C A Sierra et al SOIL R v 10

library(SoilR) and the package is loaded intoyourR session

4 Examples

In this section we present examples on how to runsome of the functions implemented in SOILR basedon the theoretical framework presented previously Ad-ditional details about the implementations of each func-tion and instructions on how to implement new modelstructures are presented in the vignette lsquoImplementingCompartment Models in SOILR the GeneralModelFunctionrsquo provided with the package To view thisvignette simply typevignette(GeneralModelpackage=SoilR) in theR command shell

41 Implementation of a two pool model withconnection in series the ICBM model

One of the first models ever proposed to represent soil or-ganic matter dynamics was a two-pool model with connec-tion in series (cf Eq2 Henin et al 1959) More than50 yr laterAndren and Katterer(1997) proposed the ICBMmodel which is practically the same model proposed earlierby Henin et al(1959) but including a term for temperatureand moisture dependence of decomposition rates The set ofdifferential equations of the ICBM model are given by

dC1

dt= I minus k1ξC1

dC2

dt= αk1ξC1 minus k2ξC2 (17)

whereα is a humification or transfer coefficient andξ a pa-rameter representing external effects on decomposition ratesIn the ICBM modelC1 represents a ldquoyoungrdquo pool andC2 anldquooldrdquo pool This set of equations can be rewritten using ourmodel formulation which gives

dC

dt= I

(10

)+ ξ

(minusk1 0αk1 minusk2

)(C1C2

) (18)

with initial conditions(C10C20)T and where

A =

(minusk1 0a21 minusk2

)

with a21 = αk1 γ = 1 andξ(t) = ξ The function ICBMModel in SOILR implements this

model structure requiring as its arguments (1) a vector ofany length with the points in time when we are interested infinding a solution (2) a column vector of decomposition rates(k1k2)

T (3) the value ofα (4) the value ofξ (5) a columnvector with the initial amount of carbon at the beginning ofsimulation(C10C20)

T and (6) the mean annual carbon in-put to the soilI Andren and Katterer(1997) provided values

for these arguments from a 35-yr field experiment manipu-lating carbon and nitrogen inputs to an agricultural soil inSweden For the case of a treatment in which the soil wasleft as bare fallow without N or C inputs the ICBM modelcan be parameterized as

dC

dt= 0

(10

)+ 132

(minus08 0

013times 08 minus000605

)(C1C2

) (19)

with initial conditions(03396)T Assuming SOILR is already installed it is only necessary

to write the following lines of code to run the ICBM model

library(SoilR)times=seq(020by=01)Bare=ICBMModel(t=times ks=c(k1=08

k2=000605) h=013 r=132c0=c(C10=03C20=396) In=0)

The call toICBMModel simply initialize the model andchecks for consistency on its arguments In this example thedecomposition rates are given in units of yearminus1 and the ini-tial amounts of carbon in units of kg C mminus2

To obtain the amount of carbon over time it is necessary toinvoke the functiongetC storing the output into an objectFor example to store the amount of carbon from the objectBare the user can type

CtBare=getC(Bare)

This new objectCtBare is a matrix with 2 columns(2 pools) and 201 rows (201 points in time from 0 to 20in increments of 01) To obtain the total amount of carbonie the sum of the pools the R functionrowSums can beused For example plotting the total amount of carbon overtime as well as the carbon on each pool only requires theselines of code

plot(times rowSums(CtBare)type=lylim=c(05) ylab=Topsoil carbonmass (kg m-2)xlab=Time (years)lwd=2)

lines(times CtBare[1]lty=2)lines(timesCtBare[2]lty=3col=2lwd=2)legend(toprightc(Total carbon

Carbon in pool 1 Carbon in pool 2)lty=c(123)col=c(112)lwd=c(212)bty=n)

If the total amount of carbon is needed for further calcula-tions the output ofrowSums() can be stored in an objectwith any name

We implemented the different N and C treatments reportedin Andren and Katterer(1997) from the set of parametersreported by those authors The code necessary to reproduceFig 2 inAndren and Katterer(1997) is provided as an exam-ple with the functionICBMModel and can be accessed by

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1053

0 5 10 15 20

02

46

8

Time (years)

Tops

oil c

arbo

n m

ass

(kg

m-2

)

Bare fallow+N +Straw-N +Straw-N -Straw+N -StrawManureSludge

Fig 2 Model predictions with the version of the ICBM modelimplemented in SOILR This graph reproduces Fig 2 inAn-dren and Katterer(1997) This figure can be reproduced typ-ing example(ICBMModel) or attr(ICBMModelex) inSOILR

typing example(ICBMModel) or from the html help inR This code produces Fig2 which is identical to Fig 2 inAndren and Katterer(1997)

42 Alternative two-pool models

The ICBM model described in the previous section althoughuseful does not offer too much flexibility in terms of the in-put arguments For example the litter inputs to the systemcould vary over time as well as the temperature and moistureeffects on decomposition rates In addition there are otherpossibilities to implement a two pool model depending onthe type of connection between pools (Fig1)

The parallel pool model structure can be implemented withthe functionTwopParallelModel while a more gen-eral version of a series model structure can be implementedwith the functionTwopSeriesModel Similarly the feed-back model structure can be implemented with the functionTwopFeedbackModel The inputs of litter and the mod-ification of decomposition rates by external factors can beeither constant or a function of time Furthermore the func-tions presented in Table1 and their combinations can beused as arguments in the different model structures provid-ing a large variety of options to model decomposition withjust two pools In fact the same flexibility can be obtainedwith any number of pools with the application of the moregeneral functionGeneralModel

As an example we show the differences obtained by run-ning three different versions of a two-pool model with the

0 5 10 15 20

05

1015

20

Car

bon

stoc

ks (a

rbitr

ary

units

) Two-pool ParallelTwo-pool SeriesTwo-pool Feedback

0 5 10 15 20

00051015202530

Time

Car

bon

rele

ase

(arb

itrar

y un

its)

Fig 3 Examples of three different representations of a two-poolmodel with different model structures and environmental effects ondecomposition rates The upper panel shows carbon stocks and thelower panel carbon release Additional details about the implemen-tation are given in the text

same amount of carbon at the beginning of the simulationsimilar rates of litter inputs and equal decomposition rates(Fig 3) As an illustration we also ran the simulations withdifferent options for the time dependence of the litter inputsand the decomposition rates In the first simulation we ran amodel with a structure of parallel compartments In this sim-ulation the litter inputs and decomposition rates were con-stant but the decomposition rates were modified by averagevalues of temperature and moisture according to the func-tions proposed in the Daycent model (Table1) For the sec-ond simulation we ran a two-pool model with connectionin series introducing temporal variability in the amount ofinputs using a sine function that artificially represents an an-nual cycle In the third simulation we ran a two-pool modelwith connection in series among compartments The amountof litter inputs over time were calculated using random num-bers over time In this simulation we also produced ran-dom numbers of temperature and moisture and applied thefunctions to modify decomposition rates according to theCentury and the Demeter models (Fig3) The code to re-produce Fig3 is provided in the example of the functionTwopFeedbackModel

These simulations without being necessarily realisticsimply show that small differences in model structure canproduce very different predictions even when the main pa-rameters of the model remain unchanged The simulationsalso serve to illustrate different possibilities in the use of the

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1054 C A Sierra et al SOIL R v 10

basic functions of SOILR to represent the process of organicmatter decomposition over time

To implement more sophisticated models with a higher de-gree of complexity it is possible to specify a larger amount ofpools with complex functions representing the dependence oflitter inputs decomposition rates and transfer between poolswith other external variables such as temperature moisturesoil texture nutrient status among many other

43 Implementation of the RothC model

RothC is a popular and widely used model for predicting or-ganic matter dynamics over time Although earlier versionsof the model included five active pools and one inert pool(Jenkinson and Rayner 1977) more recent versions only in-clude four active pools plus the inert pool (Jenkinson et al1990) RothC is implemented within SOILR and we providedetails here about this implementation to illustrate the useand potential implementation of any other model RothC canbe described by the following set of differential equations

dC1

dt= γ I minus k1C1

dC2

dt= (1minus γ )I minus k2C2

dC3

dt= α31k1C1 + α32k2C2 minus k3C3 + α33k3C3 + α34k4C4

dC4

dt= α41k1C1 + α42k2C2 + α43k3C3 minus k4C4 + α44k4C4

dC5

dt= 0 (20)

whereC1 represents the decomposable plant material (DPM)poolC2 the resistant plant material (RPM) poolC3 the mi-crobial biomass (BIO) poolC4 the humified organic matter(HUM) pool andC5 the inert organic matter pool (IOM)This set of equations can be rewritten in the form

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0α31k1 α32k2 minusk3(1minus α33) α34k4 0α41k1 α42k2 α43k3 minusk4(1minus α44) 0

0 0 0 0 0

C1C2C3C4C5

or as

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0a31 a32 minusk3 + a33 a34 0a41 a42 a43 minusk4 + a44 00 0 0 0 0

C1C2C3C4C5

(21)

The values of the decomposition rates are constant and givenby k1 = 10 k2 = 03 k3 = 066 andk4 = 002 (Jenkinsonet al 1990 Coleman and Jenkinson 1999) The value ofthe transfer coefficients is determined by a function of soiltexture For the microbial biomass pool transfer coefficientsare calculated as

a3j = kj

046

x + 1(22)

wherex is a value that determines the proportion of decom-posed material that is respired as CO2 and is given by

x = 167(185+ 160exp(minus00786pClay)) (23)

wherepClay is percent clay in mineral soil (Jenkinson et al1990) Similarly the transfer coefficients for the humifiedpool are given by

a4j = kj

054

x + 1 (24)

The partitioning of incoming plant material is determinedby the ratio DPMRPM which in RothC is set as 144 There-foreγ = 059 Now the basic structure of the RothC modelcan be written as

dC

dt= I

059041

000

+

minus10 0 0 0 0

0 minus03 0 0 0102 003 minus059 001 0119 004 008 minus002 0

0 0 0 0 0

C1C2C3C4C5

(25)

The annual amount of inputs is set in the RothC model asI = 17 Mg C haminus1 yrminus1

With this parameterization it is possible to run the RothCmodel without varying environmental effects on decompo-sition rates and observe how the system approaches steady-state for the different pools (Fig4) Parameter values ini-tial conditions and litter inputs can be changed easily withinSOILR to compare different predictions from this model

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1055

0 100 200 300 400 500

05

1015

2025

Time (years)

Car

bon

stor

es (M

g Cha

minus1)

Pool 1 DPMPool 2 RPMPool 3 BIOPool 4 HUMPool 5 IOMTotal Carbon

Fig 4 Carbon accumulation for the different pools included in theRothC model DPM the decomposable plant material pool RPMresistant plant material BIO microbial biomass pool HUM humi-fied organic matterpool and IOM inert organic matter pool

44 Applications for large-scale modeling

R can handle a large variety of data structures which offersinteresting possibilities for the application of the functionsimplemented in SOILR One important type of data structureis spatial data with global coverage There is a large numberof R packages to import and manipulate spatial data whichfacilitates the technical aspects for running SOILR functionsat the global scale

As an example we show here a simple calculation of cli-mate decomposition indexes (CDIs) (Adair et al 2008) us-ing a global dataset of temperature precipitation and po-tential evapotranspiration available at 05 degree resolutionon NetCDF files from the WATCH dataset (Weedon et al2011) The input dataset contained monthly average tempera-ture precipitation and evapotranspiration for the period 1958to 2001 We calculated the CDIs as

CDI = ξ(t) = f (T )f (W) (26)

with f (T ) implemented by the functionfTCentury1 andf (W) by the functionfWCentury as described in Ta-ble 1 Results can be easily plotted on a map (Fig5) andexported again to NetCDF files Different combinations ofthe functions described in Table1 can be used to calculateCDIs (Adair et al 2008) and evaluate different hypothesesabout the response of decomposition rates to moisture tem-perature and other variables

Longitude

Latit

ude

02

04

06

08

Fig 5 Climate decomposition index (CDI) calculated as the prod-uct of a function of temperature (fTCentury1 ) and a function ofprecipitation and potential evapotranspiration (fWCentury ) us-ing monthly data from the WATCH dataset (Weedon et al 2011)

5 Discussion

Many models of soil organic matter decomposition have beenproposed previously and there even exist some open-sourcetools to implement some of these models (egEaster et al2007) We have developed a tool for implementing and run-ning a large variety of these models with the idea of facili-tating comparison among multiple models in an easy to useinterface In this section we discuss some of the advantagesand disadvantages of our approach

51 Parameter space and structural domain

Models of organic matter decomposition are basically hypo-thetical abstractions about the structure and dynamics of soilorganic matter The multitude of models previously devel-oped suggests that there exists a large number of hypothesesabout the structure and functioning of soil organic matterbut there is basically little consensus on whether one modelstructure (hypothesis) would have more support on observa-tions than other model structures (Manzoni and Porporato2009)

The majority of modeling studies have focused on findingthe set of parameter values of a particular model that bestfit some observed data This approach is useful and has pro-vided much insight on understanding the rates of soil organicmatter decomposition However from the perspective of as-sessing different hypotheses about the structure and dynam-ics of soil organic matter parameter estimation can only givea narrow view of the more complex spectrum resulting from

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1056 C A Sierra et al SOIL R v 10

the combination of structure domain and the parameter spaceof models

SOILR provides the possibility of assessing both modelstructure and parameter values broadening the spectrum ofideas that can be assessed within one single analytical frame-work

We believe this approach complements well and could beeven more powerful than previous approaches to assess per-formance of model structure with inter-comparisons amongdifferent modeling groups (egMelillo et al 1995 Wu andMcGechan 1998 Cramer et al 2001 Randerson et al2009) Multi-model inter-comparison projects do not neces-sarily cover the whole domain of model structures and maybe subject to important issues such as independence of codebias of the whole model ensemble inappropriate metrics todefine model performance etc (Knutti et al 2009 Knutti2010) SOILR can partially help to overcome some of theseproblems for assessing the performance of model structurethrough the option of using alternative functions to representthe same process Philosophically this approach is also sim-ilar to testing multiple working hypotheses

52 Model hierarchies and functional programing

The gap between simulations and understanding describedby Held (2005) is currently exacerbated by the continuousincrease in detail and complexity of simulation modelsHeld(2005) suggests that a way forward to close the gap be-tween simulations and understanding is by the developmentof model hierarchies in which large-scale complex modelsare particular cases of general models that are more amenablefor understanding of system structure and behavior

SOILR can also be viewed as a system for hierarchicalmodeling of soil processes Consider for example the envi-ronmental or external effects on decomposition rates whichhere are denoted by the termξ(t) In its more simple andgeneral case the external effects can be simply a constant(ξ(t) = c) that allows the understanding of model behaviorwithout changes in environmental conditions Simulationscan then be run with a changing environment for exam-ple with variable soil moisture (ξ(t) = f (W(t))) Soil mois-ture could depend on other variables such as precipitationand potential evapotranspiration (W(t) = f (P (t)PET(t)))which in turn can be dependent on other functions In thisform a hierarchy of models is build with the dependence ofdifferent functions on other functions

In terms of programing this concept of model hierarchiescan be easily implemented in a functional programing styleA function that performs certain tasks can have as its argu-ments other functions that perform other tasks These func-tions can be independent among each other so many differentfunctions that perform the same task can be available withinthe same modeling environment This is one of our goals withSOILR to provide a modeling environment that serves as arepository of different functions that can perform the same

task so their performance can be easily compared It also al-lows building soil organic matter decomposition models ina hierarchical framework because functions can have a largenumber of dependences on other functions creating a bridgebetween simple general models and detailed modeling con-structions under the same basic principles

53 Scope and limitations

Our approach to soil organic matter decomposition modelingwith SOILR may have some limitations One potential limi-tation is the use of a high-level programing language that canhave issues in terms of computational efficiency This couldbe an important problem if specific models structures witha large number of computations per time step are applied toa large number of points such as a large spatial grid Otherprograming languages such asC or Fortran may be moresuitable for these tasks although a good programing stylecan avoid many issues of computational efficiency inR It isimportant to keep in mind that the scope of SOILR is morefor the exploration of different model structures and hypothe-ses about soil processes rather than for large computationaltasks however some parallelization tools withinR could beused for this purpose We recommend that once a specificmodel structure is identified as useful for a large computa-tion the entire model object is translated to other languageor optimized for running inR We are exploring these possi-bilities to include in future releases of SOILR

Another potential limitation is the incompatibility of ourconceptual framework to represent the decomposition pro-cess as a non-linear dynamical system Non-linear dynamicsare important for representing microbial processes such aspriming and are very relevant for simulations at short timescales (Wutzler and Reichstein 2008 Manzoni and Porpo-rato 2007 2009) Non-linear models however can be eas-ily implemented inR with the deSolve package We areconsidering two possibilities to include non-linear dynamicalsystems within our theoretical framework One possibility isto provide a framework to specify and linearize non-linearsystems and solve the linear equations as presented here An-other possibility is to include a set of non-linear models solv-ing them directly withdeSolve We aim for further releasesto include this additional functionality

6 Conclusions

We have developed a modeling environment for represent-ing the process of soil organic matter decomposition Thistool SOILR is an open- source package for the implemen-tation and testing of different representations of the processof soil organic matter decomposition The main character-istic of SOILR is its hierarchical structure in which we de-scribe a general model that can accommodate any possiblemodel structure of a multi-pool model of decomposition

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1057

More detailed models can be implemented to simulate spe-cific controls on the decomposition process This allows fortesting of multiple working hypotheses about the structureand functioning of soils and their behavior over time SOILRnot only allows for exploring dynamics on the parameterspace of a model but also on the structural domain

This first version of SOILR allows simulations of organicmatter decomposition and future versions will include rep-resentations of other biogeochemical elements such as nitro-gen and phosphorus as well as their isotopic composition Amodule for parameter fitting will also be included in futurereleases

Appendix A

Implementation details and design decisions regardingSOIL R

A1 The choice of the object-oriented programing(OOP) system

While in object oriented languages the implementation of ob-ject oriented design principles is usually hardwired inR itis a choice between at least three different approaches thusforcing the user to explain why a particular system was usedIn our case the choice ofS4 is a compromise On one handthere is very limited support inS4 for real encapsulation ex-pressed most notably by the possibility to read and even writethe values of slots from outside the class by theslot func-tion or theoperator respectively This default behavior isactually not even trivially changed On the other hand thereare some important advantages

1 Compatibility with the functional paradigm ofR and itsassociated benefits such as lazy evaluation concurrencyand in the future maybe even automatic parallelizationwhich depends on the absence of side effects (unavoid-able with a reference based system likeR5)

2 The integration withRrsquos standard library which in-creases

a the probability of future maintenance and

b acceptance by otherR users

3 The relative seamless integration to commonR work-flows without in depth knowledge of object orientedprograming

Considering that ifR is capable to implement an OOPsystem by means of on board tools it will probably be flexibleenough to change the default behavior of this OOP systemwith on board tools as well SOILR is a rather small packageand we thinkS4 is and appropriate choice for our needs

A2 Comparison betweenSIMECOL and SOIL R

SIMECOL (Petzoldt and Rinke 2007) an R package for theimplementation of ecological models is an alternative to ourown implementation Here we compare the two approachesin terms of their design

A21 Scope

SOILR is focused solely on soil organic matter decompo-sition while SIMECOL aims to be a general framework forecological modeling inR SIMECOL represents an abstrac-tion level somewhere between SOILR andRrsquos S4 systemHence the obvious way for SOILR to make use ofSIMECOL

would be to implement ourModel class as a subclass ofSIMECOL rsquos simObj One motivation to do so consists in thepossibility to inherit functionality from the ancestor which isusually additionally shared by other subclasses thus enablingeasier communication between them Whether subclassing isthe appropriate strategy thus depends on the amount of in-heritable code and the number of subclasses We found thatwithin SOILR Model would be the only one subclass ofSIMECOLrsquos model with nearly no code shared owing to dif-ferences in functionality and design goals (see below)

A22 Functionality

One major difference withSIMECOLrsquos simObj is thatSOILRrsquos Model initialize method requires objects of classTimeMap or its subclasses thus guaranteeing that the dif-ferent objects conforming a model share a common supportin the time domain even if the creation ofTimeMap ob-jects usually takes place far away from the initialization of aModel object since this usually happens behind the sceneseg by conversion ofdataframes the user provides asinput This is a significant difference fromSIMECOLrsquos ap-proach Implementing this functionality in a subclass ofSIMECOLrsquos model would be misleading and would not con-form well with our design goals

A23 Design goals

The main aim of SOILRrsquos Model class is to provide a fencebetween interface and implementation While the interfaceshould change as little as possible to protect code using theclass we want to have as much freedom as possible to changeits implementation We strive to achieve this by avoiding ev-ery possible syntactic distinction between references to ob-ject data and object methods from the outside WithRrsquos S4system one (and maybe the only) way to do so is to wrapall access to object data with get and set methods This isone aspect of a concept often referred to asencapsulationand regarded as one of the key components of OOP In lan-guages such asSmalltalk (Kay 1993) or Ruby (Matsumotoand Ishituka 2002) fully dedicated to OOP this approach ismandatory A method call (a message send to an object) is

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1058 C A Sierra et al SOIL R v 10

the one and only way for objects to communicate with eachother

The S4 approach inR is much less strict and allowsdirect manipulation of the data belonging to an object bymeans of the operator(or the slot function respectively)thus revealing the implementation of an object to the out-side code using this object User code based onwill breakif the implementation changes and the desired slot disap-pears while a get method may be able to retrieve the de-sired information from other data The use of the slot op-erator from outside should therefore be avoided (Genolini2008 Gentleman 2003) Imagine for instance acircle ob-ject c thatstoresits radius andcomputesthe diameter whengetDiameter(c) is called If the radius is accessed solelyby calls ofgetRadius(c) the implementation of the circleclass can later be changed to store the diameter and computethe radiuswithoutany affect to outside code using the class

Applications to SOILRrsquosModel occur if one considers theincreasing number of constructors with redundant parametersets The distinction between parameters and derived vari-ables may even become difficult Differing fromSIMECOL

we unify access toModel elements and avoid a syntacticdifference of parameters and derived values as expressed bySIMECOLrsquos functionsparams andout In addition to theget functions we provide for all data intended to be ac-cessed from outside access through the typical operators[]and$ for our Model class This gives access to all data themodel can provide either during the initialization or com-puted by the methods of the class In fact[] and $ inter-nally use theget methods and may perform any numberof checks and computations to provide a consistent outputThis facility is powerful enough to avoid the use ofcom-pletely for our class This is exactly our intention since theimplementation of the class may change accessing its ele-ments viais strongly discouraged While we will maintainthe defined interface via[] $ and theget functionswe cannot guarantee that code relying onwill work in fu-ture versions of SOILR

Another difference withSIMECOL is also related to the[]operator It enables the user to create the desired output ondemand thus avoiding duplication between output objectsIf the user asks forC shehe getsC and nottimeandC which sometimes may not be intended if the user isconcerned about issues of memory or duplication Howeverit may be very useful to have both in other situations whenthe times argument to the constructor that created themodel in the first place is not available anymore With[]the user can decide which fields the output should contain

An additional intended feature of our[] operator is to al-ways producedataframes and not aResult objectthat would (or at least should) be more protective of its dataagainst alterations post simulation than adataframe Ifwe provided code to post-process results we would certainlyimplement such aResult class to make sure that ourpost-processing is based on valid data Since at the moment

we donrsquot we also do not force a structured output object tothe user

At the moment we do not even provide output asdeSolve objects since every structured output is part of theinterface and may be relied on by user code Although weare happy and thankful to usedeSolve extensively withinSOILR making it a part of the interface would be a promiseto the user that we will keep on supporting it which is a muchbigger commitment

Until now the responsibility beyond the scope of classModel stays with the user

Supplementary material related to this article isavailable online athttpwwwgeosci-model-devnet510452012gmd-5-1045-2012-supplementzip

AcknowledgementsFinancial support for the development of thisproject was provided by the Max Planck Society We would like tothank Ulrich Weber and Martin Jung for providing global climatedata used in the example Maarten Braakhekke provided helpfulcomments on a previous version of this manuscript

The service charges for this open access publicationhave been covered by the Max Planck Society

Edited by S Arndt

References

Adair E Parton W Del Grosso S Silver W Harmon MHall S Burke I and Hart S Simple three-pool modelaccurately describes patterns of long-term litter decomposi-tion in diverse climates Glob Change Biol 14 2636ndash2660doi101111j1365-2486200801674x 2008

Agren G and Bosatta E Theoretical ecosystem ecology under-standing element cycles Cambridge University Press 1998

Andren O and Katterer T ICBM The Introductory Carbon Bal-ance Model for Exploration of Soil Carbon Balances EcolAppl 7 1226ndash1236httpwwwjstororgstable2641210 1997

Bolker B M Pacala S W and Parton W J Linearanalysis of soil decomposition insights from the CEN-TURY model Ecol Appl 8 425ndash439doi1018901051-0761(1998)008[0425LAOSDI]20CO2 1998

Bruun S Six J Jensen L and Paustian K Estimating turnoverof soil organic carbon fractions based on radiocarbon measure-ments Radiocarbon 47 99ndash113 2008

Burger M Juenemann K and Koenig T RUnit R Unit testframework R package version 04 25 2009

Burke I Kaye J Bird S Hall S McCulley R and Som-merville G Evaluating and testing models of terrestrial biogeo-chemistry the role of temperature in controlling decompositionModels in ecosystem science Princeton University Press Prince-ton New Jersey USA 225ndash253 2003

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1049

Table 1 Functions implemented in SOILR to represent the effects of temperatureT and moistureW on decomposition rates

f (x) Terms Function name Source

f (T ) =

Q(T minus10)1010 T mean temperature fTQ10

4791+exp( 106

T +183 )T monthly temperature (C) fTRothC Jenkinson et al(1990)(

TmaxminusTTmaxminusTopt

)02exp

(02263

(1minus

(TmaxminusT

TmaxminusTopt

)263))

T Tmax Toptmonthly average maximumand optimal temperature

fTCentury1 Burke et al(2003)

3439exp

(02263

(1minus

(TmaxminusT

TmaxminusTopt

)263)(

TmaxminusTTmaxminusTopt

)02)

T Tmax Toptmonthly average maximumand optimal temperature

fTCentury2 Adair et al(2008)

08exp(0095Ts) Ts Soil temperature fTDaycent1 Kelly et al (2000)

056+ (146arctan(π00309(Ts minus 157)))π Ts Soil temperature fTDaycent2 Parton et al (2001) Grossoet al(2005)

0198+ 0036T T monthly temperature fTlinear Adair et al(2008)

exp(30856

(1

5602 minus1

(T +273)minus22713

))T monthly temperature fTLandT Lloyd and Taylor(1994)

exp(minus3764+ 0204T (1minus 05T369)) T mean temperature fTKB Kirschbaum(1995)

exp((ln(Q10)10)(T minus 20)) T mean temperatureQ10temperature coefficient

fTDemeter Foley(2011)

exp(minus(T (Topt+ Tlag))Tshape)Q

(T minus10)1010 T Tmax Topt

monthly averagemaximum and optimaltemperature

fTStandcarb Harmon and Domingo(2001)

f (W) =

11+30exp(minus85W)

W = PPETP monthly precipitation PETmonthly potentialevapotranspiration

fWCentury Parton et al(2001) Adair et al(2008)

(Wminusbaminusb

)d((bminusa)(aminusc)) (Wminuscaminusc

)dW water filled pore spacea b c dempirical coefficients

fWDaycent1 Kelly et al (2000)

5(0287) + (arctan(π0009(RWC minus 1747))π) W volumetric water content fWDaycent2 Grosso et al(2005)

025+ 075(MMsat) M soil moistureMsatsaturated soil mositure

fWDemeter Foley(2011)

(1minus exp(minus(3Mmin)(M + a)))b exp(minus(M(Mmax+ c))d ) M Mmin Mmax average minimumand maximum moisturecontent in litter poolabcd empirical coefficients

fWStandcarb Harmon and Domingo(2001)

be expressed as

I (t) = I (t)

γ1

γi

γm

(11)

whereI (t) is a time-dependent scalar representing the totalamount of inputs and the coefficientsγi represent the par-titioning among the different pools In this representation0 le γi le 1 and

summi=1γi = 1

27 Carbon release

A variable of interest in modeling soil organic matter decom-position is the amount of carbon leaving the system over time

either in the form of CO2 gas or as dissolved organic carbonWe represent this flux with the general termr which is givenby

r = RC(t) (12)

wherer is amtimes1 vector containing the instantaneous releaseof carbon for all pools andR is amtimesm diagonal matrix withthe release coefficientsrj in its diagonal calculated from (8)

28 Analytical solution

Analytical solutions to Eq (5) are implemented in SOILRonly with the purpose of testing the performance of the nu-merical methods However we can only test cases under cer-tain simplifications of the general model of Eq (5) In partic-ular for a homogeneous system with constant coefficientswhich is analogous to the decomposition of a single cohort

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1050 C A Sierra et al SOIL R v 10

of organic matter (Agren and Bosatta 1998) Eq (5) simpli-fies to

dC(t)

dt= AC(t) (13)

With initial conditions as in Eq (10) the analytical solu-tion to this problem is given by

C(t) = eA(tminust0)C0 (14)

If I (t) is not identically zero then the solution of the linearsystem

dC(t)

dt= I (t) + AC(t)

with initial conditions as in Eq (10) is given by

C(t) = eA(tminust0)C0 +

tintt0

eA(tminusτ)I (τ )dτ (15)

3 Numerical implementation

The solution to the dynamical system described by Eq (6) isdiscretized over time withh denoting the time step andn thenumber of steps The time steph may or may not be constantInitial conditions are given at timet0 = 0 The solution to thesystem is then given by

Cn+1 = Cn + Dr [fprime(Cn)h] (16)

whereDr [fprime(Cn)h] is anr order finite difference approxi-

mation to the system of ODEs of Eq (6) for each time steph(LeVeque 2007) in other words an ODE solver

The choice for the ODE solver is flexible in SOILR Cur-rently we provide the option to use a simple Euler forwardmethod or an interface to thedeSolve package ofSoetaertet al (2010) The functiondeSolvelsodawrapperin SOILR is a wrapper to the functionlsoda in packagedeSolve

31 TheModel class

The general numerical model described by Eq (6) is rep-resented in SOILR by an object oriented design centeringaround the classModel Nearly all computations possible inSOILR are facilitated byModel itself or its building blocksThe class defines the information allModel objects containand how those objects behave when (generic) functions areapplied to them (Chambers 2008) Any model constructedwith SOILR provides then a stable and consistent interfacethat encapsulates details about its implementation This in-terface provide a number of advantages to the user

1 A level of abstraction close to the mathematical descrip-tion of the model being implemented focusing on thescientific content rather than on technical details

2 Stability of code generated by the user based on SOILRoutput We believe that the more essential and less re-dundant the interface the less likely it is to change infuture revisions

3 Safeguards against unreasonable (and therefore prob-ably unintentional) input from simple dimensionalchecks to mathematical consistency of all arguments ofthe general model described in Sects22through27

4 Smaller programs that are easier to read

Developers also benefit from this implementation design by

1 Freedom to change the implementation behind thescenes without breaking user code

2 Easier maintenance testing bug tracking and exceptionhandling by reduced duplication

Objects of classModel are initialized in SOILR by vari-ous functions which are listed with the commandModel Most of them provide shortcuts for the construction of stan-dard models such as those in Fig1 These functions usuallydo not require the user to consider the real building blocks ofaModel object but rather infer the needed information fromobjects more common inR such as data frames Howeverall these high-level functions callGeneralModel which isthe most general constructor The functionGeneralModelinitializes theModel object after applying various validitychecks but does not run the model itself which instead isdone by specific functions (methods) applied to objects ofclassModel

The functionGeneralModel takes five arguments rep-resenting a specific case of Eq (6)

1 A vector t which contains the time values where thesolution to the ODE system is sought It can be of anylength but must be of classnumeric

2 An object of classTimeMap which implements thematrix A of Eq (5) as a function of time (including itsdomain) thus allowing the same level of abstraction asthe most general ODE solvers (Soetaert et al 2010)The classTimeMap is native to SOILR and simply ex-tends a commonR function to a mathematical validfunction definition that includes the time domain wherethe function is defined Thus it contains the necessaryinformation to prevent extrapolations beyond the rangeof input data Details aboutTimeMap are discussed inAppendixA

3 A vector of classnumeric containing the initialvaluesC0 of the ODE system

4 Again an object of classTimeMap containing theinputs I (t) to the system as a vector valued functionof time The length of this vector must be equal to thedimension of the matrixA and is checked as well as thetime domain

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1051

5 A string choosing the solver to be used

Once a new object of classModel is intialized from a callto GeneralModel or one of its various wrappers the newobject can be queried by several generic functions For ex-ample to obtain the amount of carbon over time solving thesystem of ODEs any object of classModel (and thereforeall its subclasses) can be used as argument of the functiongetC The call to this function returns an times m matrix withthe amount of carbon for each poolm at each time stepnSimilarly to obtain the amount of carbon release over timethe functiongetReleaseFlux can be called with any ob-ject of classModel as argument The result will be an times m

matrix with the amount of released carbon for each poolm

at each time stepn It is also possible to use the typical op-erators[ ] and $ for our Model class given access tomethods even easier For examplegetC(mod) is equiva-lent tomod$Cand something like

df=asdataframe(cbind(getTime(mod)getC(mod)))

can also be expressed as

df=mod[c(time C)]

This avoids the necessity of the somewhat dangerous use ofthe operator in user code which we strongly discouragesince it attaches the code to implementational details thatmay change in the future

The implementation of specific models as subclasses ofModel with methods for the generic functions will allow theintegration of new functionality without major modificationsto our current implementation For example once nutrientcycling and isotope dynamics are incorporated into SOILRnew methods will be developed independently without majormodifications to the current implementation of carbon stocksand release

The vignette GeneralModel provided with SOILRpresents some further insight in the implementation of spe-cific model structures with the help of the general tool-setprovided by theModel class The examples therein mayalso serve as templates to implement new model structuresas desired by the user Examples on how to use these modelstructures as a function are presented in Sect4

32 Version control system unit testing and automaticdocumentation

The development of SOILR is aided by a significant amountof existing open- source software To solve the ordinary dif-ferential equations produced by our framework we rely onthe well tested and documenteddeSolve package devel-oped bySoetaert et al(2010) We also use the open-sourcesymbolic python library SymPy (SymPy Development Team2008) to compute analytical solutions for the models forwhich this is possible The analytical solutions obtained from

SymPy are used to automatically create unit tests for SOILRTo constantly run these tests we use another open-sourcesoftware theRunit package (Burger et al 2009) The testsare distributed with the release version of SOILR and thusadd to the transparency of its development In addition weuseSweave (Leisch 2002 2003) and theinlinedocspackage (Hocking et al 2012) to produce documentationand encourage a literate programing style (Knuth 1984)As a version control system we use Mercurial (OrsquoSullivan2009) and the Trac (Edgewall Software 2011) online projectmanagement tool which includes ticket system wiki andonline access to our source code

33 Documentation

There are different types of documentation for SOILR Thefirst source of information is this document which intro-duces the science and some general technical details Asecond source of information is the documentation to eachfunction provided within the package itself To view thisdocumentation the user only needs to openR and typehelpstart() This will open a help window on a web-browser There the user only needs to go to PackagesSoilR toview a list of all the functions implemented Clicking on eachfunction will show details about the arguments of each func-tion and examples on how to use them For specific functionsthe user can also just type the name of the function precededby the question mark on theR command shell For exampletyping TwopParallelModel in the R command shellwill open a help window with the description of the functionTo view the source code of the function the user only needsto type the name of the function (without the question mark)on theR command shell

A third source of information are the so called Package Vi-gnettes These are short documents illustrating the use of thepackage for specific purposes Currently we provide one vi-gnette with version 10 of SOILR This vignette illustratesthe implementation of any model structure within SOILRFor future versions we will provide vigenettes about fittingspecific model structures to data and how to use SOILR formodeling radiocarbon

34 Installing and loading SOIL R

SOILR can be obtained from the ComprehensiveR ArchiveNetwork (CRAN) the official repository forR packageswith mirrors in places all over the world Packages storedin CRAN can be downloaded directly from anR ses-sion It can also be obtained from R-Forge a repositoryfor package developers To install SOILR from CRANthe user simply needs to type in theR command shellinstallpackages(SoilR) To install from R-Forge the statement isinstallpackages(SoilRrepos=httpR-ForgeR-projectorg) After installing the package simply type

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1052 C A Sierra et al SOIL R v 10

library(SoilR) and the package is loaded intoyourR session

4 Examples

In this section we present examples on how to runsome of the functions implemented in SOILR basedon the theoretical framework presented previously Ad-ditional details about the implementations of each func-tion and instructions on how to implement new modelstructures are presented in the vignette lsquoImplementingCompartment Models in SOILR the GeneralModelFunctionrsquo provided with the package To view thisvignette simply typevignette(GeneralModelpackage=SoilR) in theR command shell

41 Implementation of a two pool model withconnection in series the ICBM model

One of the first models ever proposed to represent soil or-ganic matter dynamics was a two-pool model with connec-tion in series (cf Eq2 Henin et al 1959) More than50 yr laterAndren and Katterer(1997) proposed the ICBMmodel which is practically the same model proposed earlierby Henin et al(1959) but including a term for temperatureand moisture dependence of decomposition rates The set ofdifferential equations of the ICBM model are given by

dC1

dt= I minus k1ξC1

dC2

dt= αk1ξC1 minus k2ξC2 (17)

whereα is a humification or transfer coefficient andξ a pa-rameter representing external effects on decomposition ratesIn the ICBM modelC1 represents a ldquoyoungrdquo pool andC2 anldquooldrdquo pool This set of equations can be rewritten using ourmodel formulation which gives

dC

dt= I

(10

)+ ξ

(minusk1 0αk1 minusk2

)(C1C2

) (18)

with initial conditions(C10C20)T and where

A =

(minusk1 0a21 minusk2

)

with a21 = αk1 γ = 1 andξ(t) = ξ The function ICBMModel in SOILR implements this

model structure requiring as its arguments (1) a vector ofany length with the points in time when we are interested infinding a solution (2) a column vector of decomposition rates(k1k2)

T (3) the value ofα (4) the value ofξ (5) a columnvector with the initial amount of carbon at the beginning ofsimulation(C10C20)

T and (6) the mean annual carbon in-put to the soilI Andren and Katterer(1997) provided values

for these arguments from a 35-yr field experiment manipu-lating carbon and nitrogen inputs to an agricultural soil inSweden For the case of a treatment in which the soil wasleft as bare fallow without N or C inputs the ICBM modelcan be parameterized as

dC

dt= 0

(10

)+ 132

(minus08 0

013times 08 minus000605

)(C1C2

) (19)

with initial conditions(03396)T Assuming SOILR is already installed it is only necessary

to write the following lines of code to run the ICBM model

library(SoilR)times=seq(020by=01)Bare=ICBMModel(t=times ks=c(k1=08

k2=000605) h=013 r=132c0=c(C10=03C20=396) In=0)

The call toICBMModel simply initialize the model andchecks for consistency on its arguments In this example thedecomposition rates are given in units of yearminus1 and the ini-tial amounts of carbon in units of kg C mminus2

To obtain the amount of carbon over time it is necessary toinvoke the functiongetC storing the output into an objectFor example to store the amount of carbon from the objectBare the user can type

CtBare=getC(Bare)

This new objectCtBare is a matrix with 2 columns(2 pools) and 201 rows (201 points in time from 0 to 20in increments of 01) To obtain the total amount of carbonie the sum of the pools the R functionrowSums can beused For example plotting the total amount of carbon overtime as well as the carbon on each pool only requires theselines of code

plot(times rowSums(CtBare)type=lylim=c(05) ylab=Topsoil carbonmass (kg m-2)xlab=Time (years)lwd=2)

lines(times CtBare[1]lty=2)lines(timesCtBare[2]lty=3col=2lwd=2)legend(toprightc(Total carbon

Carbon in pool 1 Carbon in pool 2)lty=c(123)col=c(112)lwd=c(212)bty=n)

If the total amount of carbon is needed for further calcula-tions the output ofrowSums() can be stored in an objectwith any name

We implemented the different N and C treatments reportedin Andren and Katterer(1997) from the set of parametersreported by those authors The code necessary to reproduceFig 2 inAndren and Katterer(1997) is provided as an exam-ple with the functionICBMModel and can be accessed by

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1053

0 5 10 15 20

02

46

8

Time (years)

Tops

oil c

arbo

n m

ass

(kg

m-2

)

Bare fallow+N +Straw-N +Straw-N -Straw+N -StrawManureSludge

Fig 2 Model predictions with the version of the ICBM modelimplemented in SOILR This graph reproduces Fig 2 inAn-dren and Katterer(1997) This figure can be reproduced typ-ing example(ICBMModel) or attr(ICBMModelex) inSOILR

typing example(ICBMModel) or from the html help inR This code produces Fig2 which is identical to Fig 2 inAndren and Katterer(1997)

42 Alternative two-pool models

The ICBM model described in the previous section althoughuseful does not offer too much flexibility in terms of the in-put arguments For example the litter inputs to the systemcould vary over time as well as the temperature and moistureeffects on decomposition rates In addition there are otherpossibilities to implement a two pool model depending onthe type of connection between pools (Fig1)

The parallel pool model structure can be implemented withthe functionTwopParallelModel while a more gen-eral version of a series model structure can be implementedwith the functionTwopSeriesModel Similarly the feed-back model structure can be implemented with the functionTwopFeedbackModel The inputs of litter and the mod-ification of decomposition rates by external factors can beeither constant or a function of time Furthermore the func-tions presented in Table1 and their combinations can beused as arguments in the different model structures provid-ing a large variety of options to model decomposition withjust two pools In fact the same flexibility can be obtainedwith any number of pools with the application of the moregeneral functionGeneralModel

As an example we show the differences obtained by run-ning three different versions of a two-pool model with the

0 5 10 15 20

05

1015

20

Car

bon

stoc

ks (a

rbitr

ary

units

) Two-pool ParallelTwo-pool SeriesTwo-pool Feedback

0 5 10 15 20

00051015202530

Time

Car

bon

rele

ase

(arb

itrar

y un

its)

Fig 3 Examples of three different representations of a two-poolmodel with different model structures and environmental effects ondecomposition rates The upper panel shows carbon stocks and thelower panel carbon release Additional details about the implemen-tation are given in the text

same amount of carbon at the beginning of the simulationsimilar rates of litter inputs and equal decomposition rates(Fig 3) As an illustration we also ran the simulations withdifferent options for the time dependence of the litter inputsand the decomposition rates In the first simulation we ran amodel with a structure of parallel compartments In this sim-ulation the litter inputs and decomposition rates were con-stant but the decomposition rates were modified by averagevalues of temperature and moisture according to the func-tions proposed in the Daycent model (Table1) For the sec-ond simulation we ran a two-pool model with connectionin series introducing temporal variability in the amount ofinputs using a sine function that artificially represents an an-nual cycle In the third simulation we ran a two-pool modelwith connection in series among compartments The amountof litter inputs over time were calculated using random num-bers over time In this simulation we also produced ran-dom numbers of temperature and moisture and applied thefunctions to modify decomposition rates according to theCentury and the Demeter models (Fig3) The code to re-produce Fig3 is provided in the example of the functionTwopFeedbackModel

These simulations without being necessarily realisticsimply show that small differences in model structure canproduce very different predictions even when the main pa-rameters of the model remain unchanged The simulationsalso serve to illustrate different possibilities in the use of the

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1054 C A Sierra et al SOIL R v 10

basic functions of SOILR to represent the process of organicmatter decomposition over time

To implement more sophisticated models with a higher de-gree of complexity it is possible to specify a larger amount ofpools with complex functions representing the dependence oflitter inputs decomposition rates and transfer between poolswith other external variables such as temperature moisturesoil texture nutrient status among many other

43 Implementation of the RothC model

RothC is a popular and widely used model for predicting or-ganic matter dynamics over time Although earlier versionsof the model included five active pools and one inert pool(Jenkinson and Rayner 1977) more recent versions only in-clude four active pools plus the inert pool (Jenkinson et al1990) RothC is implemented within SOILR and we providedetails here about this implementation to illustrate the useand potential implementation of any other model RothC canbe described by the following set of differential equations

dC1

dt= γ I minus k1C1

dC2

dt= (1minus γ )I minus k2C2

dC3

dt= α31k1C1 + α32k2C2 minus k3C3 + α33k3C3 + α34k4C4

dC4

dt= α41k1C1 + α42k2C2 + α43k3C3 minus k4C4 + α44k4C4

dC5

dt= 0 (20)

whereC1 represents the decomposable plant material (DPM)poolC2 the resistant plant material (RPM) poolC3 the mi-crobial biomass (BIO) poolC4 the humified organic matter(HUM) pool andC5 the inert organic matter pool (IOM)This set of equations can be rewritten in the form

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0α31k1 α32k2 minusk3(1minus α33) α34k4 0α41k1 α42k2 α43k3 minusk4(1minus α44) 0

0 0 0 0 0

C1C2C3C4C5

or as

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0a31 a32 minusk3 + a33 a34 0a41 a42 a43 minusk4 + a44 00 0 0 0 0

C1C2C3C4C5

(21)

The values of the decomposition rates are constant and givenby k1 = 10 k2 = 03 k3 = 066 andk4 = 002 (Jenkinsonet al 1990 Coleman and Jenkinson 1999) The value ofthe transfer coefficients is determined by a function of soiltexture For the microbial biomass pool transfer coefficientsare calculated as

a3j = kj

046

x + 1(22)

wherex is a value that determines the proportion of decom-posed material that is respired as CO2 and is given by

x = 167(185+ 160exp(minus00786pClay)) (23)

wherepClay is percent clay in mineral soil (Jenkinson et al1990) Similarly the transfer coefficients for the humifiedpool are given by

a4j = kj

054

x + 1 (24)

The partitioning of incoming plant material is determinedby the ratio DPMRPM which in RothC is set as 144 There-foreγ = 059 Now the basic structure of the RothC modelcan be written as

dC

dt= I

059041

000

+

minus10 0 0 0 0

0 minus03 0 0 0102 003 minus059 001 0119 004 008 minus002 0

0 0 0 0 0

C1C2C3C4C5

(25)

The annual amount of inputs is set in the RothC model asI = 17 Mg C haminus1 yrminus1

With this parameterization it is possible to run the RothCmodel without varying environmental effects on decompo-sition rates and observe how the system approaches steady-state for the different pools (Fig4) Parameter values ini-tial conditions and litter inputs can be changed easily withinSOILR to compare different predictions from this model

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1055

0 100 200 300 400 500

05

1015

2025

Time (years)

Car

bon

stor

es (M

g Cha

minus1)

Pool 1 DPMPool 2 RPMPool 3 BIOPool 4 HUMPool 5 IOMTotal Carbon

Fig 4 Carbon accumulation for the different pools included in theRothC model DPM the decomposable plant material pool RPMresistant plant material BIO microbial biomass pool HUM humi-fied organic matterpool and IOM inert organic matter pool

44 Applications for large-scale modeling

R can handle a large variety of data structures which offersinteresting possibilities for the application of the functionsimplemented in SOILR One important type of data structureis spatial data with global coverage There is a large numberof R packages to import and manipulate spatial data whichfacilitates the technical aspects for running SOILR functionsat the global scale

As an example we show here a simple calculation of cli-mate decomposition indexes (CDIs) (Adair et al 2008) us-ing a global dataset of temperature precipitation and po-tential evapotranspiration available at 05 degree resolutionon NetCDF files from the WATCH dataset (Weedon et al2011) The input dataset contained monthly average tempera-ture precipitation and evapotranspiration for the period 1958to 2001 We calculated the CDIs as

CDI = ξ(t) = f (T )f (W) (26)

with f (T ) implemented by the functionfTCentury1 andf (W) by the functionfWCentury as described in Ta-ble 1 Results can be easily plotted on a map (Fig5) andexported again to NetCDF files Different combinations ofthe functions described in Table1 can be used to calculateCDIs (Adair et al 2008) and evaluate different hypothesesabout the response of decomposition rates to moisture tem-perature and other variables

Longitude

Latit

ude

02

04

06

08

Fig 5 Climate decomposition index (CDI) calculated as the prod-uct of a function of temperature (fTCentury1 ) and a function ofprecipitation and potential evapotranspiration (fWCentury ) us-ing monthly data from the WATCH dataset (Weedon et al 2011)

5 Discussion

Many models of soil organic matter decomposition have beenproposed previously and there even exist some open-sourcetools to implement some of these models (egEaster et al2007) We have developed a tool for implementing and run-ning a large variety of these models with the idea of facili-tating comparison among multiple models in an easy to useinterface In this section we discuss some of the advantagesand disadvantages of our approach

51 Parameter space and structural domain

Models of organic matter decomposition are basically hypo-thetical abstractions about the structure and dynamics of soilorganic matter The multitude of models previously devel-oped suggests that there exists a large number of hypothesesabout the structure and functioning of soil organic matterbut there is basically little consensus on whether one modelstructure (hypothesis) would have more support on observa-tions than other model structures (Manzoni and Porporato2009)

The majority of modeling studies have focused on findingthe set of parameter values of a particular model that bestfit some observed data This approach is useful and has pro-vided much insight on understanding the rates of soil organicmatter decomposition However from the perspective of as-sessing different hypotheses about the structure and dynam-ics of soil organic matter parameter estimation can only givea narrow view of the more complex spectrum resulting from

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1056 C A Sierra et al SOIL R v 10

the combination of structure domain and the parameter spaceof models

SOILR provides the possibility of assessing both modelstructure and parameter values broadening the spectrum ofideas that can be assessed within one single analytical frame-work

We believe this approach complements well and could beeven more powerful than previous approaches to assess per-formance of model structure with inter-comparisons amongdifferent modeling groups (egMelillo et al 1995 Wu andMcGechan 1998 Cramer et al 2001 Randerson et al2009) Multi-model inter-comparison projects do not neces-sarily cover the whole domain of model structures and maybe subject to important issues such as independence of codebias of the whole model ensemble inappropriate metrics todefine model performance etc (Knutti et al 2009 Knutti2010) SOILR can partially help to overcome some of theseproblems for assessing the performance of model structurethrough the option of using alternative functions to representthe same process Philosophically this approach is also sim-ilar to testing multiple working hypotheses

52 Model hierarchies and functional programing

The gap between simulations and understanding describedby Held (2005) is currently exacerbated by the continuousincrease in detail and complexity of simulation modelsHeld(2005) suggests that a way forward to close the gap be-tween simulations and understanding is by the developmentof model hierarchies in which large-scale complex modelsare particular cases of general models that are more amenablefor understanding of system structure and behavior

SOILR can also be viewed as a system for hierarchicalmodeling of soil processes Consider for example the envi-ronmental or external effects on decomposition rates whichhere are denoted by the termξ(t) In its more simple andgeneral case the external effects can be simply a constant(ξ(t) = c) that allows the understanding of model behaviorwithout changes in environmental conditions Simulationscan then be run with a changing environment for exam-ple with variable soil moisture (ξ(t) = f (W(t))) Soil mois-ture could depend on other variables such as precipitationand potential evapotranspiration (W(t) = f (P (t)PET(t)))which in turn can be dependent on other functions In thisform a hierarchy of models is build with the dependence ofdifferent functions on other functions

In terms of programing this concept of model hierarchiescan be easily implemented in a functional programing styleA function that performs certain tasks can have as its argu-ments other functions that perform other tasks These func-tions can be independent among each other so many differentfunctions that perform the same task can be available withinthe same modeling environment This is one of our goals withSOILR to provide a modeling environment that serves as arepository of different functions that can perform the same

task so their performance can be easily compared It also al-lows building soil organic matter decomposition models ina hierarchical framework because functions can have a largenumber of dependences on other functions creating a bridgebetween simple general models and detailed modeling con-structions under the same basic principles

53 Scope and limitations

Our approach to soil organic matter decomposition modelingwith SOILR may have some limitations One potential limi-tation is the use of a high-level programing language that canhave issues in terms of computational efficiency This couldbe an important problem if specific models structures witha large number of computations per time step are applied toa large number of points such as a large spatial grid Otherprograming languages such asC or Fortran may be moresuitable for these tasks although a good programing stylecan avoid many issues of computational efficiency inR It isimportant to keep in mind that the scope of SOILR is morefor the exploration of different model structures and hypothe-ses about soil processes rather than for large computationaltasks however some parallelization tools withinR could beused for this purpose We recommend that once a specificmodel structure is identified as useful for a large computa-tion the entire model object is translated to other languageor optimized for running inR We are exploring these possi-bilities to include in future releases of SOILR

Another potential limitation is the incompatibility of ourconceptual framework to represent the decomposition pro-cess as a non-linear dynamical system Non-linear dynamicsare important for representing microbial processes such aspriming and are very relevant for simulations at short timescales (Wutzler and Reichstein 2008 Manzoni and Porpo-rato 2007 2009) Non-linear models however can be eas-ily implemented inR with the deSolve package We areconsidering two possibilities to include non-linear dynamicalsystems within our theoretical framework One possibility isto provide a framework to specify and linearize non-linearsystems and solve the linear equations as presented here An-other possibility is to include a set of non-linear models solv-ing them directly withdeSolve We aim for further releasesto include this additional functionality

6 Conclusions

We have developed a modeling environment for represent-ing the process of soil organic matter decomposition Thistool SOILR is an open- source package for the implemen-tation and testing of different representations of the processof soil organic matter decomposition The main character-istic of SOILR is its hierarchical structure in which we de-scribe a general model that can accommodate any possiblemodel structure of a multi-pool model of decomposition

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1057

More detailed models can be implemented to simulate spe-cific controls on the decomposition process This allows fortesting of multiple working hypotheses about the structureand functioning of soils and their behavior over time SOILRnot only allows for exploring dynamics on the parameterspace of a model but also on the structural domain

This first version of SOILR allows simulations of organicmatter decomposition and future versions will include rep-resentations of other biogeochemical elements such as nitro-gen and phosphorus as well as their isotopic composition Amodule for parameter fitting will also be included in futurereleases

Appendix A

Implementation details and design decisions regardingSOIL R

A1 The choice of the object-oriented programing(OOP) system

While in object oriented languages the implementation of ob-ject oriented design principles is usually hardwired inR itis a choice between at least three different approaches thusforcing the user to explain why a particular system was usedIn our case the choice ofS4 is a compromise On one handthere is very limited support inS4 for real encapsulation ex-pressed most notably by the possibility to read and even writethe values of slots from outside the class by theslot func-tion or theoperator respectively This default behavior isactually not even trivially changed On the other hand thereare some important advantages

1 Compatibility with the functional paradigm ofR and itsassociated benefits such as lazy evaluation concurrencyand in the future maybe even automatic parallelizationwhich depends on the absence of side effects (unavoid-able with a reference based system likeR5)

2 The integration withRrsquos standard library which in-creases

a the probability of future maintenance and

b acceptance by otherR users

3 The relative seamless integration to commonR work-flows without in depth knowledge of object orientedprograming

Considering that ifR is capable to implement an OOPsystem by means of on board tools it will probably be flexibleenough to change the default behavior of this OOP systemwith on board tools as well SOILR is a rather small packageand we thinkS4 is and appropriate choice for our needs

A2 Comparison betweenSIMECOL and SOIL R

SIMECOL (Petzoldt and Rinke 2007) an R package for theimplementation of ecological models is an alternative to ourown implementation Here we compare the two approachesin terms of their design

A21 Scope

SOILR is focused solely on soil organic matter decompo-sition while SIMECOL aims to be a general framework forecological modeling inR SIMECOL represents an abstrac-tion level somewhere between SOILR andRrsquos S4 systemHence the obvious way for SOILR to make use ofSIMECOL

would be to implement ourModel class as a subclass ofSIMECOL rsquos simObj One motivation to do so consists in thepossibility to inherit functionality from the ancestor which isusually additionally shared by other subclasses thus enablingeasier communication between them Whether subclassing isthe appropriate strategy thus depends on the amount of in-heritable code and the number of subclasses We found thatwithin SOILR Model would be the only one subclass ofSIMECOLrsquos model with nearly no code shared owing to dif-ferences in functionality and design goals (see below)

A22 Functionality

One major difference withSIMECOLrsquos simObj is thatSOILRrsquos Model initialize method requires objects of classTimeMap or its subclasses thus guaranteeing that the dif-ferent objects conforming a model share a common supportin the time domain even if the creation ofTimeMap ob-jects usually takes place far away from the initialization of aModel object since this usually happens behind the sceneseg by conversion ofdataframes the user provides asinput This is a significant difference fromSIMECOLrsquos ap-proach Implementing this functionality in a subclass ofSIMECOLrsquos model would be misleading and would not con-form well with our design goals

A23 Design goals

The main aim of SOILRrsquos Model class is to provide a fencebetween interface and implementation While the interfaceshould change as little as possible to protect code using theclass we want to have as much freedom as possible to changeits implementation We strive to achieve this by avoiding ev-ery possible syntactic distinction between references to ob-ject data and object methods from the outside WithRrsquos S4system one (and maybe the only) way to do so is to wrapall access to object data with get and set methods This isone aspect of a concept often referred to asencapsulationand regarded as one of the key components of OOP In lan-guages such asSmalltalk (Kay 1993) or Ruby (Matsumotoand Ishituka 2002) fully dedicated to OOP this approach ismandatory A method call (a message send to an object) is

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1058 C A Sierra et al SOIL R v 10

the one and only way for objects to communicate with eachother

The S4 approach inR is much less strict and allowsdirect manipulation of the data belonging to an object bymeans of the operator(or the slot function respectively)thus revealing the implementation of an object to the out-side code using this object User code based onwill breakif the implementation changes and the desired slot disap-pears while a get method may be able to retrieve the de-sired information from other data The use of the slot op-erator from outside should therefore be avoided (Genolini2008 Gentleman 2003) Imagine for instance acircle ob-ject c thatstoresits radius andcomputesthe diameter whengetDiameter(c) is called If the radius is accessed solelyby calls ofgetRadius(c) the implementation of the circleclass can later be changed to store the diameter and computethe radiuswithoutany affect to outside code using the class

Applications to SOILRrsquosModel occur if one considers theincreasing number of constructors with redundant parametersets The distinction between parameters and derived vari-ables may even become difficult Differing fromSIMECOL

we unify access toModel elements and avoid a syntacticdifference of parameters and derived values as expressed bySIMECOLrsquos functionsparams andout In addition to theget functions we provide for all data intended to be ac-cessed from outside access through the typical operators[]and$ for our Model class This gives access to all data themodel can provide either during the initialization or com-puted by the methods of the class In fact[] and $ inter-nally use theget methods and may perform any numberof checks and computations to provide a consistent outputThis facility is powerful enough to avoid the use ofcom-pletely for our class This is exactly our intention since theimplementation of the class may change accessing its ele-ments viais strongly discouraged While we will maintainthe defined interface via[] $ and theget functionswe cannot guarantee that code relying onwill work in fu-ture versions of SOILR

Another difference withSIMECOL is also related to the[]operator It enables the user to create the desired output ondemand thus avoiding duplication between output objectsIf the user asks forC shehe getsC and nottimeandC which sometimes may not be intended if the user isconcerned about issues of memory or duplication Howeverit may be very useful to have both in other situations whenthe times argument to the constructor that created themodel in the first place is not available anymore With[]the user can decide which fields the output should contain

An additional intended feature of our[] operator is to al-ways producedataframes and not aResult objectthat would (or at least should) be more protective of its dataagainst alterations post simulation than adataframe Ifwe provided code to post-process results we would certainlyimplement such aResult class to make sure that ourpost-processing is based on valid data Since at the moment

we donrsquot we also do not force a structured output object tothe user

At the moment we do not even provide output asdeSolve objects since every structured output is part of theinterface and may be relied on by user code Although weare happy and thankful to usedeSolve extensively withinSOILR making it a part of the interface would be a promiseto the user that we will keep on supporting it which is a muchbigger commitment

Until now the responsibility beyond the scope of classModel stays with the user

Supplementary material related to this article isavailable online athttpwwwgeosci-model-devnet510452012gmd-5-1045-2012-supplementzip

AcknowledgementsFinancial support for the development of thisproject was provided by the Max Planck Society We would like tothank Ulrich Weber and Martin Jung for providing global climatedata used in the example Maarten Braakhekke provided helpfulcomments on a previous version of this manuscript

The service charges for this open access publicationhave been covered by the Max Planck Society

Edited by S Arndt

References

Adair E Parton W Del Grosso S Silver W Harmon MHall S Burke I and Hart S Simple three-pool modelaccurately describes patterns of long-term litter decomposi-tion in diverse climates Glob Change Biol 14 2636ndash2660doi101111j1365-2486200801674x 2008

Agren G and Bosatta E Theoretical ecosystem ecology under-standing element cycles Cambridge University Press 1998

Andren O and Katterer T ICBM The Introductory Carbon Bal-ance Model for Exploration of Soil Carbon Balances EcolAppl 7 1226ndash1236httpwwwjstororgstable2641210 1997

Bolker B M Pacala S W and Parton W J Linearanalysis of soil decomposition insights from the CEN-TURY model Ecol Appl 8 425ndash439doi1018901051-0761(1998)008[0425LAOSDI]20CO2 1998

Bruun S Six J Jensen L and Paustian K Estimating turnoverof soil organic carbon fractions based on radiocarbon measure-ments Radiocarbon 47 99ndash113 2008

Burger M Juenemann K and Koenig T RUnit R Unit testframework R package version 04 25 2009

Burke I Kaye J Bird S Hall S McCulley R and Som-merville G Evaluating and testing models of terrestrial biogeo-chemistry the role of temperature in controlling decompositionModels in ecosystem science Princeton University Press Prince-ton New Jersey USA 225ndash253 2003

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

1050 C A Sierra et al SOIL R v 10

of organic matter (Agren and Bosatta 1998) Eq (5) simpli-fies to

dC(t)

dt= AC(t) (13)

With initial conditions as in Eq (10) the analytical solu-tion to this problem is given by

C(t) = eA(tminust0)C0 (14)

If I (t) is not identically zero then the solution of the linearsystem

dC(t)

dt= I (t) + AC(t)

with initial conditions as in Eq (10) is given by

C(t) = eA(tminust0)C0 +

tintt0

eA(tminusτ)I (τ )dτ (15)

3 Numerical implementation

The solution to the dynamical system described by Eq (6) isdiscretized over time withh denoting the time step andn thenumber of steps The time steph may or may not be constantInitial conditions are given at timet0 = 0 The solution to thesystem is then given by

Cn+1 = Cn + Dr [fprime(Cn)h] (16)

whereDr [fprime(Cn)h] is anr order finite difference approxi-

mation to the system of ODEs of Eq (6) for each time steph(LeVeque 2007) in other words an ODE solver

The choice for the ODE solver is flexible in SOILR Cur-rently we provide the option to use a simple Euler forwardmethod or an interface to thedeSolve package ofSoetaertet al (2010) The functiondeSolvelsodawrapperin SOILR is a wrapper to the functionlsoda in packagedeSolve

31 TheModel class

The general numerical model described by Eq (6) is rep-resented in SOILR by an object oriented design centeringaround the classModel Nearly all computations possible inSOILR are facilitated byModel itself or its building blocksThe class defines the information allModel objects containand how those objects behave when (generic) functions areapplied to them (Chambers 2008) Any model constructedwith SOILR provides then a stable and consistent interfacethat encapsulates details about its implementation This in-terface provide a number of advantages to the user

1 A level of abstraction close to the mathematical descrip-tion of the model being implemented focusing on thescientific content rather than on technical details

2 Stability of code generated by the user based on SOILRoutput We believe that the more essential and less re-dundant the interface the less likely it is to change infuture revisions

3 Safeguards against unreasonable (and therefore prob-ably unintentional) input from simple dimensionalchecks to mathematical consistency of all arguments ofthe general model described in Sects22through27

4 Smaller programs that are easier to read

Developers also benefit from this implementation design by

1 Freedom to change the implementation behind thescenes without breaking user code

2 Easier maintenance testing bug tracking and exceptionhandling by reduced duplication

Objects of classModel are initialized in SOILR by vari-ous functions which are listed with the commandModel Most of them provide shortcuts for the construction of stan-dard models such as those in Fig1 These functions usuallydo not require the user to consider the real building blocks ofaModel object but rather infer the needed information fromobjects more common inR such as data frames Howeverall these high-level functions callGeneralModel which isthe most general constructor The functionGeneralModelinitializes theModel object after applying various validitychecks but does not run the model itself which instead isdone by specific functions (methods) applied to objects ofclassModel

The functionGeneralModel takes five arguments rep-resenting a specific case of Eq (6)

1 A vector t which contains the time values where thesolution to the ODE system is sought It can be of anylength but must be of classnumeric

2 An object of classTimeMap which implements thematrix A of Eq (5) as a function of time (including itsdomain) thus allowing the same level of abstraction asthe most general ODE solvers (Soetaert et al 2010)The classTimeMap is native to SOILR and simply ex-tends a commonR function to a mathematical validfunction definition that includes the time domain wherethe function is defined Thus it contains the necessaryinformation to prevent extrapolations beyond the rangeof input data Details aboutTimeMap are discussed inAppendixA

3 A vector of classnumeric containing the initialvaluesC0 of the ODE system

4 Again an object of classTimeMap containing theinputs I (t) to the system as a vector valued functionof time The length of this vector must be equal to thedimension of the matrixA and is checked as well as thetime domain

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1051

5 A string choosing the solver to be used

Once a new object of classModel is intialized from a callto GeneralModel or one of its various wrappers the newobject can be queried by several generic functions For ex-ample to obtain the amount of carbon over time solving thesystem of ODEs any object of classModel (and thereforeall its subclasses) can be used as argument of the functiongetC The call to this function returns an times m matrix withthe amount of carbon for each poolm at each time stepnSimilarly to obtain the amount of carbon release over timethe functiongetReleaseFlux can be called with any ob-ject of classModel as argument The result will be an times m

matrix with the amount of released carbon for each poolm

at each time stepn It is also possible to use the typical op-erators[ ] and $ for our Model class given access tomethods even easier For examplegetC(mod) is equiva-lent tomod$Cand something like

df=asdataframe(cbind(getTime(mod)getC(mod)))

can also be expressed as

df=mod[c(time C)]

This avoids the necessity of the somewhat dangerous use ofthe operator in user code which we strongly discouragesince it attaches the code to implementational details thatmay change in the future

The implementation of specific models as subclasses ofModel with methods for the generic functions will allow theintegration of new functionality without major modificationsto our current implementation For example once nutrientcycling and isotope dynamics are incorporated into SOILRnew methods will be developed independently without majormodifications to the current implementation of carbon stocksand release

The vignette GeneralModel provided with SOILRpresents some further insight in the implementation of spe-cific model structures with the help of the general tool-setprovided by theModel class The examples therein mayalso serve as templates to implement new model structuresas desired by the user Examples on how to use these modelstructures as a function are presented in Sect4

32 Version control system unit testing and automaticdocumentation

The development of SOILR is aided by a significant amountof existing open- source software To solve the ordinary dif-ferential equations produced by our framework we rely onthe well tested and documenteddeSolve package devel-oped bySoetaert et al(2010) We also use the open-sourcesymbolic python library SymPy (SymPy Development Team2008) to compute analytical solutions for the models forwhich this is possible The analytical solutions obtained from

SymPy are used to automatically create unit tests for SOILRTo constantly run these tests we use another open-sourcesoftware theRunit package (Burger et al 2009) The testsare distributed with the release version of SOILR and thusadd to the transparency of its development In addition weuseSweave (Leisch 2002 2003) and theinlinedocspackage (Hocking et al 2012) to produce documentationand encourage a literate programing style (Knuth 1984)As a version control system we use Mercurial (OrsquoSullivan2009) and the Trac (Edgewall Software 2011) online projectmanagement tool which includes ticket system wiki andonline access to our source code

33 Documentation

There are different types of documentation for SOILR Thefirst source of information is this document which intro-duces the science and some general technical details Asecond source of information is the documentation to eachfunction provided within the package itself To view thisdocumentation the user only needs to openR and typehelpstart() This will open a help window on a web-browser There the user only needs to go to PackagesSoilR toview a list of all the functions implemented Clicking on eachfunction will show details about the arguments of each func-tion and examples on how to use them For specific functionsthe user can also just type the name of the function precededby the question mark on theR command shell For exampletyping TwopParallelModel in the R command shellwill open a help window with the description of the functionTo view the source code of the function the user only needsto type the name of the function (without the question mark)on theR command shell

A third source of information are the so called Package Vi-gnettes These are short documents illustrating the use of thepackage for specific purposes Currently we provide one vi-gnette with version 10 of SOILR This vignette illustratesthe implementation of any model structure within SOILRFor future versions we will provide vigenettes about fittingspecific model structures to data and how to use SOILR formodeling radiocarbon

34 Installing and loading SOIL R

SOILR can be obtained from the ComprehensiveR ArchiveNetwork (CRAN) the official repository forR packageswith mirrors in places all over the world Packages storedin CRAN can be downloaded directly from anR ses-sion It can also be obtained from R-Forge a repositoryfor package developers To install SOILR from CRANthe user simply needs to type in theR command shellinstallpackages(SoilR) To install from R-Forge the statement isinstallpackages(SoilRrepos=httpR-ForgeR-projectorg) After installing the package simply type

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1052 C A Sierra et al SOIL R v 10

library(SoilR) and the package is loaded intoyourR session

4 Examples

In this section we present examples on how to runsome of the functions implemented in SOILR basedon the theoretical framework presented previously Ad-ditional details about the implementations of each func-tion and instructions on how to implement new modelstructures are presented in the vignette lsquoImplementingCompartment Models in SOILR the GeneralModelFunctionrsquo provided with the package To view thisvignette simply typevignette(GeneralModelpackage=SoilR) in theR command shell

41 Implementation of a two pool model withconnection in series the ICBM model

One of the first models ever proposed to represent soil or-ganic matter dynamics was a two-pool model with connec-tion in series (cf Eq2 Henin et al 1959) More than50 yr laterAndren and Katterer(1997) proposed the ICBMmodel which is practically the same model proposed earlierby Henin et al(1959) but including a term for temperatureand moisture dependence of decomposition rates The set ofdifferential equations of the ICBM model are given by

dC1

dt= I minus k1ξC1

dC2

dt= αk1ξC1 minus k2ξC2 (17)

whereα is a humification or transfer coefficient andξ a pa-rameter representing external effects on decomposition ratesIn the ICBM modelC1 represents a ldquoyoungrdquo pool andC2 anldquooldrdquo pool This set of equations can be rewritten using ourmodel formulation which gives

dC

dt= I

(10

)+ ξ

(minusk1 0αk1 minusk2

)(C1C2

) (18)

with initial conditions(C10C20)T and where

A =

(minusk1 0a21 minusk2

)

with a21 = αk1 γ = 1 andξ(t) = ξ The function ICBMModel in SOILR implements this

model structure requiring as its arguments (1) a vector ofany length with the points in time when we are interested infinding a solution (2) a column vector of decomposition rates(k1k2)

T (3) the value ofα (4) the value ofξ (5) a columnvector with the initial amount of carbon at the beginning ofsimulation(C10C20)

T and (6) the mean annual carbon in-put to the soilI Andren and Katterer(1997) provided values

for these arguments from a 35-yr field experiment manipu-lating carbon and nitrogen inputs to an agricultural soil inSweden For the case of a treatment in which the soil wasleft as bare fallow without N or C inputs the ICBM modelcan be parameterized as

dC

dt= 0

(10

)+ 132

(minus08 0

013times 08 minus000605

)(C1C2

) (19)

with initial conditions(03396)T Assuming SOILR is already installed it is only necessary

to write the following lines of code to run the ICBM model

library(SoilR)times=seq(020by=01)Bare=ICBMModel(t=times ks=c(k1=08

k2=000605) h=013 r=132c0=c(C10=03C20=396) In=0)

The call toICBMModel simply initialize the model andchecks for consistency on its arguments In this example thedecomposition rates are given in units of yearminus1 and the ini-tial amounts of carbon in units of kg C mminus2

To obtain the amount of carbon over time it is necessary toinvoke the functiongetC storing the output into an objectFor example to store the amount of carbon from the objectBare the user can type

CtBare=getC(Bare)

This new objectCtBare is a matrix with 2 columns(2 pools) and 201 rows (201 points in time from 0 to 20in increments of 01) To obtain the total amount of carbonie the sum of the pools the R functionrowSums can beused For example plotting the total amount of carbon overtime as well as the carbon on each pool only requires theselines of code

plot(times rowSums(CtBare)type=lylim=c(05) ylab=Topsoil carbonmass (kg m-2)xlab=Time (years)lwd=2)

lines(times CtBare[1]lty=2)lines(timesCtBare[2]lty=3col=2lwd=2)legend(toprightc(Total carbon

Carbon in pool 1 Carbon in pool 2)lty=c(123)col=c(112)lwd=c(212)bty=n)

If the total amount of carbon is needed for further calcula-tions the output ofrowSums() can be stored in an objectwith any name

We implemented the different N and C treatments reportedin Andren and Katterer(1997) from the set of parametersreported by those authors The code necessary to reproduceFig 2 inAndren and Katterer(1997) is provided as an exam-ple with the functionICBMModel and can be accessed by

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1053

0 5 10 15 20

02

46

8

Time (years)

Tops

oil c

arbo

n m

ass

(kg

m-2

)

Bare fallow+N +Straw-N +Straw-N -Straw+N -StrawManureSludge

Fig 2 Model predictions with the version of the ICBM modelimplemented in SOILR This graph reproduces Fig 2 inAn-dren and Katterer(1997) This figure can be reproduced typ-ing example(ICBMModel) or attr(ICBMModelex) inSOILR

typing example(ICBMModel) or from the html help inR This code produces Fig2 which is identical to Fig 2 inAndren and Katterer(1997)

42 Alternative two-pool models

The ICBM model described in the previous section althoughuseful does not offer too much flexibility in terms of the in-put arguments For example the litter inputs to the systemcould vary over time as well as the temperature and moistureeffects on decomposition rates In addition there are otherpossibilities to implement a two pool model depending onthe type of connection between pools (Fig1)

The parallel pool model structure can be implemented withthe functionTwopParallelModel while a more gen-eral version of a series model structure can be implementedwith the functionTwopSeriesModel Similarly the feed-back model structure can be implemented with the functionTwopFeedbackModel The inputs of litter and the mod-ification of decomposition rates by external factors can beeither constant or a function of time Furthermore the func-tions presented in Table1 and their combinations can beused as arguments in the different model structures provid-ing a large variety of options to model decomposition withjust two pools In fact the same flexibility can be obtainedwith any number of pools with the application of the moregeneral functionGeneralModel

As an example we show the differences obtained by run-ning three different versions of a two-pool model with the

0 5 10 15 20

05

1015

20

Car

bon

stoc

ks (a

rbitr

ary

units

) Two-pool ParallelTwo-pool SeriesTwo-pool Feedback

0 5 10 15 20

00051015202530

Time

Car

bon

rele

ase

(arb

itrar

y un

its)

Fig 3 Examples of three different representations of a two-poolmodel with different model structures and environmental effects ondecomposition rates The upper panel shows carbon stocks and thelower panel carbon release Additional details about the implemen-tation are given in the text

same amount of carbon at the beginning of the simulationsimilar rates of litter inputs and equal decomposition rates(Fig 3) As an illustration we also ran the simulations withdifferent options for the time dependence of the litter inputsand the decomposition rates In the first simulation we ran amodel with a structure of parallel compartments In this sim-ulation the litter inputs and decomposition rates were con-stant but the decomposition rates were modified by averagevalues of temperature and moisture according to the func-tions proposed in the Daycent model (Table1) For the sec-ond simulation we ran a two-pool model with connectionin series introducing temporal variability in the amount ofinputs using a sine function that artificially represents an an-nual cycle In the third simulation we ran a two-pool modelwith connection in series among compartments The amountof litter inputs over time were calculated using random num-bers over time In this simulation we also produced ran-dom numbers of temperature and moisture and applied thefunctions to modify decomposition rates according to theCentury and the Demeter models (Fig3) The code to re-produce Fig3 is provided in the example of the functionTwopFeedbackModel

These simulations without being necessarily realisticsimply show that small differences in model structure canproduce very different predictions even when the main pa-rameters of the model remain unchanged The simulationsalso serve to illustrate different possibilities in the use of the

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1054 C A Sierra et al SOIL R v 10

basic functions of SOILR to represent the process of organicmatter decomposition over time

To implement more sophisticated models with a higher de-gree of complexity it is possible to specify a larger amount ofpools with complex functions representing the dependence oflitter inputs decomposition rates and transfer between poolswith other external variables such as temperature moisturesoil texture nutrient status among many other

43 Implementation of the RothC model

RothC is a popular and widely used model for predicting or-ganic matter dynamics over time Although earlier versionsof the model included five active pools and one inert pool(Jenkinson and Rayner 1977) more recent versions only in-clude four active pools plus the inert pool (Jenkinson et al1990) RothC is implemented within SOILR and we providedetails here about this implementation to illustrate the useand potential implementation of any other model RothC canbe described by the following set of differential equations

dC1

dt= γ I minus k1C1

dC2

dt= (1minus γ )I minus k2C2

dC3

dt= α31k1C1 + α32k2C2 minus k3C3 + α33k3C3 + α34k4C4

dC4

dt= α41k1C1 + α42k2C2 + α43k3C3 minus k4C4 + α44k4C4

dC5

dt= 0 (20)

whereC1 represents the decomposable plant material (DPM)poolC2 the resistant plant material (RPM) poolC3 the mi-crobial biomass (BIO) poolC4 the humified organic matter(HUM) pool andC5 the inert organic matter pool (IOM)This set of equations can be rewritten in the form

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0α31k1 α32k2 minusk3(1minus α33) α34k4 0α41k1 α42k2 α43k3 minusk4(1minus α44) 0

0 0 0 0 0

C1C2C3C4C5

or as

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0a31 a32 minusk3 + a33 a34 0a41 a42 a43 minusk4 + a44 00 0 0 0 0

C1C2C3C4C5

(21)

The values of the decomposition rates are constant and givenby k1 = 10 k2 = 03 k3 = 066 andk4 = 002 (Jenkinsonet al 1990 Coleman and Jenkinson 1999) The value ofthe transfer coefficients is determined by a function of soiltexture For the microbial biomass pool transfer coefficientsare calculated as

a3j = kj

046

x + 1(22)

wherex is a value that determines the proportion of decom-posed material that is respired as CO2 and is given by

x = 167(185+ 160exp(minus00786pClay)) (23)

wherepClay is percent clay in mineral soil (Jenkinson et al1990) Similarly the transfer coefficients for the humifiedpool are given by

a4j = kj

054

x + 1 (24)

The partitioning of incoming plant material is determinedby the ratio DPMRPM which in RothC is set as 144 There-foreγ = 059 Now the basic structure of the RothC modelcan be written as

dC

dt= I

059041

000

+

minus10 0 0 0 0

0 minus03 0 0 0102 003 minus059 001 0119 004 008 minus002 0

0 0 0 0 0

C1C2C3C4C5

(25)

The annual amount of inputs is set in the RothC model asI = 17 Mg C haminus1 yrminus1

With this parameterization it is possible to run the RothCmodel without varying environmental effects on decompo-sition rates and observe how the system approaches steady-state for the different pools (Fig4) Parameter values ini-tial conditions and litter inputs can be changed easily withinSOILR to compare different predictions from this model

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1055

0 100 200 300 400 500

05

1015

2025

Time (years)

Car

bon

stor

es (M

g Cha

minus1)

Pool 1 DPMPool 2 RPMPool 3 BIOPool 4 HUMPool 5 IOMTotal Carbon

Fig 4 Carbon accumulation for the different pools included in theRothC model DPM the decomposable plant material pool RPMresistant plant material BIO microbial biomass pool HUM humi-fied organic matterpool and IOM inert organic matter pool

44 Applications for large-scale modeling

R can handle a large variety of data structures which offersinteresting possibilities for the application of the functionsimplemented in SOILR One important type of data structureis spatial data with global coverage There is a large numberof R packages to import and manipulate spatial data whichfacilitates the technical aspects for running SOILR functionsat the global scale

As an example we show here a simple calculation of cli-mate decomposition indexes (CDIs) (Adair et al 2008) us-ing a global dataset of temperature precipitation and po-tential evapotranspiration available at 05 degree resolutionon NetCDF files from the WATCH dataset (Weedon et al2011) The input dataset contained monthly average tempera-ture precipitation and evapotranspiration for the period 1958to 2001 We calculated the CDIs as

CDI = ξ(t) = f (T )f (W) (26)

with f (T ) implemented by the functionfTCentury1 andf (W) by the functionfWCentury as described in Ta-ble 1 Results can be easily plotted on a map (Fig5) andexported again to NetCDF files Different combinations ofthe functions described in Table1 can be used to calculateCDIs (Adair et al 2008) and evaluate different hypothesesabout the response of decomposition rates to moisture tem-perature and other variables

Longitude

Latit

ude

02

04

06

08

Fig 5 Climate decomposition index (CDI) calculated as the prod-uct of a function of temperature (fTCentury1 ) and a function ofprecipitation and potential evapotranspiration (fWCentury ) us-ing monthly data from the WATCH dataset (Weedon et al 2011)

5 Discussion

Many models of soil organic matter decomposition have beenproposed previously and there even exist some open-sourcetools to implement some of these models (egEaster et al2007) We have developed a tool for implementing and run-ning a large variety of these models with the idea of facili-tating comparison among multiple models in an easy to useinterface In this section we discuss some of the advantagesand disadvantages of our approach

51 Parameter space and structural domain

Models of organic matter decomposition are basically hypo-thetical abstractions about the structure and dynamics of soilorganic matter The multitude of models previously devel-oped suggests that there exists a large number of hypothesesabout the structure and functioning of soil organic matterbut there is basically little consensus on whether one modelstructure (hypothesis) would have more support on observa-tions than other model structures (Manzoni and Porporato2009)

The majority of modeling studies have focused on findingthe set of parameter values of a particular model that bestfit some observed data This approach is useful and has pro-vided much insight on understanding the rates of soil organicmatter decomposition However from the perspective of as-sessing different hypotheses about the structure and dynam-ics of soil organic matter parameter estimation can only givea narrow view of the more complex spectrum resulting from

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1056 C A Sierra et al SOIL R v 10

the combination of structure domain and the parameter spaceof models

SOILR provides the possibility of assessing both modelstructure and parameter values broadening the spectrum ofideas that can be assessed within one single analytical frame-work

We believe this approach complements well and could beeven more powerful than previous approaches to assess per-formance of model structure with inter-comparisons amongdifferent modeling groups (egMelillo et al 1995 Wu andMcGechan 1998 Cramer et al 2001 Randerson et al2009) Multi-model inter-comparison projects do not neces-sarily cover the whole domain of model structures and maybe subject to important issues such as independence of codebias of the whole model ensemble inappropriate metrics todefine model performance etc (Knutti et al 2009 Knutti2010) SOILR can partially help to overcome some of theseproblems for assessing the performance of model structurethrough the option of using alternative functions to representthe same process Philosophically this approach is also sim-ilar to testing multiple working hypotheses

52 Model hierarchies and functional programing

The gap between simulations and understanding describedby Held (2005) is currently exacerbated by the continuousincrease in detail and complexity of simulation modelsHeld(2005) suggests that a way forward to close the gap be-tween simulations and understanding is by the developmentof model hierarchies in which large-scale complex modelsare particular cases of general models that are more amenablefor understanding of system structure and behavior

SOILR can also be viewed as a system for hierarchicalmodeling of soil processes Consider for example the envi-ronmental or external effects on decomposition rates whichhere are denoted by the termξ(t) In its more simple andgeneral case the external effects can be simply a constant(ξ(t) = c) that allows the understanding of model behaviorwithout changes in environmental conditions Simulationscan then be run with a changing environment for exam-ple with variable soil moisture (ξ(t) = f (W(t))) Soil mois-ture could depend on other variables such as precipitationand potential evapotranspiration (W(t) = f (P (t)PET(t)))which in turn can be dependent on other functions In thisform a hierarchy of models is build with the dependence ofdifferent functions on other functions

In terms of programing this concept of model hierarchiescan be easily implemented in a functional programing styleA function that performs certain tasks can have as its argu-ments other functions that perform other tasks These func-tions can be independent among each other so many differentfunctions that perform the same task can be available withinthe same modeling environment This is one of our goals withSOILR to provide a modeling environment that serves as arepository of different functions that can perform the same

task so their performance can be easily compared It also al-lows building soil organic matter decomposition models ina hierarchical framework because functions can have a largenumber of dependences on other functions creating a bridgebetween simple general models and detailed modeling con-structions under the same basic principles

53 Scope and limitations

Our approach to soil organic matter decomposition modelingwith SOILR may have some limitations One potential limi-tation is the use of a high-level programing language that canhave issues in terms of computational efficiency This couldbe an important problem if specific models structures witha large number of computations per time step are applied toa large number of points such as a large spatial grid Otherprograming languages such asC or Fortran may be moresuitable for these tasks although a good programing stylecan avoid many issues of computational efficiency inR It isimportant to keep in mind that the scope of SOILR is morefor the exploration of different model structures and hypothe-ses about soil processes rather than for large computationaltasks however some parallelization tools withinR could beused for this purpose We recommend that once a specificmodel structure is identified as useful for a large computa-tion the entire model object is translated to other languageor optimized for running inR We are exploring these possi-bilities to include in future releases of SOILR

Another potential limitation is the incompatibility of ourconceptual framework to represent the decomposition pro-cess as a non-linear dynamical system Non-linear dynamicsare important for representing microbial processes such aspriming and are very relevant for simulations at short timescales (Wutzler and Reichstein 2008 Manzoni and Porpo-rato 2007 2009) Non-linear models however can be eas-ily implemented inR with the deSolve package We areconsidering two possibilities to include non-linear dynamicalsystems within our theoretical framework One possibility isto provide a framework to specify and linearize non-linearsystems and solve the linear equations as presented here An-other possibility is to include a set of non-linear models solv-ing them directly withdeSolve We aim for further releasesto include this additional functionality

6 Conclusions

We have developed a modeling environment for represent-ing the process of soil organic matter decomposition Thistool SOILR is an open- source package for the implemen-tation and testing of different representations of the processof soil organic matter decomposition The main character-istic of SOILR is its hierarchical structure in which we de-scribe a general model that can accommodate any possiblemodel structure of a multi-pool model of decomposition

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1057

More detailed models can be implemented to simulate spe-cific controls on the decomposition process This allows fortesting of multiple working hypotheses about the structureand functioning of soils and their behavior over time SOILRnot only allows for exploring dynamics on the parameterspace of a model but also on the structural domain

This first version of SOILR allows simulations of organicmatter decomposition and future versions will include rep-resentations of other biogeochemical elements such as nitro-gen and phosphorus as well as their isotopic composition Amodule for parameter fitting will also be included in futurereleases

Appendix A

Implementation details and design decisions regardingSOIL R

A1 The choice of the object-oriented programing(OOP) system

While in object oriented languages the implementation of ob-ject oriented design principles is usually hardwired inR itis a choice between at least three different approaches thusforcing the user to explain why a particular system was usedIn our case the choice ofS4 is a compromise On one handthere is very limited support inS4 for real encapsulation ex-pressed most notably by the possibility to read and even writethe values of slots from outside the class by theslot func-tion or theoperator respectively This default behavior isactually not even trivially changed On the other hand thereare some important advantages

1 Compatibility with the functional paradigm ofR and itsassociated benefits such as lazy evaluation concurrencyand in the future maybe even automatic parallelizationwhich depends on the absence of side effects (unavoid-able with a reference based system likeR5)

2 The integration withRrsquos standard library which in-creases

a the probability of future maintenance and

b acceptance by otherR users

3 The relative seamless integration to commonR work-flows without in depth knowledge of object orientedprograming

Considering that ifR is capable to implement an OOPsystem by means of on board tools it will probably be flexibleenough to change the default behavior of this OOP systemwith on board tools as well SOILR is a rather small packageand we thinkS4 is and appropriate choice for our needs

A2 Comparison betweenSIMECOL and SOIL R

SIMECOL (Petzoldt and Rinke 2007) an R package for theimplementation of ecological models is an alternative to ourown implementation Here we compare the two approachesin terms of their design

A21 Scope

SOILR is focused solely on soil organic matter decompo-sition while SIMECOL aims to be a general framework forecological modeling inR SIMECOL represents an abstrac-tion level somewhere between SOILR andRrsquos S4 systemHence the obvious way for SOILR to make use ofSIMECOL

would be to implement ourModel class as a subclass ofSIMECOL rsquos simObj One motivation to do so consists in thepossibility to inherit functionality from the ancestor which isusually additionally shared by other subclasses thus enablingeasier communication between them Whether subclassing isthe appropriate strategy thus depends on the amount of in-heritable code and the number of subclasses We found thatwithin SOILR Model would be the only one subclass ofSIMECOLrsquos model with nearly no code shared owing to dif-ferences in functionality and design goals (see below)

A22 Functionality

One major difference withSIMECOLrsquos simObj is thatSOILRrsquos Model initialize method requires objects of classTimeMap or its subclasses thus guaranteeing that the dif-ferent objects conforming a model share a common supportin the time domain even if the creation ofTimeMap ob-jects usually takes place far away from the initialization of aModel object since this usually happens behind the sceneseg by conversion ofdataframes the user provides asinput This is a significant difference fromSIMECOLrsquos ap-proach Implementing this functionality in a subclass ofSIMECOLrsquos model would be misleading and would not con-form well with our design goals

A23 Design goals

The main aim of SOILRrsquos Model class is to provide a fencebetween interface and implementation While the interfaceshould change as little as possible to protect code using theclass we want to have as much freedom as possible to changeits implementation We strive to achieve this by avoiding ev-ery possible syntactic distinction between references to ob-ject data and object methods from the outside WithRrsquos S4system one (and maybe the only) way to do so is to wrapall access to object data with get and set methods This isone aspect of a concept often referred to asencapsulationand regarded as one of the key components of OOP In lan-guages such asSmalltalk (Kay 1993) or Ruby (Matsumotoand Ishituka 2002) fully dedicated to OOP this approach ismandatory A method call (a message send to an object) is

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1058 C A Sierra et al SOIL R v 10

the one and only way for objects to communicate with eachother

The S4 approach inR is much less strict and allowsdirect manipulation of the data belonging to an object bymeans of the operator(or the slot function respectively)thus revealing the implementation of an object to the out-side code using this object User code based onwill breakif the implementation changes and the desired slot disap-pears while a get method may be able to retrieve the de-sired information from other data The use of the slot op-erator from outside should therefore be avoided (Genolini2008 Gentleman 2003) Imagine for instance acircle ob-ject c thatstoresits radius andcomputesthe diameter whengetDiameter(c) is called If the radius is accessed solelyby calls ofgetRadius(c) the implementation of the circleclass can later be changed to store the diameter and computethe radiuswithoutany affect to outside code using the class

Applications to SOILRrsquosModel occur if one considers theincreasing number of constructors with redundant parametersets The distinction between parameters and derived vari-ables may even become difficult Differing fromSIMECOL

we unify access toModel elements and avoid a syntacticdifference of parameters and derived values as expressed bySIMECOLrsquos functionsparams andout In addition to theget functions we provide for all data intended to be ac-cessed from outside access through the typical operators[]and$ for our Model class This gives access to all data themodel can provide either during the initialization or com-puted by the methods of the class In fact[] and $ inter-nally use theget methods and may perform any numberof checks and computations to provide a consistent outputThis facility is powerful enough to avoid the use ofcom-pletely for our class This is exactly our intention since theimplementation of the class may change accessing its ele-ments viais strongly discouraged While we will maintainthe defined interface via[] $ and theget functionswe cannot guarantee that code relying onwill work in fu-ture versions of SOILR

Another difference withSIMECOL is also related to the[]operator It enables the user to create the desired output ondemand thus avoiding duplication between output objectsIf the user asks forC shehe getsC and nottimeandC which sometimes may not be intended if the user isconcerned about issues of memory or duplication Howeverit may be very useful to have both in other situations whenthe times argument to the constructor that created themodel in the first place is not available anymore With[]the user can decide which fields the output should contain

An additional intended feature of our[] operator is to al-ways producedataframes and not aResult objectthat would (or at least should) be more protective of its dataagainst alterations post simulation than adataframe Ifwe provided code to post-process results we would certainlyimplement such aResult class to make sure that ourpost-processing is based on valid data Since at the moment

we donrsquot we also do not force a structured output object tothe user

At the moment we do not even provide output asdeSolve objects since every structured output is part of theinterface and may be relied on by user code Although weare happy and thankful to usedeSolve extensively withinSOILR making it a part of the interface would be a promiseto the user that we will keep on supporting it which is a muchbigger commitment

Until now the responsibility beyond the scope of classModel stays with the user

Supplementary material related to this article isavailable online athttpwwwgeosci-model-devnet510452012gmd-5-1045-2012-supplementzip

AcknowledgementsFinancial support for the development of thisproject was provided by the Max Planck Society We would like tothank Ulrich Weber and Martin Jung for providing global climatedata used in the example Maarten Braakhekke provided helpfulcomments on a previous version of this manuscript

The service charges for this open access publicationhave been covered by the Max Planck Society

Edited by S Arndt

References

Adair E Parton W Del Grosso S Silver W Harmon MHall S Burke I and Hart S Simple three-pool modelaccurately describes patterns of long-term litter decomposi-tion in diverse climates Glob Change Biol 14 2636ndash2660doi101111j1365-2486200801674x 2008

Agren G and Bosatta E Theoretical ecosystem ecology under-standing element cycles Cambridge University Press 1998

Andren O and Katterer T ICBM The Introductory Carbon Bal-ance Model for Exploration of Soil Carbon Balances EcolAppl 7 1226ndash1236httpwwwjstororgstable2641210 1997

Bolker B M Pacala S W and Parton W J Linearanalysis of soil decomposition insights from the CEN-TURY model Ecol Appl 8 425ndash439doi1018901051-0761(1998)008[0425LAOSDI]20CO2 1998

Bruun S Six J Jensen L and Paustian K Estimating turnoverof soil organic carbon fractions based on radiocarbon measure-ments Radiocarbon 47 99ndash113 2008

Burger M Juenemann K and Koenig T RUnit R Unit testframework R package version 04 25 2009

Burke I Kaye J Bird S Hall S McCulley R and Som-merville G Evaluating and testing models of terrestrial biogeo-chemistry the role of temperature in controlling decompositionModels in ecosystem science Princeton University Press Prince-ton New Jersey USA 225ndash253 2003

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1051

5 A string choosing the solver to be used

Once a new object of classModel is intialized from a callto GeneralModel or one of its various wrappers the newobject can be queried by several generic functions For ex-ample to obtain the amount of carbon over time solving thesystem of ODEs any object of classModel (and thereforeall its subclasses) can be used as argument of the functiongetC The call to this function returns an times m matrix withthe amount of carbon for each poolm at each time stepnSimilarly to obtain the amount of carbon release over timethe functiongetReleaseFlux can be called with any ob-ject of classModel as argument The result will be an times m

matrix with the amount of released carbon for each poolm

at each time stepn It is also possible to use the typical op-erators[ ] and $ for our Model class given access tomethods even easier For examplegetC(mod) is equiva-lent tomod$Cand something like

df=asdataframe(cbind(getTime(mod)getC(mod)))

can also be expressed as

df=mod[c(time C)]

This avoids the necessity of the somewhat dangerous use ofthe operator in user code which we strongly discouragesince it attaches the code to implementational details thatmay change in the future

The implementation of specific models as subclasses ofModel with methods for the generic functions will allow theintegration of new functionality without major modificationsto our current implementation For example once nutrientcycling and isotope dynamics are incorporated into SOILRnew methods will be developed independently without majormodifications to the current implementation of carbon stocksand release

The vignette GeneralModel provided with SOILRpresents some further insight in the implementation of spe-cific model structures with the help of the general tool-setprovided by theModel class The examples therein mayalso serve as templates to implement new model structuresas desired by the user Examples on how to use these modelstructures as a function are presented in Sect4

32 Version control system unit testing and automaticdocumentation

The development of SOILR is aided by a significant amountof existing open- source software To solve the ordinary dif-ferential equations produced by our framework we rely onthe well tested and documenteddeSolve package devel-oped bySoetaert et al(2010) We also use the open-sourcesymbolic python library SymPy (SymPy Development Team2008) to compute analytical solutions for the models forwhich this is possible The analytical solutions obtained from

SymPy are used to automatically create unit tests for SOILRTo constantly run these tests we use another open-sourcesoftware theRunit package (Burger et al 2009) The testsare distributed with the release version of SOILR and thusadd to the transparency of its development In addition weuseSweave (Leisch 2002 2003) and theinlinedocspackage (Hocking et al 2012) to produce documentationand encourage a literate programing style (Knuth 1984)As a version control system we use Mercurial (OrsquoSullivan2009) and the Trac (Edgewall Software 2011) online projectmanagement tool which includes ticket system wiki andonline access to our source code

33 Documentation

There are different types of documentation for SOILR Thefirst source of information is this document which intro-duces the science and some general technical details Asecond source of information is the documentation to eachfunction provided within the package itself To view thisdocumentation the user only needs to openR and typehelpstart() This will open a help window on a web-browser There the user only needs to go to PackagesSoilR toview a list of all the functions implemented Clicking on eachfunction will show details about the arguments of each func-tion and examples on how to use them For specific functionsthe user can also just type the name of the function precededby the question mark on theR command shell For exampletyping TwopParallelModel in the R command shellwill open a help window with the description of the functionTo view the source code of the function the user only needsto type the name of the function (without the question mark)on theR command shell

A third source of information are the so called Package Vi-gnettes These are short documents illustrating the use of thepackage for specific purposes Currently we provide one vi-gnette with version 10 of SOILR This vignette illustratesthe implementation of any model structure within SOILRFor future versions we will provide vigenettes about fittingspecific model structures to data and how to use SOILR formodeling radiocarbon

34 Installing and loading SOIL R

SOILR can be obtained from the ComprehensiveR ArchiveNetwork (CRAN) the official repository forR packageswith mirrors in places all over the world Packages storedin CRAN can be downloaded directly from anR ses-sion It can also be obtained from R-Forge a repositoryfor package developers To install SOILR from CRANthe user simply needs to type in theR command shellinstallpackages(SoilR) To install from R-Forge the statement isinstallpackages(SoilRrepos=httpR-ForgeR-projectorg) After installing the package simply type

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1052 C A Sierra et al SOIL R v 10

library(SoilR) and the package is loaded intoyourR session

4 Examples

In this section we present examples on how to runsome of the functions implemented in SOILR basedon the theoretical framework presented previously Ad-ditional details about the implementations of each func-tion and instructions on how to implement new modelstructures are presented in the vignette lsquoImplementingCompartment Models in SOILR the GeneralModelFunctionrsquo provided with the package To view thisvignette simply typevignette(GeneralModelpackage=SoilR) in theR command shell

41 Implementation of a two pool model withconnection in series the ICBM model

One of the first models ever proposed to represent soil or-ganic matter dynamics was a two-pool model with connec-tion in series (cf Eq2 Henin et al 1959) More than50 yr laterAndren and Katterer(1997) proposed the ICBMmodel which is practically the same model proposed earlierby Henin et al(1959) but including a term for temperatureand moisture dependence of decomposition rates The set ofdifferential equations of the ICBM model are given by

dC1

dt= I minus k1ξC1

dC2

dt= αk1ξC1 minus k2ξC2 (17)

whereα is a humification or transfer coefficient andξ a pa-rameter representing external effects on decomposition ratesIn the ICBM modelC1 represents a ldquoyoungrdquo pool andC2 anldquooldrdquo pool This set of equations can be rewritten using ourmodel formulation which gives

dC

dt= I

(10

)+ ξ

(minusk1 0αk1 minusk2

)(C1C2

) (18)

with initial conditions(C10C20)T and where

A =

(minusk1 0a21 minusk2

)

with a21 = αk1 γ = 1 andξ(t) = ξ The function ICBMModel in SOILR implements this

model structure requiring as its arguments (1) a vector ofany length with the points in time when we are interested infinding a solution (2) a column vector of decomposition rates(k1k2)

T (3) the value ofα (4) the value ofξ (5) a columnvector with the initial amount of carbon at the beginning ofsimulation(C10C20)

T and (6) the mean annual carbon in-put to the soilI Andren and Katterer(1997) provided values

for these arguments from a 35-yr field experiment manipu-lating carbon and nitrogen inputs to an agricultural soil inSweden For the case of a treatment in which the soil wasleft as bare fallow without N or C inputs the ICBM modelcan be parameterized as

dC

dt= 0

(10

)+ 132

(minus08 0

013times 08 minus000605

)(C1C2

) (19)

with initial conditions(03396)T Assuming SOILR is already installed it is only necessary

to write the following lines of code to run the ICBM model

library(SoilR)times=seq(020by=01)Bare=ICBMModel(t=times ks=c(k1=08

k2=000605) h=013 r=132c0=c(C10=03C20=396) In=0)

The call toICBMModel simply initialize the model andchecks for consistency on its arguments In this example thedecomposition rates are given in units of yearminus1 and the ini-tial amounts of carbon in units of kg C mminus2

To obtain the amount of carbon over time it is necessary toinvoke the functiongetC storing the output into an objectFor example to store the amount of carbon from the objectBare the user can type

CtBare=getC(Bare)

This new objectCtBare is a matrix with 2 columns(2 pools) and 201 rows (201 points in time from 0 to 20in increments of 01) To obtain the total amount of carbonie the sum of the pools the R functionrowSums can beused For example plotting the total amount of carbon overtime as well as the carbon on each pool only requires theselines of code

plot(times rowSums(CtBare)type=lylim=c(05) ylab=Topsoil carbonmass (kg m-2)xlab=Time (years)lwd=2)

lines(times CtBare[1]lty=2)lines(timesCtBare[2]lty=3col=2lwd=2)legend(toprightc(Total carbon

Carbon in pool 1 Carbon in pool 2)lty=c(123)col=c(112)lwd=c(212)bty=n)

If the total amount of carbon is needed for further calcula-tions the output ofrowSums() can be stored in an objectwith any name

We implemented the different N and C treatments reportedin Andren and Katterer(1997) from the set of parametersreported by those authors The code necessary to reproduceFig 2 inAndren and Katterer(1997) is provided as an exam-ple with the functionICBMModel and can be accessed by

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1053

0 5 10 15 20

02

46

8

Time (years)

Tops

oil c

arbo

n m

ass

(kg

m-2

)

Bare fallow+N +Straw-N +Straw-N -Straw+N -StrawManureSludge

Fig 2 Model predictions with the version of the ICBM modelimplemented in SOILR This graph reproduces Fig 2 inAn-dren and Katterer(1997) This figure can be reproduced typ-ing example(ICBMModel) or attr(ICBMModelex) inSOILR

typing example(ICBMModel) or from the html help inR This code produces Fig2 which is identical to Fig 2 inAndren and Katterer(1997)

42 Alternative two-pool models

The ICBM model described in the previous section althoughuseful does not offer too much flexibility in terms of the in-put arguments For example the litter inputs to the systemcould vary over time as well as the temperature and moistureeffects on decomposition rates In addition there are otherpossibilities to implement a two pool model depending onthe type of connection between pools (Fig1)

The parallel pool model structure can be implemented withthe functionTwopParallelModel while a more gen-eral version of a series model structure can be implementedwith the functionTwopSeriesModel Similarly the feed-back model structure can be implemented with the functionTwopFeedbackModel The inputs of litter and the mod-ification of decomposition rates by external factors can beeither constant or a function of time Furthermore the func-tions presented in Table1 and their combinations can beused as arguments in the different model structures provid-ing a large variety of options to model decomposition withjust two pools In fact the same flexibility can be obtainedwith any number of pools with the application of the moregeneral functionGeneralModel

As an example we show the differences obtained by run-ning three different versions of a two-pool model with the

0 5 10 15 20

05

1015

20

Car

bon

stoc

ks (a

rbitr

ary

units

) Two-pool ParallelTwo-pool SeriesTwo-pool Feedback

0 5 10 15 20

00051015202530

Time

Car

bon

rele

ase

(arb

itrar

y un

its)

Fig 3 Examples of three different representations of a two-poolmodel with different model structures and environmental effects ondecomposition rates The upper panel shows carbon stocks and thelower panel carbon release Additional details about the implemen-tation are given in the text

same amount of carbon at the beginning of the simulationsimilar rates of litter inputs and equal decomposition rates(Fig 3) As an illustration we also ran the simulations withdifferent options for the time dependence of the litter inputsand the decomposition rates In the first simulation we ran amodel with a structure of parallel compartments In this sim-ulation the litter inputs and decomposition rates were con-stant but the decomposition rates were modified by averagevalues of temperature and moisture according to the func-tions proposed in the Daycent model (Table1) For the sec-ond simulation we ran a two-pool model with connectionin series introducing temporal variability in the amount ofinputs using a sine function that artificially represents an an-nual cycle In the third simulation we ran a two-pool modelwith connection in series among compartments The amountof litter inputs over time were calculated using random num-bers over time In this simulation we also produced ran-dom numbers of temperature and moisture and applied thefunctions to modify decomposition rates according to theCentury and the Demeter models (Fig3) The code to re-produce Fig3 is provided in the example of the functionTwopFeedbackModel

These simulations without being necessarily realisticsimply show that small differences in model structure canproduce very different predictions even when the main pa-rameters of the model remain unchanged The simulationsalso serve to illustrate different possibilities in the use of the

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1054 C A Sierra et al SOIL R v 10

basic functions of SOILR to represent the process of organicmatter decomposition over time

To implement more sophisticated models with a higher de-gree of complexity it is possible to specify a larger amount ofpools with complex functions representing the dependence oflitter inputs decomposition rates and transfer between poolswith other external variables such as temperature moisturesoil texture nutrient status among many other

43 Implementation of the RothC model

RothC is a popular and widely used model for predicting or-ganic matter dynamics over time Although earlier versionsof the model included five active pools and one inert pool(Jenkinson and Rayner 1977) more recent versions only in-clude four active pools plus the inert pool (Jenkinson et al1990) RothC is implemented within SOILR and we providedetails here about this implementation to illustrate the useand potential implementation of any other model RothC canbe described by the following set of differential equations

dC1

dt= γ I minus k1C1

dC2

dt= (1minus γ )I minus k2C2

dC3

dt= α31k1C1 + α32k2C2 minus k3C3 + α33k3C3 + α34k4C4

dC4

dt= α41k1C1 + α42k2C2 + α43k3C3 minus k4C4 + α44k4C4

dC5

dt= 0 (20)

whereC1 represents the decomposable plant material (DPM)poolC2 the resistant plant material (RPM) poolC3 the mi-crobial biomass (BIO) poolC4 the humified organic matter(HUM) pool andC5 the inert organic matter pool (IOM)This set of equations can be rewritten in the form

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0α31k1 α32k2 minusk3(1minus α33) α34k4 0α41k1 α42k2 α43k3 minusk4(1minus α44) 0

0 0 0 0 0

C1C2C3C4C5

or as

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0a31 a32 minusk3 + a33 a34 0a41 a42 a43 minusk4 + a44 00 0 0 0 0

C1C2C3C4C5

(21)

The values of the decomposition rates are constant and givenby k1 = 10 k2 = 03 k3 = 066 andk4 = 002 (Jenkinsonet al 1990 Coleman and Jenkinson 1999) The value ofthe transfer coefficients is determined by a function of soiltexture For the microbial biomass pool transfer coefficientsare calculated as

a3j = kj

046

x + 1(22)

wherex is a value that determines the proportion of decom-posed material that is respired as CO2 and is given by

x = 167(185+ 160exp(minus00786pClay)) (23)

wherepClay is percent clay in mineral soil (Jenkinson et al1990) Similarly the transfer coefficients for the humifiedpool are given by

a4j = kj

054

x + 1 (24)

The partitioning of incoming plant material is determinedby the ratio DPMRPM which in RothC is set as 144 There-foreγ = 059 Now the basic structure of the RothC modelcan be written as

dC

dt= I

059041

000

+

minus10 0 0 0 0

0 minus03 0 0 0102 003 minus059 001 0119 004 008 minus002 0

0 0 0 0 0

C1C2C3C4C5

(25)

The annual amount of inputs is set in the RothC model asI = 17 Mg C haminus1 yrminus1

With this parameterization it is possible to run the RothCmodel without varying environmental effects on decompo-sition rates and observe how the system approaches steady-state for the different pools (Fig4) Parameter values ini-tial conditions and litter inputs can be changed easily withinSOILR to compare different predictions from this model

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1055

0 100 200 300 400 500

05

1015

2025

Time (years)

Car

bon

stor

es (M

g Cha

minus1)

Pool 1 DPMPool 2 RPMPool 3 BIOPool 4 HUMPool 5 IOMTotal Carbon

Fig 4 Carbon accumulation for the different pools included in theRothC model DPM the decomposable plant material pool RPMresistant plant material BIO microbial biomass pool HUM humi-fied organic matterpool and IOM inert organic matter pool

44 Applications for large-scale modeling

R can handle a large variety of data structures which offersinteresting possibilities for the application of the functionsimplemented in SOILR One important type of data structureis spatial data with global coverage There is a large numberof R packages to import and manipulate spatial data whichfacilitates the technical aspects for running SOILR functionsat the global scale

As an example we show here a simple calculation of cli-mate decomposition indexes (CDIs) (Adair et al 2008) us-ing a global dataset of temperature precipitation and po-tential evapotranspiration available at 05 degree resolutionon NetCDF files from the WATCH dataset (Weedon et al2011) The input dataset contained monthly average tempera-ture precipitation and evapotranspiration for the period 1958to 2001 We calculated the CDIs as

CDI = ξ(t) = f (T )f (W) (26)

with f (T ) implemented by the functionfTCentury1 andf (W) by the functionfWCentury as described in Ta-ble 1 Results can be easily plotted on a map (Fig5) andexported again to NetCDF files Different combinations ofthe functions described in Table1 can be used to calculateCDIs (Adair et al 2008) and evaluate different hypothesesabout the response of decomposition rates to moisture tem-perature and other variables

Longitude

Latit

ude

02

04

06

08

Fig 5 Climate decomposition index (CDI) calculated as the prod-uct of a function of temperature (fTCentury1 ) and a function ofprecipitation and potential evapotranspiration (fWCentury ) us-ing monthly data from the WATCH dataset (Weedon et al 2011)

5 Discussion

Many models of soil organic matter decomposition have beenproposed previously and there even exist some open-sourcetools to implement some of these models (egEaster et al2007) We have developed a tool for implementing and run-ning a large variety of these models with the idea of facili-tating comparison among multiple models in an easy to useinterface In this section we discuss some of the advantagesand disadvantages of our approach

51 Parameter space and structural domain

Models of organic matter decomposition are basically hypo-thetical abstractions about the structure and dynamics of soilorganic matter The multitude of models previously devel-oped suggests that there exists a large number of hypothesesabout the structure and functioning of soil organic matterbut there is basically little consensus on whether one modelstructure (hypothesis) would have more support on observa-tions than other model structures (Manzoni and Porporato2009)

The majority of modeling studies have focused on findingthe set of parameter values of a particular model that bestfit some observed data This approach is useful and has pro-vided much insight on understanding the rates of soil organicmatter decomposition However from the perspective of as-sessing different hypotheses about the structure and dynam-ics of soil organic matter parameter estimation can only givea narrow view of the more complex spectrum resulting from

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1056 C A Sierra et al SOIL R v 10

the combination of structure domain and the parameter spaceof models

SOILR provides the possibility of assessing both modelstructure and parameter values broadening the spectrum ofideas that can be assessed within one single analytical frame-work

We believe this approach complements well and could beeven more powerful than previous approaches to assess per-formance of model structure with inter-comparisons amongdifferent modeling groups (egMelillo et al 1995 Wu andMcGechan 1998 Cramer et al 2001 Randerson et al2009) Multi-model inter-comparison projects do not neces-sarily cover the whole domain of model structures and maybe subject to important issues such as independence of codebias of the whole model ensemble inappropriate metrics todefine model performance etc (Knutti et al 2009 Knutti2010) SOILR can partially help to overcome some of theseproblems for assessing the performance of model structurethrough the option of using alternative functions to representthe same process Philosophically this approach is also sim-ilar to testing multiple working hypotheses

52 Model hierarchies and functional programing

The gap between simulations and understanding describedby Held (2005) is currently exacerbated by the continuousincrease in detail and complexity of simulation modelsHeld(2005) suggests that a way forward to close the gap be-tween simulations and understanding is by the developmentof model hierarchies in which large-scale complex modelsare particular cases of general models that are more amenablefor understanding of system structure and behavior

SOILR can also be viewed as a system for hierarchicalmodeling of soil processes Consider for example the envi-ronmental or external effects on decomposition rates whichhere are denoted by the termξ(t) In its more simple andgeneral case the external effects can be simply a constant(ξ(t) = c) that allows the understanding of model behaviorwithout changes in environmental conditions Simulationscan then be run with a changing environment for exam-ple with variable soil moisture (ξ(t) = f (W(t))) Soil mois-ture could depend on other variables such as precipitationand potential evapotranspiration (W(t) = f (P (t)PET(t)))which in turn can be dependent on other functions In thisform a hierarchy of models is build with the dependence ofdifferent functions on other functions

In terms of programing this concept of model hierarchiescan be easily implemented in a functional programing styleA function that performs certain tasks can have as its argu-ments other functions that perform other tasks These func-tions can be independent among each other so many differentfunctions that perform the same task can be available withinthe same modeling environment This is one of our goals withSOILR to provide a modeling environment that serves as arepository of different functions that can perform the same

task so their performance can be easily compared It also al-lows building soil organic matter decomposition models ina hierarchical framework because functions can have a largenumber of dependences on other functions creating a bridgebetween simple general models and detailed modeling con-structions under the same basic principles

53 Scope and limitations

Our approach to soil organic matter decomposition modelingwith SOILR may have some limitations One potential limi-tation is the use of a high-level programing language that canhave issues in terms of computational efficiency This couldbe an important problem if specific models structures witha large number of computations per time step are applied toa large number of points such as a large spatial grid Otherprograming languages such asC or Fortran may be moresuitable for these tasks although a good programing stylecan avoid many issues of computational efficiency inR It isimportant to keep in mind that the scope of SOILR is morefor the exploration of different model structures and hypothe-ses about soil processes rather than for large computationaltasks however some parallelization tools withinR could beused for this purpose We recommend that once a specificmodel structure is identified as useful for a large computa-tion the entire model object is translated to other languageor optimized for running inR We are exploring these possi-bilities to include in future releases of SOILR

Another potential limitation is the incompatibility of ourconceptual framework to represent the decomposition pro-cess as a non-linear dynamical system Non-linear dynamicsare important for representing microbial processes such aspriming and are very relevant for simulations at short timescales (Wutzler and Reichstein 2008 Manzoni and Porpo-rato 2007 2009) Non-linear models however can be eas-ily implemented inR with the deSolve package We areconsidering two possibilities to include non-linear dynamicalsystems within our theoretical framework One possibility isto provide a framework to specify and linearize non-linearsystems and solve the linear equations as presented here An-other possibility is to include a set of non-linear models solv-ing them directly withdeSolve We aim for further releasesto include this additional functionality

6 Conclusions

We have developed a modeling environment for represent-ing the process of soil organic matter decomposition Thistool SOILR is an open- source package for the implemen-tation and testing of different representations of the processof soil organic matter decomposition The main character-istic of SOILR is its hierarchical structure in which we de-scribe a general model that can accommodate any possiblemodel structure of a multi-pool model of decomposition

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1057

More detailed models can be implemented to simulate spe-cific controls on the decomposition process This allows fortesting of multiple working hypotheses about the structureand functioning of soils and their behavior over time SOILRnot only allows for exploring dynamics on the parameterspace of a model but also on the structural domain

This first version of SOILR allows simulations of organicmatter decomposition and future versions will include rep-resentations of other biogeochemical elements such as nitro-gen and phosphorus as well as their isotopic composition Amodule for parameter fitting will also be included in futurereleases

Appendix A

Implementation details and design decisions regardingSOIL R

A1 The choice of the object-oriented programing(OOP) system

While in object oriented languages the implementation of ob-ject oriented design principles is usually hardwired inR itis a choice between at least three different approaches thusforcing the user to explain why a particular system was usedIn our case the choice ofS4 is a compromise On one handthere is very limited support inS4 for real encapsulation ex-pressed most notably by the possibility to read and even writethe values of slots from outside the class by theslot func-tion or theoperator respectively This default behavior isactually not even trivially changed On the other hand thereare some important advantages

1 Compatibility with the functional paradigm ofR and itsassociated benefits such as lazy evaluation concurrencyand in the future maybe even automatic parallelizationwhich depends on the absence of side effects (unavoid-able with a reference based system likeR5)

2 The integration withRrsquos standard library which in-creases

a the probability of future maintenance and

b acceptance by otherR users

3 The relative seamless integration to commonR work-flows without in depth knowledge of object orientedprograming

Considering that ifR is capable to implement an OOPsystem by means of on board tools it will probably be flexibleenough to change the default behavior of this OOP systemwith on board tools as well SOILR is a rather small packageand we thinkS4 is and appropriate choice for our needs

A2 Comparison betweenSIMECOL and SOIL R

SIMECOL (Petzoldt and Rinke 2007) an R package for theimplementation of ecological models is an alternative to ourown implementation Here we compare the two approachesin terms of their design

A21 Scope

SOILR is focused solely on soil organic matter decompo-sition while SIMECOL aims to be a general framework forecological modeling inR SIMECOL represents an abstrac-tion level somewhere between SOILR andRrsquos S4 systemHence the obvious way for SOILR to make use ofSIMECOL

would be to implement ourModel class as a subclass ofSIMECOL rsquos simObj One motivation to do so consists in thepossibility to inherit functionality from the ancestor which isusually additionally shared by other subclasses thus enablingeasier communication between them Whether subclassing isthe appropriate strategy thus depends on the amount of in-heritable code and the number of subclasses We found thatwithin SOILR Model would be the only one subclass ofSIMECOLrsquos model with nearly no code shared owing to dif-ferences in functionality and design goals (see below)

A22 Functionality

One major difference withSIMECOLrsquos simObj is thatSOILRrsquos Model initialize method requires objects of classTimeMap or its subclasses thus guaranteeing that the dif-ferent objects conforming a model share a common supportin the time domain even if the creation ofTimeMap ob-jects usually takes place far away from the initialization of aModel object since this usually happens behind the sceneseg by conversion ofdataframes the user provides asinput This is a significant difference fromSIMECOLrsquos ap-proach Implementing this functionality in a subclass ofSIMECOLrsquos model would be misleading and would not con-form well with our design goals

A23 Design goals

The main aim of SOILRrsquos Model class is to provide a fencebetween interface and implementation While the interfaceshould change as little as possible to protect code using theclass we want to have as much freedom as possible to changeits implementation We strive to achieve this by avoiding ev-ery possible syntactic distinction between references to ob-ject data and object methods from the outside WithRrsquos S4system one (and maybe the only) way to do so is to wrapall access to object data with get and set methods This isone aspect of a concept often referred to asencapsulationand regarded as one of the key components of OOP In lan-guages such asSmalltalk (Kay 1993) or Ruby (Matsumotoand Ishituka 2002) fully dedicated to OOP this approach ismandatory A method call (a message send to an object) is

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1058 C A Sierra et al SOIL R v 10

the one and only way for objects to communicate with eachother

The S4 approach inR is much less strict and allowsdirect manipulation of the data belonging to an object bymeans of the operator(or the slot function respectively)thus revealing the implementation of an object to the out-side code using this object User code based onwill breakif the implementation changes and the desired slot disap-pears while a get method may be able to retrieve the de-sired information from other data The use of the slot op-erator from outside should therefore be avoided (Genolini2008 Gentleman 2003) Imagine for instance acircle ob-ject c thatstoresits radius andcomputesthe diameter whengetDiameter(c) is called If the radius is accessed solelyby calls ofgetRadius(c) the implementation of the circleclass can later be changed to store the diameter and computethe radiuswithoutany affect to outside code using the class

Applications to SOILRrsquosModel occur if one considers theincreasing number of constructors with redundant parametersets The distinction between parameters and derived vari-ables may even become difficult Differing fromSIMECOL

we unify access toModel elements and avoid a syntacticdifference of parameters and derived values as expressed bySIMECOLrsquos functionsparams andout In addition to theget functions we provide for all data intended to be ac-cessed from outside access through the typical operators[]and$ for our Model class This gives access to all data themodel can provide either during the initialization or com-puted by the methods of the class In fact[] and $ inter-nally use theget methods and may perform any numberof checks and computations to provide a consistent outputThis facility is powerful enough to avoid the use ofcom-pletely for our class This is exactly our intention since theimplementation of the class may change accessing its ele-ments viais strongly discouraged While we will maintainthe defined interface via[] $ and theget functionswe cannot guarantee that code relying onwill work in fu-ture versions of SOILR

Another difference withSIMECOL is also related to the[]operator It enables the user to create the desired output ondemand thus avoiding duplication between output objectsIf the user asks forC shehe getsC and nottimeandC which sometimes may not be intended if the user isconcerned about issues of memory or duplication Howeverit may be very useful to have both in other situations whenthe times argument to the constructor that created themodel in the first place is not available anymore With[]the user can decide which fields the output should contain

An additional intended feature of our[] operator is to al-ways producedataframes and not aResult objectthat would (or at least should) be more protective of its dataagainst alterations post simulation than adataframe Ifwe provided code to post-process results we would certainlyimplement such aResult class to make sure that ourpost-processing is based on valid data Since at the moment

we donrsquot we also do not force a structured output object tothe user

At the moment we do not even provide output asdeSolve objects since every structured output is part of theinterface and may be relied on by user code Although weare happy and thankful to usedeSolve extensively withinSOILR making it a part of the interface would be a promiseto the user that we will keep on supporting it which is a muchbigger commitment

Until now the responsibility beyond the scope of classModel stays with the user

Supplementary material related to this article isavailable online athttpwwwgeosci-model-devnet510452012gmd-5-1045-2012-supplementzip

AcknowledgementsFinancial support for the development of thisproject was provided by the Max Planck Society We would like tothank Ulrich Weber and Martin Jung for providing global climatedata used in the example Maarten Braakhekke provided helpfulcomments on a previous version of this manuscript

The service charges for this open access publicationhave been covered by the Max Planck Society

Edited by S Arndt

References

Adair E Parton W Del Grosso S Silver W Harmon MHall S Burke I and Hart S Simple three-pool modelaccurately describes patterns of long-term litter decomposi-tion in diverse climates Glob Change Biol 14 2636ndash2660doi101111j1365-2486200801674x 2008

Agren G and Bosatta E Theoretical ecosystem ecology under-standing element cycles Cambridge University Press 1998

Andren O and Katterer T ICBM The Introductory Carbon Bal-ance Model for Exploration of Soil Carbon Balances EcolAppl 7 1226ndash1236httpwwwjstororgstable2641210 1997

Bolker B M Pacala S W and Parton W J Linearanalysis of soil decomposition insights from the CEN-TURY model Ecol Appl 8 425ndash439doi1018901051-0761(1998)008[0425LAOSDI]20CO2 1998

Bruun S Six J Jensen L and Paustian K Estimating turnoverof soil organic carbon fractions based on radiocarbon measure-ments Radiocarbon 47 99ndash113 2008

Burger M Juenemann K and Koenig T RUnit R Unit testframework R package version 04 25 2009

Burke I Kaye J Bird S Hall S McCulley R and Som-merville G Evaluating and testing models of terrestrial biogeo-chemistry the role of temperature in controlling decompositionModels in ecosystem science Princeton University Press Prince-ton New Jersey USA 225ndash253 2003

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

1052 C A Sierra et al SOIL R v 10

library(SoilR) and the package is loaded intoyourR session

4 Examples

In this section we present examples on how to runsome of the functions implemented in SOILR basedon the theoretical framework presented previously Ad-ditional details about the implementations of each func-tion and instructions on how to implement new modelstructures are presented in the vignette lsquoImplementingCompartment Models in SOILR the GeneralModelFunctionrsquo provided with the package To view thisvignette simply typevignette(GeneralModelpackage=SoilR) in theR command shell

41 Implementation of a two pool model withconnection in series the ICBM model

One of the first models ever proposed to represent soil or-ganic matter dynamics was a two-pool model with connec-tion in series (cf Eq2 Henin et al 1959) More than50 yr laterAndren and Katterer(1997) proposed the ICBMmodel which is practically the same model proposed earlierby Henin et al(1959) but including a term for temperatureand moisture dependence of decomposition rates The set ofdifferential equations of the ICBM model are given by

dC1

dt= I minus k1ξC1

dC2

dt= αk1ξC1 minus k2ξC2 (17)

whereα is a humification or transfer coefficient andξ a pa-rameter representing external effects on decomposition ratesIn the ICBM modelC1 represents a ldquoyoungrdquo pool andC2 anldquooldrdquo pool This set of equations can be rewritten using ourmodel formulation which gives

dC

dt= I

(10

)+ ξ

(minusk1 0αk1 minusk2

)(C1C2

) (18)

with initial conditions(C10C20)T and where

A =

(minusk1 0a21 minusk2

)

with a21 = αk1 γ = 1 andξ(t) = ξ The function ICBMModel in SOILR implements this

model structure requiring as its arguments (1) a vector ofany length with the points in time when we are interested infinding a solution (2) a column vector of decomposition rates(k1k2)

T (3) the value ofα (4) the value ofξ (5) a columnvector with the initial amount of carbon at the beginning ofsimulation(C10C20)

T and (6) the mean annual carbon in-put to the soilI Andren and Katterer(1997) provided values

for these arguments from a 35-yr field experiment manipu-lating carbon and nitrogen inputs to an agricultural soil inSweden For the case of a treatment in which the soil wasleft as bare fallow without N or C inputs the ICBM modelcan be parameterized as

dC

dt= 0

(10

)+ 132

(minus08 0

013times 08 minus000605

)(C1C2

) (19)

with initial conditions(03396)T Assuming SOILR is already installed it is only necessary

to write the following lines of code to run the ICBM model

library(SoilR)times=seq(020by=01)Bare=ICBMModel(t=times ks=c(k1=08

k2=000605) h=013 r=132c0=c(C10=03C20=396) In=0)

The call toICBMModel simply initialize the model andchecks for consistency on its arguments In this example thedecomposition rates are given in units of yearminus1 and the ini-tial amounts of carbon in units of kg C mminus2

To obtain the amount of carbon over time it is necessary toinvoke the functiongetC storing the output into an objectFor example to store the amount of carbon from the objectBare the user can type

CtBare=getC(Bare)

This new objectCtBare is a matrix with 2 columns(2 pools) and 201 rows (201 points in time from 0 to 20in increments of 01) To obtain the total amount of carbonie the sum of the pools the R functionrowSums can beused For example plotting the total amount of carbon overtime as well as the carbon on each pool only requires theselines of code

plot(times rowSums(CtBare)type=lylim=c(05) ylab=Topsoil carbonmass (kg m-2)xlab=Time (years)lwd=2)

lines(times CtBare[1]lty=2)lines(timesCtBare[2]lty=3col=2lwd=2)legend(toprightc(Total carbon

Carbon in pool 1 Carbon in pool 2)lty=c(123)col=c(112)lwd=c(212)bty=n)

If the total amount of carbon is needed for further calcula-tions the output ofrowSums() can be stored in an objectwith any name

We implemented the different N and C treatments reportedin Andren and Katterer(1997) from the set of parametersreported by those authors The code necessary to reproduceFig 2 inAndren and Katterer(1997) is provided as an exam-ple with the functionICBMModel and can be accessed by

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1053

0 5 10 15 20

02

46

8

Time (years)

Tops

oil c

arbo

n m

ass

(kg

m-2

)

Bare fallow+N +Straw-N +Straw-N -Straw+N -StrawManureSludge

Fig 2 Model predictions with the version of the ICBM modelimplemented in SOILR This graph reproduces Fig 2 inAn-dren and Katterer(1997) This figure can be reproduced typ-ing example(ICBMModel) or attr(ICBMModelex) inSOILR

typing example(ICBMModel) or from the html help inR This code produces Fig2 which is identical to Fig 2 inAndren and Katterer(1997)

42 Alternative two-pool models

The ICBM model described in the previous section althoughuseful does not offer too much flexibility in terms of the in-put arguments For example the litter inputs to the systemcould vary over time as well as the temperature and moistureeffects on decomposition rates In addition there are otherpossibilities to implement a two pool model depending onthe type of connection between pools (Fig1)

The parallel pool model structure can be implemented withthe functionTwopParallelModel while a more gen-eral version of a series model structure can be implementedwith the functionTwopSeriesModel Similarly the feed-back model structure can be implemented with the functionTwopFeedbackModel The inputs of litter and the mod-ification of decomposition rates by external factors can beeither constant or a function of time Furthermore the func-tions presented in Table1 and their combinations can beused as arguments in the different model structures provid-ing a large variety of options to model decomposition withjust two pools In fact the same flexibility can be obtainedwith any number of pools with the application of the moregeneral functionGeneralModel

As an example we show the differences obtained by run-ning three different versions of a two-pool model with the

0 5 10 15 20

05

1015

20

Car

bon

stoc

ks (a

rbitr

ary

units

) Two-pool ParallelTwo-pool SeriesTwo-pool Feedback

0 5 10 15 20

00051015202530

Time

Car

bon

rele

ase

(arb

itrar

y un

its)

Fig 3 Examples of three different representations of a two-poolmodel with different model structures and environmental effects ondecomposition rates The upper panel shows carbon stocks and thelower panel carbon release Additional details about the implemen-tation are given in the text

same amount of carbon at the beginning of the simulationsimilar rates of litter inputs and equal decomposition rates(Fig 3) As an illustration we also ran the simulations withdifferent options for the time dependence of the litter inputsand the decomposition rates In the first simulation we ran amodel with a structure of parallel compartments In this sim-ulation the litter inputs and decomposition rates were con-stant but the decomposition rates were modified by averagevalues of temperature and moisture according to the func-tions proposed in the Daycent model (Table1) For the sec-ond simulation we ran a two-pool model with connectionin series introducing temporal variability in the amount ofinputs using a sine function that artificially represents an an-nual cycle In the third simulation we ran a two-pool modelwith connection in series among compartments The amountof litter inputs over time were calculated using random num-bers over time In this simulation we also produced ran-dom numbers of temperature and moisture and applied thefunctions to modify decomposition rates according to theCentury and the Demeter models (Fig3) The code to re-produce Fig3 is provided in the example of the functionTwopFeedbackModel

These simulations without being necessarily realisticsimply show that small differences in model structure canproduce very different predictions even when the main pa-rameters of the model remain unchanged The simulationsalso serve to illustrate different possibilities in the use of the

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1054 C A Sierra et al SOIL R v 10

basic functions of SOILR to represent the process of organicmatter decomposition over time

To implement more sophisticated models with a higher de-gree of complexity it is possible to specify a larger amount ofpools with complex functions representing the dependence oflitter inputs decomposition rates and transfer between poolswith other external variables such as temperature moisturesoil texture nutrient status among many other

43 Implementation of the RothC model

RothC is a popular and widely used model for predicting or-ganic matter dynamics over time Although earlier versionsof the model included five active pools and one inert pool(Jenkinson and Rayner 1977) more recent versions only in-clude four active pools plus the inert pool (Jenkinson et al1990) RothC is implemented within SOILR and we providedetails here about this implementation to illustrate the useand potential implementation of any other model RothC canbe described by the following set of differential equations

dC1

dt= γ I minus k1C1

dC2

dt= (1minus γ )I minus k2C2

dC3

dt= α31k1C1 + α32k2C2 minus k3C3 + α33k3C3 + α34k4C4

dC4

dt= α41k1C1 + α42k2C2 + α43k3C3 minus k4C4 + α44k4C4

dC5

dt= 0 (20)

whereC1 represents the decomposable plant material (DPM)poolC2 the resistant plant material (RPM) poolC3 the mi-crobial biomass (BIO) poolC4 the humified organic matter(HUM) pool andC5 the inert organic matter pool (IOM)This set of equations can be rewritten in the form

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0α31k1 α32k2 minusk3(1minus α33) α34k4 0α41k1 α42k2 α43k3 minusk4(1minus α44) 0

0 0 0 0 0

C1C2C3C4C5

or as

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0a31 a32 minusk3 + a33 a34 0a41 a42 a43 minusk4 + a44 00 0 0 0 0

C1C2C3C4C5

(21)

The values of the decomposition rates are constant and givenby k1 = 10 k2 = 03 k3 = 066 andk4 = 002 (Jenkinsonet al 1990 Coleman and Jenkinson 1999) The value ofthe transfer coefficients is determined by a function of soiltexture For the microbial biomass pool transfer coefficientsare calculated as

a3j = kj

046

x + 1(22)

wherex is a value that determines the proportion of decom-posed material that is respired as CO2 and is given by

x = 167(185+ 160exp(minus00786pClay)) (23)

wherepClay is percent clay in mineral soil (Jenkinson et al1990) Similarly the transfer coefficients for the humifiedpool are given by

a4j = kj

054

x + 1 (24)

The partitioning of incoming plant material is determinedby the ratio DPMRPM which in RothC is set as 144 There-foreγ = 059 Now the basic structure of the RothC modelcan be written as

dC

dt= I

059041

000

+

minus10 0 0 0 0

0 minus03 0 0 0102 003 minus059 001 0119 004 008 minus002 0

0 0 0 0 0

C1C2C3C4C5

(25)

The annual amount of inputs is set in the RothC model asI = 17 Mg C haminus1 yrminus1

With this parameterization it is possible to run the RothCmodel without varying environmental effects on decompo-sition rates and observe how the system approaches steady-state for the different pools (Fig4) Parameter values ini-tial conditions and litter inputs can be changed easily withinSOILR to compare different predictions from this model

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1055

0 100 200 300 400 500

05

1015

2025

Time (years)

Car

bon

stor

es (M

g Cha

minus1)

Pool 1 DPMPool 2 RPMPool 3 BIOPool 4 HUMPool 5 IOMTotal Carbon

Fig 4 Carbon accumulation for the different pools included in theRothC model DPM the decomposable plant material pool RPMresistant plant material BIO microbial biomass pool HUM humi-fied organic matterpool and IOM inert organic matter pool

44 Applications for large-scale modeling

R can handle a large variety of data structures which offersinteresting possibilities for the application of the functionsimplemented in SOILR One important type of data structureis spatial data with global coverage There is a large numberof R packages to import and manipulate spatial data whichfacilitates the technical aspects for running SOILR functionsat the global scale

As an example we show here a simple calculation of cli-mate decomposition indexes (CDIs) (Adair et al 2008) us-ing a global dataset of temperature precipitation and po-tential evapotranspiration available at 05 degree resolutionon NetCDF files from the WATCH dataset (Weedon et al2011) The input dataset contained monthly average tempera-ture precipitation and evapotranspiration for the period 1958to 2001 We calculated the CDIs as

CDI = ξ(t) = f (T )f (W) (26)

with f (T ) implemented by the functionfTCentury1 andf (W) by the functionfWCentury as described in Ta-ble 1 Results can be easily plotted on a map (Fig5) andexported again to NetCDF files Different combinations ofthe functions described in Table1 can be used to calculateCDIs (Adair et al 2008) and evaluate different hypothesesabout the response of decomposition rates to moisture tem-perature and other variables

Longitude

Latit

ude

02

04

06

08

Fig 5 Climate decomposition index (CDI) calculated as the prod-uct of a function of temperature (fTCentury1 ) and a function ofprecipitation and potential evapotranspiration (fWCentury ) us-ing monthly data from the WATCH dataset (Weedon et al 2011)

5 Discussion

Many models of soil organic matter decomposition have beenproposed previously and there even exist some open-sourcetools to implement some of these models (egEaster et al2007) We have developed a tool for implementing and run-ning a large variety of these models with the idea of facili-tating comparison among multiple models in an easy to useinterface In this section we discuss some of the advantagesand disadvantages of our approach

51 Parameter space and structural domain

Models of organic matter decomposition are basically hypo-thetical abstractions about the structure and dynamics of soilorganic matter The multitude of models previously devel-oped suggests that there exists a large number of hypothesesabout the structure and functioning of soil organic matterbut there is basically little consensus on whether one modelstructure (hypothesis) would have more support on observa-tions than other model structures (Manzoni and Porporato2009)

The majority of modeling studies have focused on findingthe set of parameter values of a particular model that bestfit some observed data This approach is useful and has pro-vided much insight on understanding the rates of soil organicmatter decomposition However from the perspective of as-sessing different hypotheses about the structure and dynam-ics of soil organic matter parameter estimation can only givea narrow view of the more complex spectrum resulting from

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1056 C A Sierra et al SOIL R v 10

the combination of structure domain and the parameter spaceof models

SOILR provides the possibility of assessing both modelstructure and parameter values broadening the spectrum ofideas that can be assessed within one single analytical frame-work

We believe this approach complements well and could beeven more powerful than previous approaches to assess per-formance of model structure with inter-comparisons amongdifferent modeling groups (egMelillo et al 1995 Wu andMcGechan 1998 Cramer et al 2001 Randerson et al2009) Multi-model inter-comparison projects do not neces-sarily cover the whole domain of model structures and maybe subject to important issues such as independence of codebias of the whole model ensemble inappropriate metrics todefine model performance etc (Knutti et al 2009 Knutti2010) SOILR can partially help to overcome some of theseproblems for assessing the performance of model structurethrough the option of using alternative functions to representthe same process Philosophically this approach is also sim-ilar to testing multiple working hypotheses

52 Model hierarchies and functional programing

The gap between simulations and understanding describedby Held (2005) is currently exacerbated by the continuousincrease in detail and complexity of simulation modelsHeld(2005) suggests that a way forward to close the gap be-tween simulations and understanding is by the developmentof model hierarchies in which large-scale complex modelsare particular cases of general models that are more amenablefor understanding of system structure and behavior

SOILR can also be viewed as a system for hierarchicalmodeling of soil processes Consider for example the envi-ronmental or external effects on decomposition rates whichhere are denoted by the termξ(t) In its more simple andgeneral case the external effects can be simply a constant(ξ(t) = c) that allows the understanding of model behaviorwithout changes in environmental conditions Simulationscan then be run with a changing environment for exam-ple with variable soil moisture (ξ(t) = f (W(t))) Soil mois-ture could depend on other variables such as precipitationand potential evapotranspiration (W(t) = f (P (t)PET(t)))which in turn can be dependent on other functions In thisform a hierarchy of models is build with the dependence ofdifferent functions on other functions

In terms of programing this concept of model hierarchiescan be easily implemented in a functional programing styleA function that performs certain tasks can have as its argu-ments other functions that perform other tasks These func-tions can be independent among each other so many differentfunctions that perform the same task can be available withinthe same modeling environment This is one of our goals withSOILR to provide a modeling environment that serves as arepository of different functions that can perform the same

task so their performance can be easily compared It also al-lows building soil organic matter decomposition models ina hierarchical framework because functions can have a largenumber of dependences on other functions creating a bridgebetween simple general models and detailed modeling con-structions under the same basic principles

53 Scope and limitations

Our approach to soil organic matter decomposition modelingwith SOILR may have some limitations One potential limi-tation is the use of a high-level programing language that canhave issues in terms of computational efficiency This couldbe an important problem if specific models structures witha large number of computations per time step are applied toa large number of points such as a large spatial grid Otherprograming languages such asC or Fortran may be moresuitable for these tasks although a good programing stylecan avoid many issues of computational efficiency inR It isimportant to keep in mind that the scope of SOILR is morefor the exploration of different model structures and hypothe-ses about soil processes rather than for large computationaltasks however some parallelization tools withinR could beused for this purpose We recommend that once a specificmodel structure is identified as useful for a large computa-tion the entire model object is translated to other languageor optimized for running inR We are exploring these possi-bilities to include in future releases of SOILR

Another potential limitation is the incompatibility of ourconceptual framework to represent the decomposition pro-cess as a non-linear dynamical system Non-linear dynamicsare important for representing microbial processes such aspriming and are very relevant for simulations at short timescales (Wutzler and Reichstein 2008 Manzoni and Porpo-rato 2007 2009) Non-linear models however can be eas-ily implemented inR with the deSolve package We areconsidering two possibilities to include non-linear dynamicalsystems within our theoretical framework One possibility isto provide a framework to specify and linearize non-linearsystems and solve the linear equations as presented here An-other possibility is to include a set of non-linear models solv-ing them directly withdeSolve We aim for further releasesto include this additional functionality

6 Conclusions

We have developed a modeling environment for represent-ing the process of soil organic matter decomposition Thistool SOILR is an open- source package for the implemen-tation and testing of different representations of the processof soil organic matter decomposition The main character-istic of SOILR is its hierarchical structure in which we de-scribe a general model that can accommodate any possiblemodel structure of a multi-pool model of decomposition

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1057

More detailed models can be implemented to simulate spe-cific controls on the decomposition process This allows fortesting of multiple working hypotheses about the structureand functioning of soils and their behavior over time SOILRnot only allows for exploring dynamics on the parameterspace of a model but also on the structural domain

This first version of SOILR allows simulations of organicmatter decomposition and future versions will include rep-resentations of other biogeochemical elements such as nitro-gen and phosphorus as well as their isotopic composition Amodule for parameter fitting will also be included in futurereleases

Appendix A

Implementation details and design decisions regardingSOIL R

A1 The choice of the object-oriented programing(OOP) system

While in object oriented languages the implementation of ob-ject oriented design principles is usually hardwired inR itis a choice between at least three different approaches thusforcing the user to explain why a particular system was usedIn our case the choice ofS4 is a compromise On one handthere is very limited support inS4 for real encapsulation ex-pressed most notably by the possibility to read and even writethe values of slots from outside the class by theslot func-tion or theoperator respectively This default behavior isactually not even trivially changed On the other hand thereare some important advantages

1 Compatibility with the functional paradigm ofR and itsassociated benefits such as lazy evaluation concurrencyand in the future maybe even automatic parallelizationwhich depends on the absence of side effects (unavoid-able with a reference based system likeR5)

2 The integration withRrsquos standard library which in-creases

a the probability of future maintenance and

b acceptance by otherR users

3 The relative seamless integration to commonR work-flows without in depth knowledge of object orientedprograming

Considering that ifR is capable to implement an OOPsystem by means of on board tools it will probably be flexibleenough to change the default behavior of this OOP systemwith on board tools as well SOILR is a rather small packageand we thinkS4 is and appropriate choice for our needs

A2 Comparison betweenSIMECOL and SOIL R

SIMECOL (Petzoldt and Rinke 2007) an R package for theimplementation of ecological models is an alternative to ourown implementation Here we compare the two approachesin terms of their design

A21 Scope

SOILR is focused solely on soil organic matter decompo-sition while SIMECOL aims to be a general framework forecological modeling inR SIMECOL represents an abstrac-tion level somewhere between SOILR andRrsquos S4 systemHence the obvious way for SOILR to make use ofSIMECOL

would be to implement ourModel class as a subclass ofSIMECOL rsquos simObj One motivation to do so consists in thepossibility to inherit functionality from the ancestor which isusually additionally shared by other subclasses thus enablingeasier communication between them Whether subclassing isthe appropriate strategy thus depends on the amount of in-heritable code and the number of subclasses We found thatwithin SOILR Model would be the only one subclass ofSIMECOLrsquos model with nearly no code shared owing to dif-ferences in functionality and design goals (see below)

A22 Functionality

One major difference withSIMECOLrsquos simObj is thatSOILRrsquos Model initialize method requires objects of classTimeMap or its subclasses thus guaranteeing that the dif-ferent objects conforming a model share a common supportin the time domain even if the creation ofTimeMap ob-jects usually takes place far away from the initialization of aModel object since this usually happens behind the sceneseg by conversion ofdataframes the user provides asinput This is a significant difference fromSIMECOLrsquos ap-proach Implementing this functionality in a subclass ofSIMECOLrsquos model would be misleading and would not con-form well with our design goals

A23 Design goals

The main aim of SOILRrsquos Model class is to provide a fencebetween interface and implementation While the interfaceshould change as little as possible to protect code using theclass we want to have as much freedom as possible to changeits implementation We strive to achieve this by avoiding ev-ery possible syntactic distinction between references to ob-ject data and object methods from the outside WithRrsquos S4system one (and maybe the only) way to do so is to wrapall access to object data with get and set methods This isone aspect of a concept often referred to asencapsulationand regarded as one of the key components of OOP In lan-guages such asSmalltalk (Kay 1993) or Ruby (Matsumotoand Ishituka 2002) fully dedicated to OOP this approach ismandatory A method call (a message send to an object) is

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1058 C A Sierra et al SOIL R v 10

the one and only way for objects to communicate with eachother

The S4 approach inR is much less strict and allowsdirect manipulation of the data belonging to an object bymeans of the operator(or the slot function respectively)thus revealing the implementation of an object to the out-side code using this object User code based onwill breakif the implementation changes and the desired slot disap-pears while a get method may be able to retrieve the de-sired information from other data The use of the slot op-erator from outside should therefore be avoided (Genolini2008 Gentleman 2003) Imagine for instance acircle ob-ject c thatstoresits radius andcomputesthe diameter whengetDiameter(c) is called If the radius is accessed solelyby calls ofgetRadius(c) the implementation of the circleclass can later be changed to store the diameter and computethe radiuswithoutany affect to outside code using the class

Applications to SOILRrsquosModel occur if one considers theincreasing number of constructors with redundant parametersets The distinction between parameters and derived vari-ables may even become difficult Differing fromSIMECOL

we unify access toModel elements and avoid a syntacticdifference of parameters and derived values as expressed bySIMECOLrsquos functionsparams andout In addition to theget functions we provide for all data intended to be ac-cessed from outside access through the typical operators[]and$ for our Model class This gives access to all data themodel can provide either during the initialization or com-puted by the methods of the class In fact[] and $ inter-nally use theget methods and may perform any numberof checks and computations to provide a consistent outputThis facility is powerful enough to avoid the use ofcom-pletely for our class This is exactly our intention since theimplementation of the class may change accessing its ele-ments viais strongly discouraged While we will maintainthe defined interface via[] $ and theget functionswe cannot guarantee that code relying onwill work in fu-ture versions of SOILR

Another difference withSIMECOL is also related to the[]operator It enables the user to create the desired output ondemand thus avoiding duplication between output objectsIf the user asks forC shehe getsC and nottimeandC which sometimes may not be intended if the user isconcerned about issues of memory or duplication Howeverit may be very useful to have both in other situations whenthe times argument to the constructor that created themodel in the first place is not available anymore With[]the user can decide which fields the output should contain

An additional intended feature of our[] operator is to al-ways producedataframes and not aResult objectthat would (or at least should) be more protective of its dataagainst alterations post simulation than adataframe Ifwe provided code to post-process results we would certainlyimplement such aResult class to make sure that ourpost-processing is based on valid data Since at the moment

we donrsquot we also do not force a structured output object tothe user

At the moment we do not even provide output asdeSolve objects since every structured output is part of theinterface and may be relied on by user code Although weare happy and thankful to usedeSolve extensively withinSOILR making it a part of the interface would be a promiseto the user that we will keep on supporting it which is a muchbigger commitment

Until now the responsibility beyond the scope of classModel stays with the user

Supplementary material related to this article isavailable online athttpwwwgeosci-model-devnet510452012gmd-5-1045-2012-supplementzip

AcknowledgementsFinancial support for the development of thisproject was provided by the Max Planck Society We would like tothank Ulrich Weber and Martin Jung for providing global climatedata used in the example Maarten Braakhekke provided helpfulcomments on a previous version of this manuscript

The service charges for this open access publicationhave been covered by the Max Planck Society

Edited by S Arndt

References

Adair E Parton W Del Grosso S Silver W Harmon MHall S Burke I and Hart S Simple three-pool modelaccurately describes patterns of long-term litter decomposi-tion in diverse climates Glob Change Biol 14 2636ndash2660doi101111j1365-2486200801674x 2008

Agren G and Bosatta E Theoretical ecosystem ecology under-standing element cycles Cambridge University Press 1998

Andren O and Katterer T ICBM The Introductory Carbon Bal-ance Model for Exploration of Soil Carbon Balances EcolAppl 7 1226ndash1236httpwwwjstororgstable2641210 1997

Bolker B M Pacala S W and Parton W J Linearanalysis of soil decomposition insights from the CEN-TURY model Ecol Appl 8 425ndash439doi1018901051-0761(1998)008[0425LAOSDI]20CO2 1998

Bruun S Six J Jensen L and Paustian K Estimating turnoverof soil organic carbon fractions based on radiocarbon measure-ments Radiocarbon 47 99ndash113 2008

Burger M Juenemann K and Koenig T RUnit R Unit testframework R package version 04 25 2009

Burke I Kaye J Bird S Hall S McCulley R and Som-merville G Evaluating and testing models of terrestrial biogeo-chemistry the role of temperature in controlling decompositionModels in ecosystem science Princeton University Press Prince-ton New Jersey USA 225ndash253 2003

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1053

0 5 10 15 20

02

46

8

Time (years)

Tops

oil c

arbo

n m

ass

(kg

m-2

)

Bare fallow+N +Straw-N +Straw-N -Straw+N -StrawManureSludge

Fig 2 Model predictions with the version of the ICBM modelimplemented in SOILR This graph reproduces Fig 2 inAn-dren and Katterer(1997) This figure can be reproduced typ-ing example(ICBMModel) or attr(ICBMModelex) inSOILR

typing example(ICBMModel) or from the html help inR This code produces Fig2 which is identical to Fig 2 inAndren and Katterer(1997)

42 Alternative two-pool models

The ICBM model described in the previous section althoughuseful does not offer too much flexibility in terms of the in-put arguments For example the litter inputs to the systemcould vary over time as well as the temperature and moistureeffects on decomposition rates In addition there are otherpossibilities to implement a two pool model depending onthe type of connection between pools (Fig1)

The parallel pool model structure can be implemented withthe functionTwopParallelModel while a more gen-eral version of a series model structure can be implementedwith the functionTwopSeriesModel Similarly the feed-back model structure can be implemented with the functionTwopFeedbackModel The inputs of litter and the mod-ification of decomposition rates by external factors can beeither constant or a function of time Furthermore the func-tions presented in Table1 and their combinations can beused as arguments in the different model structures provid-ing a large variety of options to model decomposition withjust two pools In fact the same flexibility can be obtainedwith any number of pools with the application of the moregeneral functionGeneralModel

As an example we show the differences obtained by run-ning three different versions of a two-pool model with the

0 5 10 15 20

05

1015

20

Car

bon

stoc

ks (a

rbitr

ary

units

) Two-pool ParallelTwo-pool SeriesTwo-pool Feedback

0 5 10 15 20

00051015202530

Time

Car

bon

rele

ase

(arb

itrar

y un

its)

Fig 3 Examples of three different representations of a two-poolmodel with different model structures and environmental effects ondecomposition rates The upper panel shows carbon stocks and thelower panel carbon release Additional details about the implemen-tation are given in the text

same amount of carbon at the beginning of the simulationsimilar rates of litter inputs and equal decomposition rates(Fig 3) As an illustration we also ran the simulations withdifferent options for the time dependence of the litter inputsand the decomposition rates In the first simulation we ran amodel with a structure of parallel compartments In this sim-ulation the litter inputs and decomposition rates were con-stant but the decomposition rates were modified by averagevalues of temperature and moisture according to the func-tions proposed in the Daycent model (Table1) For the sec-ond simulation we ran a two-pool model with connectionin series introducing temporal variability in the amount ofinputs using a sine function that artificially represents an an-nual cycle In the third simulation we ran a two-pool modelwith connection in series among compartments The amountof litter inputs over time were calculated using random num-bers over time In this simulation we also produced ran-dom numbers of temperature and moisture and applied thefunctions to modify decomposition rates according to theCentury and the Demeter models (Fig3) The code to re-produce Fig3 is provided in the example of the functionTwopFeedbackModel

These simulations without being necessarily realisticsimply show that small differences in model structure canproduce very different predictions even when the main pa-rameters of the model remain unchanged The simulationsalso serve to illustrate different possibilities in the use of the

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1054 C A Sierra et al SOIL R v 10

basic functions of SOILR to represent the process of organicmatter decomposition over time

To implement more sophisticated models with a higher de-gree of complexity it is possible to specify a larger amount ofpools with complex functions representing the dependence oflitter inputs decomposition rates and transfer between poolswith other external variables such as temperature moisturesoil texture nutrient status among many other

43 Implementation of the RothC model

RothC is a popular and widely used model for predicting or-ganic matter dynamics over time Although earlier versionsof the model included five active pools and one inert pool(Jenkinson and Rayner 1977) more recent versions only in-clude four active pools plus the inert pool (Jenkinson et al1990) RothC is implemented within SOILR and we providedetails here about this implementation to illustrate the useand potential implementation of any other model RothC canbe described by the following set of differential equations

dC1

dt= γ I minus k1C1

dC2

dt= (1minus γ )I minus k2C2

dC3

dt= α31k1C1 + α32k2C2 minus k3C3 + α33k3C3 + α34k4C4

dC4

dt= α41k1C1 + α42k2C2 + α43k3C3 minus k4C4 + α44k4C4

dC5

dt= 0 (20)

whereC1 represents the decomposable plant material (DPM)poolC2 the resistant plant material (RPM) poolC3 the mi-crobial biomass (BIO) poolC4 the humified organic matter(HUM) pool andC5 the inert organic matter pool (IOM)This set of equations can be rewritten in the form

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0α31k1 α32k2 minusk3(1minus α33) α34k4 0α41k1 α42k2 α43k3 minusk4(1minus α44) 0

0 0 0 0 0

C1C2C3C4C5

or as

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0a31 a32 minusk3 + a33 a34 0a41 a42 a43 minusk4 + a44 00 0 0 0 0

C1C2C3C4C5

(21)

The values of the decomposition rates are constant and givenby k1 = 10 k2 = 03 k3 = 066 andk4 = 002 (Jenkinsonet al 1990 Coleman and Jenkinson 1999) The value ofthe transfer coefficients is determined by a function of soiltexture For the microbial biomass pool transfer coefficientsare calculated as

a3j = kj

046

x + 1(22)

wherex is a value that determines the proportion of decom-posed material that is respired as CO2 and is given by

x = 167(185+ 160exp(minus00786pClay)) (23)

wherepClay is percent clay in mineral soil (Jenkinson et al1990) Similarly the transfer coefficients for the humifiedpool are given by

a4j = kj

054

x + 1 (24)

The partitioning of incoming plant material is determinedby the ratio DPMRPM which in RothC is set as 144 There-foreγ = 059 Now the basic structure of the RothC modelcan be written as

dC

dt= I

059041

000

+

minus10 0 0 0 0

0 minus03 0 0 0102 003 minus059 001 0119 004 008 minus002 0

0 0 0 0 0

C1C2C3C4C5

(25)

The annual amount of inputs is set in the RothC model asI = 17 Mg C haminus1 yrminus1

With this parameterization it is possible to run the RothCmodel without varying environmental effects on decompo-sition rates and observe how the system approaches steady-state for the different pools (Fig4) Parameter values ini-tial conditions and litter inputs can be changed easily withinSOILR to compare different predictions from this model

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1055

0 100 200 300 400 500

05

1015

2025

Time (years)

Car

bon

stor

es (M

g Cha

minus1)

Pool 1 DPMPool 2 RPMPool 3 BIOPool 4 HUMPool 5 IOMTotal Carbon

Fig 4 Carbon accumulation for the different pools included in theRothC model DPM the decomposable plant material pool RPMresistant plant material BIO microbial biomass pool HUM humi-fied organic matterpool and IOM inert organic matter pool

44 Applications for large-scale modeling

R can handle a large variety of data structures which offersinteresting possibilities for the application of the functionsimplemented in SOILR One important type of data structureis spatial data with global coverage There is a large numberof R packages to import and manipulate spatial data whichfacilitates the technical aspects for running SOILR functionsat the global scale

As an example we show here a simple calculation of cli-mate decomposition indexes (CDIs) (Adair et al 2008) us-ing a global dataset of temperature precipitation and po-tential evapotranspiration available at 05 degree resolutionon NetCDF files from the WATCH dataset (Weedon et al2011) The input dataset contained monthly average tempera-ture precipitation and evapotranspiration for the period 1958to 2001 We calculated the CDIs as

CDI = ξ(t) = f (T )f (W) (26)

with f (T ) implemented by the functionfTCentury1 andf (W) by the functionfWCentury as described in Ta-ble 1 Results can be easily plotted on a map (Fig5) andexported again to NetCDF files Different combinations ofthe functions described in Table1 can be used to calculateCDIs (Adair et al 2008) and evaluate different hypothesesabout the response of decomposition rates to moisture tem-perature and other variables

Longitude

Latit

ude

02

04

06

08

Fig 5 Climate decomposition index (CDI) calculated as the prod-uct of a function of temperature (fTCentury1 ) and a function ofprecipitation and potential evapotranspiration (fWCentury ) us-ing monthly data from the WATCH dataset (Weedon et al 2011)

5 Discussion

Many models of soil organic matter decomposition have beenproposed previously and there even exist some open-sourcetools to implement some of these models (egEaster et al2007) We have developed a tool for implementing and run-ning a large variety of these models with the idea of facili-tating comparison among multiple models in an easy to useinterface In this section we discuss some of the advantagesand disadvantages of our approach

51 Parameter space and structural domain

Models of organic matter decomposition are basically hypo-thetical abstractions about the structure and dynamics of soilorganic matter The multitude of models previously devel-oped suggests that there exists a large number of hypothesesabout the structure and functioning of soil organic matterbut there is basically little consensus on whether one modelstructure (hypothesis) would have more support on observa-tions than other model structures (Manzoni and Porporato2009)

The majority of modeling studies have focused on findingthe set of parameter values of a particular model that bestfit some observed data This approach is useful and has pro-vided much insight on understanding the rates of soil organicmatter decomposition However from the perspective of as-sessing different hypotheses about the structure and dynam-ics of soil organic matter parameter estimation can only givea narrow view of the more complex spectrum resulting from

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1056 C A Sierra et al SOIL R v 10

the combination of structure domain and the parameter spaceof models

SOILR provides the possibility of assessing both modelstructure and parameter values broadening the spectrum ofideas that can be assessed within one single analytical frame-work

We believe this approach complements well and could beeven more powerful than previous approaches to assess per-formance of model structure with inter-comparisons amongdifferent modeling groups (egMelillo et al 1995 Wu andMcGechan 1998 Cramer et al 2001 Randerson et al2009) Multi-model inter-comparison projects do not neces-sarily cover the whole domain of model structures and maybe subject to important issues such as independence of codebias of the whole model ensemble inappropriate metrics todefine model performance etc (Knutti et al 2009 Knutti2010) SOILR can partially help to overcome some of theseproblems for assessing the performance of model structurethrough the option of using alternative functions to representthe same process Philosophically this approach is also sim-ilar to testing multiple working hypotheses

52 Model hierarchies and functional programing

The gap between simulations and understanding describedby Held (2005) is currently exacerbated by the continuousincrease in detail and complexity of simulation modelsHeld(2005) suggests that a way forward to close the gap be-tween simulations and understanding is by the developmentof model hierarchies in which large-scale complex modelsare particular cases of general models that are more amenablefor understanding of system structure and behavior

SOILR can also be viewed as a system for hierarchicalmodeling of soil processes Consider for example the envi-ronmental or external effects on decomposition rates whichhere are denoted by the termξ(t) In its more simple andgeneral case the external effects can be simply a constant(ξ(t) = c) that allows the understanding of model behaviorwithout changes in environmental conditions Simulationscan then be run with a changing environment for exam-ple with variable soil moisture (ξ(t) = f (W(t))) Soil mois-ture could depend on other variables such as precipitationand potential evapotranspiration (W(t) = f (P (t)PET(t)))which in turn can be dependent on other functions In thisform a hierarchy of models is build with the dependence ofdifferent functions on other functions

In terms of programing this concept of model hierarchiescan be easily implemented in a functional programing styleA function that performs certain tasks can have as its argu-ments other functions that perform other tasks These func-tions can be independent among each other so many differentfunctions that perform the same task can be available withinthe same modeling environment This is one of our goals withSOILR to provide a modeling environment that serves as arepository of different functions that can perform the same

task so their performance can be easily compared It also al-lows building soil organic matter decomposition models ina hierarchical framework because functions can have a largenumber of dependences on other functions creating a bridgebetween simple general models and detailed modeling con-structions under the same basic principles

53 Scope and limitations

Our approach to soil organic matter decomposition modelingwith SOILR may have some limitations One potential limi-tation is the use of a high-level programing language that canhave issues in terms of computational efficiency This couldbe an important problem if specific models structures witha large number of computations per time step are applied toa large number of points such as a large spatial grid Otherprograming languages such asC or Fortran may be moresuitable for these tasks although a good programing stylecan avoid many issues of computational efficiency inR It isimportant to keep in mind that the scope of SOILR is morefor the exploration of different model structures and hypothe-ses about soil processes rather than for large computationaltasks however some parallelization tools withinR could beused for this purpose We recommend that once a specificmodel structure is identified as useful for a large computa-tion the entire model object is translated to other languageor optimized for running inR We are exploring these possi-bilities to include in future releases of SOILR

Another potential limitation is the incompatibility of ourconceptual framework to represent the decomposition pro-cess as a non-linear dynamical system Non-linear dynamicsare important for representing microbial processes such aspriming and are very relevant for simulations at short timescales (Wutzler and Reichstein 2008 Manzoni and Porpo-rato 2007 2009) Non-linear models however can be eas-ily implemented inR with the deSolve package We areconsidering two possibilities to include non-linear dynamicalsystems within our theoretical framework One possibility isto provide a framework to specify and linearize non-linearsystems and solve the linear equations as presented here An-other possibility is to include a set of non-linear models solv-ing them directly withdeSolve We aim for further releasesto include this additional functionality

6 Conclusions

We have developed a modeling environment for represent-ing the process of soil organic matter decomposition Thistool SOILR is an open- source package for the implemen-tation and testing of different representations of the processof soil organic matter decomposition The main character-istic of SOILR is its hierarchical structure in which we de-scribe a general model that can accommodate any possiblemodel structure of a multi-pool model of decomposition

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1057

More detailed models can be implemented to simulate spe-cific controls on the decomposition process This allows fortesting of multiple working hypotheses about the structureand functioning of soils and their behavior over time SOILRnot only allows for exploring dynamics on the parameterspace of a model but also on the structural domain

This first version of SOILR allows simulations of organicmatter decomposition and future versions will include rep-resentations of other biogeochemical elements such as nitro-gen and phosphorus as well as their isotopic composition Amodule for parameter fitting will also be included in futurereleases

Appendix A

Implementation details and design decisions regardingSOIL R

A1 The choice of the object-oriented programing(OOP) system

While in object oriented languages the implementation of ob-ject oriented design principles is usually hardwired inR itis a choice between at least three different approaches thusforcing the user to explain why a particular system was usedIn our case the choice ofS4 is a compromise On one handthere is very limited support inS4 for real encapsulation ex-pressed most notably by the possibility to read and even writethe values of slots from outside the class by theslot func-tion or theoperator respectively This default behavior isactually not even trivially changed On the other hand thereare some important advantages

1 Compatibility with the functional paradigm ofR and itsassociated benefits such as lazy evaluation concurrencyand in the future maybe even automatic parallelizationwhich depends on the absence of side effects (unavoid-able with a reference based system likeR5)

2 The integration withRrsquos standard library which in-creases

a the probability of future maintenance and

b acceptance by otherR users

3 The relative seamless integration to commonR work-flows without in depth knowledge of object orientedprograming

Considering that ifR is capable to implement an OOPsystem by means of on board tools it will probably be flexibleenough to change the default behavior of this OOP systemwith on board tools as well SOILR is a rather small packageand we thinkS4 is and appropriate choice for our needs

A2 Comparison betweenSIMECOL and SOIL R

SIMECOL (Petzoldt and Rinke 2007) an R package for theimplementation of ecological models is an alternative to ourown implementation Here we compare the two approachesin terms of their design

A21 Scope

SOILR is focused solely on soil organic matter decompo-sition while SIMECOL aims to be a general framework forecological modeling inR SIMECOL represents an abstrac-tion level somewhere between SOILR andRrsquos S4 systemHence the obvious way for SOILR to make use ofSIMECOL

would be to implement ourModel class as a subclass ofSIMECOL rsquos simObj One motivation to do so consists in thepossibility to inherit functionality from the ancestor which isusually additionally shared by other subclasses thus enablingeasier communication between them Whether subclassing isthe appropriate strategy thus depends on the amount of in-heritable code and the number of subclasses We found thatwithin SOILR Model would be the only one subclass ofSIMECOLrsquos model with nearly no code shared owing to dif-ferences in functionality and design goals (see below)

A22 Functionality

One major difference withSIMECOLrsquos simObj is thatSOILRrsquos Model initialize method requires objects of classTimeMap or its subclasses thus guaranteeing that the dif-ferent objects conforming a model share a common supportin the time domain even if the creation ofTimeMap ob-jects usually takes place far away from the initialization of aModel object since this usually happens behind the sceneseg by conversion ofdataframes the user provides asinput This is a significant difference fromSIMECOLrsquos ap-proach Implementing this functionality in a subclass ofSIMECOLrsquos model would be misleading and would not con-form well with our design goals

A23 Design goals

The main aim of SOILRrsquos Model class is to provide a fencebetween interface and implementation While the interfaceshould change as little as possible to protect code using theclass we want to have as much freedom as possible to changeits implementation We strive to achieve this by avoiding ev-ery possible syntactic distinction between references to ob-ject data and object methods from the outside WithRrsquos S4system one (and maybe the only) way to do so is to wrapall access to object data with get and set methods This isone aspect of a concept often referred to asencapsulationand regarded as one of the key components of OOP In lan-guages such asSmalltalk (Kay 1993) or Ruby (Matsumotoand Ishituka 2002) fully dedicated to OOP this approach ismandatory A method call (a message send to an object) is

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1058 C A Sierra et al SOIL R v 10

the one and only way for objects to communicate with eachother

The S4 approach inR is much less strict and allowsdirect manipulation of the data belonging to an object bymeans of the operator(or the slot function respectively)thus revealing the implementation of an object to the out-side code using this object User code based onwill breakif the implementation changes and the desired slot disap-pears while a get method may be able to retrieve the de-sired information from other data The use of the slot op-erator from outside should therefore be avoided (Genolini2008 Gentleman 2003) Imagine for instance acircle ob-ject c thatstoresits radius andcomputesthe diameter whengetDiameter(c) is called If the radius is accessed solelyby calls ofgetRadius(c) the implementation of the circleclass can later be changed to store the diameter and computethe radiuswithoutany affect to outside code using the class

Applications to SOILRrsquosModel occur if one considers theincreasing number of constructors with redundant parametersets The distinction between parameters and derived vari-ables may even become difficult Differing fromSIMECOL

we unify access toModel elements and avoid a syntacticdifference of parameters and derived values as expressed bySIMECOLrsquos functionsparams andout In addition to theget functions we provide for all data intended to be ac-cessed from outside access through the typical operators[]and$ for our Model class This gives access to all data themodel can provide either during the initialization or com-puted by the methods of the class In fact[] and $ inter-nally use theget methods and may perform any numberof checks and computations to provide a consistent outputThis facility is powerful enough to avoid the use ofcom-pletely for our class This is exactly our intention since theimplementation of the class may change accessing its ele-ments viais strongly discouraged While we will maintainthe defined interface via[] $ and theget functionswe cannot guarantee that code relying onwill work in fu-ture versions of SOILR

Another difference withSIMECOL is also related to the[]operator It enables the user to create the desired output ondemand thus avoiding duplication between output objectsIf the user asks forC shehe getsC and nottimeandC which sometimes may not be intended if the user isconcerned about issues of memory or duplication Howeverit may be very useful to have both in other situations whenthe times argument to the constructor that created themodel in the first place is not available anymore With[]the user can decide which fields the output should contain

An additional intended feature of our[] operator is to al-ways producedataframes and not aResult objectthat would (or at least should) be more protective of its dataagainst alterations post simulation than adataframe Ifwe provided code to post-process results we would certainlyimplement such aResult class to make sure that ourpost-processing is based on valid data Since at the moment

we donrsquot we also do not force a structured output object tothe user

At the moment we do not even provide output asdeSolve objects since every structured output is part of theinterface and may be relied on by user code Although weare happy and thankful to usedeSolve extensively withinSOILR making it a part of the interface would be a promiseto the user that we will keep on supporting it which is a muchbigger commitment

Until now the responsibility beyond the scope of classModel stays with the user

Supplementary material related to this article isavailable online athttpwwwgeosci-model-devnet510452012gmd-5-1045-2012-supplementzip

AcknowledgementsFinancial support for the development of thisproject was provided by the Max Planck Society We would like tothank Ulrich Weber and Martin Jung for providing global climatedata used in the example Maarten Braakhekke provided helpfulcomments on a previous version of this manuscript

The service charges for this open access publicationhave been covered by the Max Planck Society

Edited by S Arndt

References

Adair E Parton W Del Grosso S Silver W Harmon MHall S Burke I and Hart S Simple three-pool modelaccurately describes patterns of long-term litter decomposi-tion in diverse climates Glob Change Biol 14 2636ndash2660doi101111j1365-2486200801674x 2008

Agren G and Bosatta E Theoretical ecosystem ecology under-standing element cycles Cambridge University Press 1998

Andren O and Katterer T ICBM The Introductory Carbon Bal-ance Model for Exploration of Soil Carbon Balances EcolAppl 7 1226ndash1236httpwwwjstororgstable2641210 1997

Bolker B M Pacala S W and Parton W J Linearanalysis of soil decomposition insights from the CEN-TURY model Ecol Appl 8 425ndash439doi1018901051-0761(1998)008[0425LAOSDI]20CO2 1998

Bruun S Six J Jensen L and Paustian K Estimating turnoverof soil organic carbon fractions based on radiocarbon measure-ments Radiocarbon 47 99ndash113 2008

Burger M Juenemann K and Koenig T RUnit R Unit testframework R package version 04 25 2009

Burke I Kaye J Bird S Hall S McCulley R and Som-merville G Evaluating and testing models of terrestrial biogeo-chemistry the role of temperature in controlling decompositionModels in ecosystem science Princeton University Press Prince-ton New Jersey USA 225ndash253 2003

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

1054 C A Sierra et al SOIL R v 10

basic functions of SOILR to represent the process of organicmatter decomposition over time

To implement more sophisticated models with a higher de-gree of complexity it is possible to specify a larger amount ofpools with complex functions representing the dependence oflitter inputs decomposition rates and transfer between poolswith other external variables such as temperature moisturesoil texture nutrient status among many other

43 Implementation of the RothC model

RothC is a popular and widely used model for predicting or-ganic matter dynamics over time Although earlier versionsof the model included five active pools and one inert pool(Jenkinson and Rayner 1977) more recent versions only in-clude four active pools plus the inert pool (Jenkinson et al1990) RothC is implemented within SOILR and we providedetails here about this implementation to illustrate the useand potential implementation of any other model RothC canbe described by the following set of differential equations

dC1

dt= γ I minus k1C1

dC2

dt= (1minus γ )I minus k2C2

dC3

dt= α31k1C1 + α32k2C2 minus k3C3 + α33k3C3 + α34k4C4

dC4

dt= α41k1C1 + α42k2C2 + α43k3C3 minus k4C4 + α44k4C4

dC5

dt= 0 (20)

whereC1 represents the decomposable plant material (DPM)poolC2 the resistant plant material (RPM) poolC3 the mi-crobial biomass (BIO) poolC4 the humified organic matter(HUM) pool andC5 the inert organic matter pool (IOM)This set of equations can be rewritten in the form

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0α31k1 α32k2 minusk3(1minus α33) α34k4 0α41k1 α42k2 α43k3 minusk4(1minus α44) 0

0 0 0 0 0

C1C2C3C4C5

or as

dC

dt= I

γ

1minus γ

000

+

minusk1 0 0 0 0

0 minusk2 0 0 0a31 a32 minusk3 + a33 a34 0a41 a42 a43 minusk4 + a44 00 0 0 0 0

C1C2C3C4C5

(21)

The values of the decomposition rates are constant and givenby k1 = 10 k2 = 03 k3 = 066 andk4 = 002 (Jenkinsonet al 1990 Coleman and Jenkinson 1999) The value ofthe transfer coefficients is determined by a function of soiltexture For the microbial biomass pool transfer coefficientsare calculated as

a3j = kj

046

x + 1(22)

wherex is a value that determines the proportion of decom-posed material that is respired as CO2 and is given by

x = 167(185+ 160exp(minus00786pClay)) (23)

wherepClay is percent clay in mineral soil (Jenkinson et al1990) Similarly the transfer coefficients for the humifiedpool are given by

a4j = kj

054

x + 1 (24)

The partitioning of incoming plant material is determinedby the ratio DPMRPM which in RothC is set as 144 There-foreγ = 059 Now the basic structure of the RothC modelcan be written as

dC

dt= I

059041

000

+

minus10 0 0 0 0

0 minus03 0 0 0102 003 minus059 001 0119 004 008 minus002 0

0 0 0 0 0

C1C2C3C4C5

(25)

The annual amount of inputs is set in the RothC model asI = 17 Mg C haminus1 yrminus1

With this parameterization it is possible to run the RothCmodel without varying environmental effects on decompo-sition rates and observe how the system approaches steady-state for the different pools (Fig4) Parameter values ini-tial conditions and litter inputs can be changed easily withinSOILR to compare different predictions from this model

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1055

0 100 200 300 400 500

05

1015

2025

Time (years)

Car

bon

stor

es (M

g Cha

minus1)

Pool 1 DPMPool 2 RPMPool 3 BIOPool 4 HUMPool 5 IOMTotal Carbon

Fig 4 Carbon accumulation for the different pools included in theRothC model DPM the decomposable plant material pool RPMresistant plant material BIO microbial biomass pool HUM humi-fied organic matterpool and IOM inert organic matter pool

44 Applications for large-scale modeling

R can handle a large variety of data structures which offersinteresting possibilities for the application of the functionsimplemented in SOILR One important type of data structureis spatial data with global coverage There is a large numberof R packages to import and manipulate spatial data whichfacilitates the technical aspects for running SOILR functionsat the global scale

As an example we show here a simple calculation of cli-mate decomposition indexes (CDIs) (Adair et al 2008) us-ing a global dataset of temperature precipitation and po-tential evapotranspiration available at 05 degree resolutionon NetCDF files from the WATCH dataset (Weedon et al2011) The input dataset contained monthly average tempera-ture precipitation and evapotranspiration for the period 1958to 2001 We calculated the CDIs as

CDI = ξ(t) = f (T )f (W) (26)

with f (T ) implemented by the functionfTCentury1 andf (W) by the functionfWCentury as described in Ta-ble 1 Results can be easily plotted on a map (Fig5) andexported again to NetCDF files Different combinations ofthe functions described in Table1 can be used to calculateCDIs (Adair et al 2008) and evaluate different hypothesesabout the response of decomposition rates to moisture tem-perature and other variables

Longitude

Latit

ude

02

04

06

08

Fig 5 Climate decomposition index (CDI) calculated as the prod-uct of a function of temperature (fTCentury1 ) and a function ofprecipitation and potential evapotranspiration (fWCentury ) us-ing monthly data from the WATCH dataset (Weedon et al 2011)

5 Discussion

Many models of soil organic matter decomposition have beenproposed previously and there even exist some open-sourcetools to implement some of these models (egEaster et al2007) We have developed a tool for implementing and run-ning a large variety of these models with the idea of facili-tating comparison among multiple models in an easy to useinterface In this section we discuss some of the advantagesand disadvantages of our approach

51 Parameter space and structural domain

Models of organic matter decomposition are basically hypo-thetical abstractions about the structure and dynamics of soilorganic matter The multitude of models previously devel-oped suggests that there exists a large number of hypothesesabout the structure and functioning of soil organic matterbut there is basically little consensus on whether one modelstructure (hypothesis) would have more support on observa-tions than other model structures (Manzoni and Porporato2009)

The majority of modeling studies have focused on findingthe set of parameter values of a particular model that bestfit some observed data This approach is useful and has pro-vided much insight on understanding the rates of soil organicmatter decomposition However from the perspective of as-sessing different hypotheses about the structure and dynam-ics of soil organic matter parameter estimation can only givea narrow view of the more complex spectrum resulting from

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1056 C A Sierra et al SOIL R v 10

the combination of structure domain and the parameter spaceof models

SOILR provides the possibility of assessing both modelstructure and parameter values broadening the spectrum ofideas that can be assessed within one single analytical frame-work

We believe this approach complements well and could beeven more powerful than previous approaches to assess per-formance of model structure with inter-comparisons amongdifferent modeling groups (egMelillo et al 1995 Wu andMcGechan 1998 Cramer et al 2001 Randerson et al2009) Multi-model inter-comparison projects do not neces-sarily cover the whole domain of model structures and maybe subject to important issues such as independence of codebias of the whole model ensemble inappropriate metrics todefine model performance etc (Knutti et al 2009 Knutti2010) SOILR can partially help to overcome some of theseproblems for assessing the performance of model structurethrough the option of using alternative functions to representthe same process Philosophically this approach is also sim-ilar to testing multiple working hypotheses

52 Model hierarchies and functional programing

The gap between simulations and understanding describedby Held (2005) is currently exacerbated by the continuousincrease in detail and complexity of simulation modelsHeld(2005) suggests that a way forward to close the gap be-tween simulations and understanding is by the developmentof model hierarchies in which large-scale complex modelsare particular cases of general models that are more amenablefor understanding of system structure and behavior

SOILR can also be viewed as a system for hierarchicalmodeling of soil processes Consider for example the envi-ronmental or external effects on decomposition rates whichhere are denoted by the termξ(t) In its more simple andgeneral case the external effects can be simply a constant(ξ(t) = c) that allows the understanding of model behaviorwithout changes in environmental conditions Simulationscan then be run with a changing environment for exam-ple with variable soil moisture (ξ(t) = f (W(t))) Soil mois-ture could depend on other variables such as precipitationand potential evapotranspiration (W(t) = f (P (t)PET(t)))which in turn can be dependent on other functions In thisform a hierarchy of models is build with the dependence ofdifferent functions on other functions

In terms of programing this concept of model hierarchiescan be easily implemented in a functional programing styleA function that performs certain tasks can have as its argu-ments other functions that perform other tasks These func-tions can be independent among each other so many differentfunctions that perform the same task can be available withinthe same modeling environment This is one of our goals withSOILR to provide a modeling environment that serves as arepository of different functions that can perform the same

task so their performance can be easily compared It also al-lows building soil organic matter decomposition models ina hierarchical framework because functions can have a largenumber of dependences on other functions creating a bridgebetween simple general models and detailed modeling con-structions under the same basic principles

53 Scope and limitations

Our approach to soil organic matter decomposition modelingwith SOILR may have some limitations One potential limi-tation is the use of a high-level programing language that canhave issues in terms of computational efficiency This couldbe an important problem if specific models structures witha large number of computations per time step are applied toa large number of points such as a large spatial grid Otherprograming languages such asC or Fortran may be moresuitable for these tasks although a good programing stylecan avoid many issues of computational efficiency inR It isimportant to keep in mind that the scope of SOILR is morefor the exploration of different model structures and hypothe-ses about soil processes rather than for large computationaltasks however some parallelization tools withinR could beused for this purpose We recommend that once a specificmodel structure is identified as useful for a large computa-tion the entire model object is translated to other languageor optimized for running inR We are exploring these possi-bilities to include in future releases of SOILR

Another potential limitation is the incompatibility of ourconceptual framework to represent the decomposition pro-cess as a non-linear dynamical system Non-linear dynamicsare important for representing microbial processes such aspriming and are very relevant for simulations at short timescales (Wutzler and Reichstein 2008 Manzoni and Porpo-rato 2007 2009) Non-linear models however can be eas-ily implemented inR with the deSolve package We areconsidering two possibilities to include non-linear dynamicalsystems within our theoretical framework One possibility isto provide a framework to specify and linearize non-linearsystems and solve the linear equations as presented here An-other possibility is to include a set of non-linear models solv-ing them directly withdeSolve We aim for further releasesto include this additional functionality

6 Conclusions

We have developed a modeling environment for represent-ing the process of soil organic matter decomposition Thistool SOILR is an open- source package for the implemen-tation and testing of different representations of the processof soil organic matter decomposition The main character-istic of SOILR is its hierarchical structure in which we de-scribe a general model that can accommodate any possiblemodel structure of a multi-pool model of decomposition

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1057

More detailed models can be implemented to simulate spe-cific controls on the decomposition process This allows fortesting of multiple working hypotheses about the structureand functioning of soils and their behavior over time SOILRnot only allows for exploring dynamics on the parameterspace of a model but also on the structural domain

This first version of SOILR allows simulations of organicmatter decomposition and future versions will include rep-resentations of other biogeochemical elements such as nitro-gen and phosphorus as well as their isotopic composition Amodule for parameter fitting will also be included in futurereleases

Appendix A

Implementation details and design decisions regardingSOIL R

A1 The choice of the object-oriented programing(OOP) system

While in object oriented languages the implementation of ob-ject oriented design principles is usually hardwired inR itis a choice between at least three different approaches thusforcing the user to explain why a particular system was usedIn our case the choice ofS4 is a compromise On one handthere is very limited support inS4 for real encapsulation ex-pressed most notably by the possibility to read and even writethe values of slots from outside the class by theslot func-tion or theoperator respectively This default behavior isactually not even trivially changed On the other hand thereare some important advantages

1 Compatibility with the functional paradigm ofR and itsassociated benefits such as lazy evaluation concurrencyand in the future maybe even automatic parallelizationwhich depends on the absence of side effects (unavoid-able with a reference based system likeR5)

2 The integration withRrsquos standard library which in-creases

a the probability of future maintenance and

b acceptance by otherR users

3 The relative seamless integration to commonR work-flows without in depth knowledge of object orientedprograming

Considering that ifR is capable to implement an OOPsystem by means of on board tools it will probably be flexibleenough to change the default behavior of this OOP systemwith on board tools as well SOILR is a rather small packageand we thinkS4 is and appropriate choice for our needs

A2 Comparison betweenSIMECOL and SOIL R

SIMECOL (Petzoldt and Rinke 2007) an R package for theimplementation of ecological models is an alternative to ourown implementation Here we compare the two approachesin terms of their design

A21 Scope

SOILR is focused solely on soil organic matter decompo-sition while SIMECOL aims to be a general framework forecological modeling inR SIMECOL represents an abstrac-tion level somewhere between SOILR andRrsquos S4 systemHence the obvious way for SOILR to make use ofSIMECOL

would be to implement ourModel class as a subclass ofSIMECOL rsquos simObj One motivation to do so consists in thepossibility to inherit functionality from the ancestor which isusually additionally shared by other subclasses thus enablingeasier communication between them Whether subclassing isthe appropriate strategy thus depends on the amount of in-heritable code and the number of subclasses We found thatwithin SOILR Model would be the only one subclass ofSIMECOLrsquos model with nearly no code shared owing to dif-ferences in functionality and design goals (see below)

A22 Functionality

One major difference withSIMECOLrsquos simObj is thatSOILRrsquos Model initialize method requires objects of classTimeMap or its subclasses thus guaranteeing that the dif-ferent objects conforming a model share a common supportin the time domain even if the creation ofTimeMap ob-jects usually takes place far away from the initialization of aModel object since this usually happens behind the sceneseg by conversion ofdataframes the user provides asinput This is a significant difference fromSIMECOLrsquos ap-proach Implementing this functionality in a subclass ofSIMECOLrsquos model would be misleading and would not con-form well with our design goals

A23 Design goals

The main aim of SOILRrsquos Model class is to provide a fencebetween interface and implementation While the interfaceshould change as little as possible to protect code using theclass we want to have as much freedom as possible to changeits implementation We strive to achieve this by avoiding ev-ery possible syntactic distinction between references to ob-ject data and object methods from the outside WithRrsquos S4system one (and maybe the only) way to do so is to wrapall access to object data with get and set methods This isone aspect of a concept often referred to asencapsulationand regarded as one of the key components of OOP In lan-guages such asSmalltalk (Kay 1993) or Ruby (Matsumotoand Ishituka 2002) fully dedicated to OOP this approach ismandatory A method call (a message send to an object) is

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1058 C A Sierra et al SOIL R v 10

the one and only way for objects to communicate with eachother

The S4 approach inR is much less strict and allowsdirect manipulation of the data belonging to an object bymeans of the operator(or the slot function respectively)thus revealing the implementation of an object to the out-side code using this object User code based onwill breakif the implementation changes and the desired slot disap-pears while a get method may be able to retrieve the de-sired information from other data The use of the slot op-erator from outside should therefore be avoided (Genolini2008 Gentleman 2003) Imagine for instance acircle ob-ject c thatstoresits radius andcomputesthe diameter whengetDiameter(c) is called If the radius is accessed solelyby calls ofgetRadius(c) the implementation of the circleclass can later be changed to store the diameter and computethe radiuswithoutany affect to outside code using the class

Applications to SOILRrsquosModel occur if one considers theincreasing number of constructors with redundant parametersets The distinction between parameters and derived vari-ables may even become difficult Differing fromSIMECOL

we unify access toModel elements and avoid a syntacticdifference of parameters and derived values as expressed bySIMECOLrsquos functionsparams andout In addition to theget functions we provide for all data intended to be ac-cessed from outside access through the typical operators[]and$ for our Model class This gives access to all data themodel can provide either during the initialization or com-puted by the methods of the class In fact[] and $ inter-nally use theget methods and may perform any numberof checks and computations to provide a consistent outputThis facility is powerful enough to avoid the use ofcom-pletely for our class This is exactly our intention since theimplementation of the class may change accessing its ele-ments viais strongly discouraged While we will maintainthe defined interface via[] $ and theget functionswe cannot guarantee that code relying onwill work in fu-ture versions of SOILR

Another difference withSIMECOL is also related to the[]operator It enables the user to create the desired output ondemand thus avoiding duplication between output objectsIf the user asks forC shehe getsC and nottimeandC which sometimes may not be intended if the user isconcerned about issues of memory or duplication Howeverit may be very useful to have both in other situations whenthe times argument to the constructor that created themodel in the first place is not available anymore With[]the user can decide which fields the output should contain

An additional intended feature of our[] operator is to al-ways producedataframes and not aResult objectthat would (or at least should) be more protective of its dataagainst alterations post simulation than adataframe Ifwe provided code to post-process results we would certainlyimplement such aResult class to make sure that ourpost-processing is based on valid data Since at the moment

we donrsquot we also do not force a structured output object tothe user

At the moment we do not even provide output asdeSolve objects since every structured output is part of theinterface and may be relied on by user code Although weare happy and thankful to usedeSolve extensively withinSOILR making it a part of the interface would be a promiseto the user that we will keep on supporting it which is a muchbigger commitment

Until now the responsibility beyond the scope of classModel stays with the user

Supplementary material related to this article isavailable online athttpwwwgeosci-model-devnet510452012gmd-5-1045-2012-supplementzip

AcknowledgementsFinancial support for the development of thisproject was provided by the Max Planck Society We would like tothank Ulrich Weber and Martin Jung for providing global climatedata used in the example Maarten Braakhekke provided helpfulcomments on a previous version of this manuscript

The service charges for this open access publicationhave been covered by the Max Planck Society

Edited by S Arndt

References

Adair E Parton W Del Grosso S Silver W Harmon MHall S Burke I and Hart S Simple three-pool modelaccurately describes patterns of long-term litter decomposi-tion in diverse climates Glob Change Biol 14 2636ndash2660doi101111j1365-2486200801674x 2008

Agren G and Bosatta E Theoretical ecosystem ecology under-standing element cycles Cambridge University Press 1998

Andren O and Katterer T ICBM The Introductory Carbon Bal-ance Model for Exploration of Soil Carbon Balances EcolAppl 7 1226ndash1236httpwwwjstororgstable2641210 1997

Bolker B M Pacala S W and Parton W J Linearanalysis of soil decomposition insights from the CEN-TURY model Ecol Appl 8 425ndash439doi1018901051-0761(1998)008[0425LAOSDI]20CO2 1998

Bruun S Six J Jensen L and Paustian K Estimating turnoverof soil organic carbon fractions based on radiocarbon measure-ments Radiocarbon 47 99ndash113 2008

Burger M Juenemann K and Koenig T RUnit R Unit testframework R package version 04 25 2009

Burke I Kaye J Bird S Hall S McCulley R and Som-merville G Evaluating and testing models of terrestrial biogeo-chemistry the role of temperature in controlling decompositionModels in ecosystem science Princeton University Press Prince-ton New Jersey USA 225ndash253 2003

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1055

0 100 200 300 400 500

05

1015

2025

Time (years)

Car

bon

stor

es (M

g Cha

minus1)

Pool 1 DPMPool 2 RPMPool 3 BIOPool 4 HUMPool 5 IOMTotal Carbon

Fig 4 Carbon accumulation for the different pools included in theRothC model DPM the decomposable plant material pool RPMresistant plant material BIO microbial biomass pool HUM humi-fied organic matterpool and IOM inert organic matter pool

44 Applications for large-scale modeling

R can handle a large variety of data structures which offersinteresting possibilities for the application of the functionsimplemented in SOILR One important type of data structureis spatial data with global coverage There is a large numberof R packages to import and manipulate spatial data whichfacilitates the technical aspects for running SOILR functionsat the global scale

As an example we show here a simple calculation of cli-mate decomposition indexes (CDIs) (Adair et al 2008) us-ing a global dataset of temperature precipitation and po-tential evapotranspiration available at 05 degree resolutionon NetCDF files from the WATCH dataset (Weedon et al2011) The input dataset contained monthly average tempera-ture precipitation and evapotranspiration for the period 1958to 2001 We calculated the CDIs as

CDI = ξ(t) = f (T )f (W) (26)

with f (T ) implemented by the functionfTCentury1 andf (W) by the functionfWCentury as described in Ta-ble 1 Results can be easily plotted on a map (Fig5) andexported again to NetCDF files Different combinations ofthe functions described in Table1 can be used to calculateCDIs (Adair et al 2008) and evaluate different hypothesesabout the response of decomposition rates to moisture tem-perature and other variables

Longitude

Latit

ude

02

04

06

08

Fig 5 Climate decomposition index (CDI) calculated as the prod-uct of a function of temperature (fTCentury1 ) and a function ofprecipitation and potential evapotranspiration (fWCentury ) us-ing monthly data from the WATCH dataset (Weedon et al 2011)

5 Discussion

Many models of soil organic matter decomposition have beenproposed previously and there even exist some open-sourcetools to implement some of these models (egEaster et al2007) We have developed a tool for implementing and run-ning a large variety of these models with the idea of facili-tating comparison among multiple models in an easy to useinterface In this section we discuss some of the advantagesand disadvantages of our approach

51 Parameter space and structural domain

Models of organic matter decomposition are basically hypo-thetical abstractions about the structure and dynamics of soilorganic matter The multitude of models previously devel-oped suggests that there exists a large number of hypothesesabout the structure and functioning of soil organic matterbut there is basically little consensus on whether one modelstructure (hypothesis) would have more support on observa-tions than other model structures (Manzoni and Porporato2009)

The majority of modeling studies have focused on findingthe set of parameter values of a particular model that bestfit some observed data This approach is useful and has pro-vided much insight on understanding the rates of soil organicmatter decomposition However from the perspective of as-sessing different hypotheses about the structure and dynam-ics of soil organic matter parameter estimation can only givea narrow view of the more complex spectrum resulting from

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1056 C A Sierra et al SOIL R v 10

the combination of structure domain and the parameter spaceof models

SOILR provides the possibility of assessing both modelstructure and parameter values broadening the spectrum ofideas that can be assessed within one single analytical frame-work

We believe this approach complements well and could beeven more powerful than previous approaches to assess per-formance of model structure with inter-comparisons amongdifferent modeling groups (egMelillo et al 1995 Wu andMcGechan 1998 Cramer et al 2001 Randerson et al2009) Multi-model inter-comparison projects do not neces-sarily cover the whole domain of model structures and maybe subject to important issues such as independence of codebias of the whole model ensemble inappropriate metrics todefine model performance etc (Knutti et al 2009 Knutti2010) SOILR can partially help to overcome some of theseproblems for assessing the performance of model structurethrough the option of using alternative functions to representthe same process Philosophically this approach is also sim-ilar to testing multiple working hypotheses

52 Model hierarchies and functional programing

The gap between simulations and understanding describedby Held (2005) is currently exacerbated by the continuousincrease in detail and complexity of simulation modelsHeld(2005) suggests that a way forward to close the gap be-tween simulations and understanding is by the developmentof model hierarchies in which large-scale complex modelsare particular cases of general models that are more amenablefor understanding of system structure and behavior

SOILR can also be viewed as a system for hierarchicalmodeling of soil processes Consider for example the envi-ronmental or external effects on decomposition rates whichhere are denoted by the termξ(t) In its more simple andgeneral case the external effects can be simply a constant(ξ(t) = c) that allows the understanding of model behaviorwithout changes in environmental conditions Simulationscan then be run with a changing environment for exam-ple with variable soil moisture (ξ(t) = f (W(t))) Soil mois-ture could depend on other variables such as precipitationand potential evapotranspiration (W(t) = f (P (t)PET(t)))which in turn can be dependent on other functions In thisform a hierarchy of models is build with the dependence ofdifferent functions on other functions

In terms of programing this concept of model hierarchiescan be easily implemented in a functional programing styleA function that performs certain tasks can have as its argu-ments other functions that perform other tasks These func-tions can be independent among each other so many differentfunctions that perform the same task can be available withinthe same modeling environment This is one of our goals withSOILR to provide a modeling environment that serves as arepository of different functions that can perform the same

task so their performance can be easily compared It also al-lows building soil organic matter decomposition models ina hierarchical framework because functions can have a largenumber of dependences on other functions creating a bridgebetween simple general models and detailed modeling con-structions under the same basic principles

53 Scope and limitations

Our approach to soil organic matter decomposition modelingwith SOILR may have some limitations One potential limi-tation is the use of a high-level programing language that canhave issues in terms of computational efficiency This couldbe an important problem if specific models structures witha large number of computations per time step are applied toa large number of points such as a large spatial grid Otherprograming languages such asC or Fortran may be moresuitable for these tasks although a good programing stylecan avoid many issues of computational efficiency inR It isimportant to keep in mind that the scope of SOILR is morefor the exploration of different model structures and hypothe-ses about soil processes rather than for large computationaltasks however some parallelization tools withinR could beused for this purpose We recommend that once a specificmodel structure is identified as useful for a large computa-tion the entire model object is translated to other languageor optimized for running inR We are exploring these possi-bilities to include in future releases of SOILR

Another potential limitation is the incompatibility of ourconceptual framework to represent the decomposition pro-cess as a non-linear dynamical system Non-linear dynamicsare important for representing microbial processes such aspriming and are very relevant for simulations at short timescales (Wutzler and Reichstein 2008 Manzoni and Porpo-rato 2007 2009) Non-linear models however can be eas-ily implemented inR with the deSolve package We areconsidering two possibilities to include non-linear dynamicalsystems within our theoretical framework One possibility isto provide a framework to specify and linearize non-linearsystems and solve the linear equations as presented here An-other possibility is to include a set of non-linear models solv-ing them directly withdeSolve We aim for further releasesto include this additional functionality

6 Conclusions

We have developed a modeling environment for represent-ing the process of soil organic matter decomposition Thistool SOILR is an open- source package for the implemen-tation and testing of different representations of the processof soil organic matter decomposition The main character-istic of SOILR is its hierarchical structure in which we de-scribe a general model that can accommodate any possiblemodel structure of a multi-pool model of decomposition

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1057

More detailed models can be implemented to simulate spe-cific controls on the decomposition process This allows fortesting of multiple working hypotheses about the structureand functioning of soils and their behavior over time SOILRnot only allows for exploring dynamics on the parameterspace of a model but also on the structural domain

This first version of SOILR allows simulations of organicmatter decomposition and future versions will include rep-resentations of other biogeochemical elements such as nitro-gen and phosphorus as well as their isotopic composition Amodule for parameter fitting will also be included in futurereleases

Appendix A

Implementation details and design decisions regardingSOIL R

A1 The choice of the object-oriented programing(OOP) system

While in object oriented languages the implementation of ob-ject oriented design principles is usually hardwired inR itis a choice between at least three different approaches thusforcing the user to explain why a particular system was usedIn our case the choice ofS4 is a compromise On one handthere is very limited support inS4 for real encapsulation ex-pressed most notably by the possibility to read and even writethe values of slots from outside the class by theslot func-tion or theoperator respectively This default behavior isactually not even trivially changed On the other hand thereare some important advantages

1 Compatibility with the functional paradigm ofR and itsassociated benefits such as lazy evaluation concurrencyand in the future maybe even automatic parallelizationwhich depends on the absence of side effects (unavoid-able with a reference based system likeR5)

2 The integration withRrsquos standard library which in-creases

a the probability of future maintenance and

b acceptance by otherR users

3 The relative seamless integration to commonR work-flows without in depth knowledge of object orientedprograming

Considering that ifR is capable to implement an OOPsystem by means of on board tools it will probably be flexibleenough to change the default behavior of this OOP systemwith on board tools as well SOILR is a rather small packageand we thinkS4 is and appropriate choice for our needs

A2 Comparison betweenSIMECOL and SOIL R

SIMECOL (Petzoldt and Rinke 2007) an R package for theimplementation of ecological models is an alternative to ourown implementation Here we compare the two approachesin terms of their design

A21 Scope

SOILR is focused solely on soil organic matter decompo-sition while SIMECOL aims to be a general framework forecological modeling inR SIMECOL represents an abstrac-tion level somewhere between SOILR andRrsquos S4 systemHence the obvious way for SOILR to make use ofSIMECOL

would be to implement ourModel class as a subclass ofSIMECOL rsquos simObj One motivation to do so consists in thepossibility to inherit functionality from the ancestor which isusually additionally shared by other subclasses thus enablingeasier communication between them Whether subclassing isthe appropriate strategy thus depends on the amount of in-heritable code and the number of subclasses We found thatwithin SOILR Model would be the only one subclass ofSIMECOLrsquos model with nearly no code shared owing to dif-ferences in functionality and design goals (see below)

A22 Functionality

One major difference withSIMECOLrsquos simObj is thatSOILRrsquos Model initialize method requires objects of classTimeMap or its subclasses thus guaranteeing that the dif-ferent objects conforming a model share a common supportin the time domain even if the creation ofTimeMap ob-jects usually takes place far away from the initialization of aModel object since this usually happens behind the sceneseg by conversion ofdataframes the user provides asinput This is a significant difference fromSIMECOLrsquos ap-proach Implementing this functionality in a subclass ofSIMECOLrsquos model would be misleading and would not con-form well with our design goals

A23 Design goals

The main aim of SOILRrsquos Model class is to provide a fencebetween interface and implementation While the interfaceshould change as little as possible to protect code using theclass we want to have as much freedom as possible to changeits implementation We strive to achieve this by avoiding ev-ery possible syntactic distinction between references to ob-ject data and object methods from the outside WithRrsquos S4system one (and maybe the only) way to do so is to wrapall access to object data with get and set methods This isone aspect of a concept often referred to asencapsulationand regarded as one of the key components of OOP In lan-guages such asSmalltalk (Kay 1993) or Ruby (Matsumotoand Ishituka 2002) fully dedicated to OOP this approach ismandatory A method call (a message send to an object) is

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1058 C A Sierra et al SOIL R v 10

the one and only way for objects to communicate with eachother

The S4 approach inR is much less strict and allowsdirect manipulation of the data belonging to an object bymeans of the operator(or the slot function respectively)thus revealing the implementation of an object to the out-side code using this object User code based onwill breakif the implementation changes and the desired slot disap-pears while a get method may be able to retrieve the de-sired information from other data The use of the slot op-erator from outside should therefore be avoided (Genolini2008 Gentleman 2003) Imagine for instance acircle ob-ject c thatstoresits radius andcomputesthe diameter whengetDiameter(c) is called If the radius is accessed solelyby calls ofgetRadius(c) the implementation of the circleclass can later be changed to store the diameter and computethe radiuswithoutany affect to outside code using the class

Applications to SOILRrsquosModel occur if one considers theincreasing number of constructors with redundant parametersets The distinction between parameters and derived vari-ables may even become difficult Differing fromSIMECOL

we unify access toModel elements and avoid a syntacticdifference of parameters and derived values as expressed bySIMECOLrsquos functionsparams andout In addition to theget functions we provide for all data intended to be ac-cessed from outside access through the typical operators[]and$ for our Model class This gives access to all data themodel can provide either during the initialization or com-puted by the methods of the class In fact[] and $ inter-nally use theget methods and may perform any numberof checks and computations to provide a consistent outputThis facility is powerful enough to avoid the use ofcom-pletely for our class This is exactly our intention since theimplementation of the class may change accessing its ele-ments viais strongly discouraged While we will maintainthe defined interface via[] $ and theget functionswe cannot guarantee that code relying onwill work in fu-ture versions of SOILR

Another difference withSIMECOL is also related to the[]operator It enables the user to create the desired output ondemand thus avoiding duplication between output objectsIf the user asks forC shehe getsC and nottimeandC which sometimes may not be intended if the user isconcerned about issues of memory or duplication Howeverit may be very useful to have both in other situations whenthe times argument to the constructor that created themodel in the first place is not available anymore With[]the user can decide which fields the output should contain

An additional intended feature of our[] operator is to al-ways producedataframes and not aResult objectthat would (or at least should) be more protective of its dataagainst alterations post simulation than adataframe Ifwe provided code to post-process results we would certainlyimplement such aResult class to make sure that ourpost-processing is based on valid data Since at the moment

we donrsquot we also do not force a structured output object tothe user

At the moment we do not even provide output asdeSolve objects since every structured output is part of theinterface and may be relied on by user code Although weare happy and thankful to usedeSolve extensively withinSOILR making it a part of the interface would be a promiseto the user that we will keep on supporting it which is a muchbigger commitment

Until now the responsibility beyond the scope of classModel stays with the user

Supplementary material related to this article isavailable online athttpwwwgeosci-model-devnet510452012gmd-5-1045-2012-supplementzip

AcknowledgementsFinancial support for the development of thisproject was provided by the Max Planck Society We would like tothank Ulrich Weber and Martin Jung for providing global climatedata used in the example Maarten Braakhekke provided helpfulcomments on a previous version of this manuscript

The service charges for this open access publicationhave been covered by the Max Planck Society

Edited by S Arndt

References

Adair E Parton W Del Grosso S Silver W Harmon MHall S Burke I and Hart S Simple three-pool modelaccurately describes patterns of long-term litter decomposi-tion in diverse climates Glob Change Biol 14 2636ndash2660doi101111j1365-2486200801674x 2008

Agren G and Bosatta E Theoretical ecosystem ecology under-standing element cycles Cambridge University Press 1998

Andren O and Katterer T ICBM The Introductory Carbon Bal-ance Model for Exploration of Soil Carbon Balances EcolAppl 7 1226ndash1236httpwwwjstororgstable2641210 1997

Bolker B M Pacala S W and Parton W J Linearanalysis of soil decomposition insights from the CEN-TURY model Ecol Appl 8 425ndash439doi1018901051-0761(1998)008[0425LAOSDI]20CO2 1998

Bruun S Six J Jensen L and Paustian K Estimating turnoverof soil organic carbon fractions based on radiocarbon measure-ments Radiocarbon 47 99ndash113 2008

Burger M Juenemann K and Koenig T RUnit R Unit testframework R package version 04 25 2009

Burke I Kaye J Bird S Hall S McCulley R and Som-merville G Evaluating and testing models of terrestrial biogeo-chemistry the role of temperature in controlling decompositionModels in ecosystem science Princeton University Press Prince-ton New Jersey USA 225ndash253 2003

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

1056 C A Sierra et al SOIL R v 10

the combination of structure domain and the parameter spaceof models

SOILR provides the possibility of assessing both modelstructure and parameter values broadening the spectrum ofideas that can be assessed within one single analytical frame-work

We believe this approach complements well and could beeven more powerful than previous approaches to assess per-formance of model structure with inter-comparisons amongdifferent modeling groups (egMelillo et al 1995 Wu andMcGechan 1998 Cramer et al 2001 Randerson et al2009) Multi-model inter-comparison projects do not neces-sarily cover the whole domain of model structures and maybe subject to important issues such as independence of codebias of the whole model ensemble inappropriate metrics todefine model performance etc (Knutti et al 2009 Knutti2010) SOILR can partially help to overcome some of theseproblems for assessing the performance of model structurethrough the option of using alternative functions to representthe same process Philosophically this approach is also sim-ilar to testing multiple working hypotheses

52 Model hierarchies and functional programing

The gap between simulations and understanding describedby Held (2005) is currently exacerbated by the continuousincrease in detail and complexity of simulation modelsHeld(2005) suggests that a way forward to close the gap be-tween simulations and understanding is by the developmentof model hierarchies in which large-scale complex modelsare particular cases of general models that are more amenablefor understanding of system structure and behavior

SOILR can also be viewed as a system for hierarchicalmodeling of soil processes Consider for example the envi-ronmental or external effects on decomposition rates whichhere are denoted by the termξ(t) In its more simple andgeneral case the external effects can be simply a constant(ξ(t) = c) that allows the understanding of model behaviorwithout changes in environmental conditions Simulationscan then be run with a changing environment for exam-ple with variable soil moisture (ξ(t) = f (W(t))) Soil mois-ture could depend on other variables such as precipitationand potential evapotranspiration (W(t) = f (P (t)PET(t)))which in turn can be dependent on other functions In thisform a hierarchy of models is build with the dependence ofdifferent functions on other functions

In terms of programing this concept of model hierarchiescan be easily implemented in a functional programing styleA function that performs certain tasks can have as its argu-ments other functions that perform other tasks These func-tions can be independent among each other so many differentfunctions that perform the same task can be available withinthe same modeling environment This is one of our goals withSOILR to provide a modeling environment that serves as arepository of different functions that can perform the same

task so their performance can be easily compared It also al-lows building soil organic matter decomposition models ina hierarchical framework because functions can have a largenumber of dependences on other functions creating a bridgebetween simple general models and detailed modeling con-structions under the same basic principles

53 Scope and limitations

Our approach to soil organic matter decomposition modelingwith SOILR may have some limitations One potential limi-tation is the use of a high-level programing language that canhave issues in terms of computational efficiency This couldbe an important problem if specific models structures witha large number of computations per time step are applied toa large number of points such as a large spatial grid Otherprograming languages such asC or Fortran may be moresuitable for these tasks although a good programing stylecan avoid many issues of computational efficiency inR It isimportant to keep in mind that the scope of SOILR is morefor the exploration of different model structures and hypothe-ses about soil processes rather than for large computationaltasks however some parallelization tools withinR could beused for this purpose We recommend that once a specificmodel structure is identified as useful for a large computa-tion the entire model object is translated to other languageor optimized for running inR We are exploring these possi-bilities to include in future releases of SOILR

Another potential limitation is the incompatibility of ourconceptual framework to represent the decomposition pro-cess as a non-linear dynamical system Non-linear dynamicsare important for representing microbial processes such aspriming and are very relevant for simulations at short timescales (Wutzler and Reichstein 2008 Manzoni and Porpo-rato 2007 2009) Non-linear models however can be eas-ily implemented inR with the deSolve package We areconsidering two possibilities to include non-linear dynamicalsystems within our theoretical framework One possibility isto provide a framework to specify and linearize non-linearsystems and solve the linear equations as presented here An-other possibility is to include a set of non-linear models solv-ing them directly withdeSolve We aim for further releasesto include this additional functionality

6 Conclusions

We have developed a modeling environment for represent-ing the process of soil organic matter decomposition Thistool SOILR is an open- source package for the implemen-tation and testing of different representations of the processof soil organic matter decomposition The main character-istic of SOILR is its hierarchical structure in which we de-scribe a general model that can accommodate any possiblemodel structure of a multi-pool model of decomposition

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1057

More detailed models can be implemented to simulate spe-cific controls on the decomposition process This allows fortesting of multiple working hypotheses about the structureand functioning of soils and their behavior over time SOILRnot only allows for exploring dynamics on the parameterspace of a model but also on the structural domain

This first version of SOILR allows simulations of organicmatter decomposition and future versions will include rep-resentations of other biogeochemical elements such as nitro-gen and phosphorus as well as their isotopic composition Amodule for parameter fitting will also be included in futurereleases

Appendix A

Implementation details and design decisions regardingSOIL R

A1 The choice of the object-oriented programing(OOP) system

While in object oriented languages the implementation of ob-ject oriented design principles is usually hardwired inR itis a choice between at least three different approaches thusforcing the user to explain why a particular system was usedIn our case the choice ofS4 is a compromise On one handthere is very limited support inS4 for real encapsulation ex-pressed most notably by the possibility to read and even writethe values of slots from outside the class by theslot func-tion or theoperator respectively This default behavior isactually not even trivially changed On the other hand thereare some important advantages

1 Compatibility with the functional paradigm ofR and itsassociated benefits such as lazy evaluation concurrencyand in the future maybe even automatic parallelizationwhich depends on the absence of side effects (unavoid-able with a reference based system likeR5)

2 The integration withRrsquos standard library which in-creases

a the probability of future maintenance and

b acceptance by otherR users

3 The relative seamless integration to commonR work-flows without in depth knowledge of object orientedprograming

Considering that ifR is capable to implement an OOPsystem by means of on board tools it will probably be flexibleenough to change the default behavior of this OOP systemwith on board tools as well SOILR is a rather small packageand we thinkS4 is and appropriate choice for our needs

A2 Comparison betweenSIMECOL and SOIL R

SIMECOL (Petzoldt and Rinke 2007) an R package for theimplementation of ecological models is an alternative to ourown implementation Here we compare the two approachesin terms of their design

A21 Scope

SOILR is focused solely on soil organic matter decompo-sition while SIMECOL aims to be a general framework forecological modeling inR SIMECOL represents an abstrac-tion level somewhere between SOILR andRrsquos S4 systemHence the obvious way for SOILR to make use ofSIMECOL

would be to implement ourModel class as a subclass ofSIMECOL rsquos simObj One motivation to do so consists in thepossibility to inherit functionality from the ancestor which isusually additionally shared by other subclasses thus enablingeasier communication between them Whether subclassing isthe appropriate strategy thus depends on the amount of in-heritable code and the number of subclasses We found thatwithin SOILR Model would be the only one subclass ofSIMECOLrsquos model with nearly no code shared owing to dif-ferences in functionality and design goals (see below)

A22 Functionality

One major difference withSIMECOLrsquos simObj is thatSOILRrsquos Model initialize method requires objects of classTimeMap or its subclasses thus guaranteeing that the dif-ferent objects conforming a model share a common supportin the time domain even if the creation ofTimeMap ob-jects usually takes place far away from the initialization of aModel object since this usually happens behind the sceneseg by conversion ofdataframes the user provides asinput This is a significant difference fromSIMECOLrsquos ap-proach Implementing this functionality in a subclass ofSIMECOLrsquos model would be misleading and would not con-form well with our design goals

A23 Design goals

The main aim of SOILRrsquos Model class is to provide a fencebetween interface and implementation While the interfaceshould change as little as possible to protect code using theclass we want to have as much freedom as possible to changeits implementation We strive to achieve this by avoiding ev-ery possible syntactic distinction between references to ob-ject data and object methods from the outside WithRrsquos S4system one (and maybe the only) way to do so is to wrapall access to object data with get and set methods This isone aspect of a concept often referred to asencapsulationand regarded as one of the key components of OOP In lan-guages such asSmalltalk (Kay 1993) or Ruby (Matsumotoand Ishituka 2002) fully dedicated to OOP this approach ismandatory A method call (a message send to an object) is

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1058 C A Sierra et al SOIL R v 10

the one and only way for objects to communicate with eachother

The S4 approach inR is much less strict and allowsdirect manipulation of the data belonging to an object bymeans of the operator(or the slot function respectively)thus revealing the implementation of an object to the out-side code using this object User code based onwill breakif the implementation changes and the desired slot disap-pears while a get method may be able to retrieve the de-sired information from other data The use of the slot op-erator from outside should therefore be avoided (Genolini2008 Gentleman 2003) Imagine for instance acircle ob-ject c thatstoresits radius andcomputesthe diameter whengetDiameter(c) is called If the radius is accessed solelyby calls ofgetRadius(c) the implementation of the circleclass can later be changed to store the diameter and computethe radiuswithoutany affect to outside code using the class

Applications to SOILRrsquosModel occur if one considers theincreasing number of constructors with redundant parametersets The distinction between parameters and derived vari-ables may even become difficult Differing fromSIMECOL

we unify access toModel elements and avoid a syntacticdifference of parameters and derived values as expressed bySIMECOLrsquos functionsparams andout In addition to theget functions we provide for all data intended to be ac-cessed from outside access through the typical operators[]and$ for our Model class This gives access to all data themodel can provide either during the initialization or com-puted by the methods of the class In fact[] and $ inter-nally use theget methods and may perform any numberof checks and computations to provide a consistent outputThis facility is powerful enough to avoid the use ofcom-pletely for our class This is exactly our intention since theimplementation of the class may change accessing its ele-ments viais strongly discouraged While we will maintainthe defined interface via[] $ and theget functionswe cannot guarantee that code relying onwill work in fu-ture versions of SOILR

Another difference withSIMECOL is also related to the[]operator It enables the user to create the desired output ondemand thus avoiding duplication between output objectsIf the user asks forC shehe getsC and nottimeandC which sometimes may not be intended if the user isconcerned about issues of memory or duplication Howeverit may be very useful to have both in other situations whenthe times argument to the constructor that created themodel in the first place is not available anymore With[]the user can decide which fields the output should contain

An additional intended feature of our[] operator is to al-ways producedataframes and not aResult objectthat would (or at least should) be more protective of its dataagainst alterations post simulation than adataframe Ifwe provided code to post-process results we would certainlyimplement such aResult class to make sure that ourpost-processing is based on valid data Since at the moment

we donrsquot we also do not force a structured output object tothe user

At the moment we do not even provide output asdeSolve objects since every structured output is part of theinterface and may be relied on by user code Although weare happy and thankful to usedeSolve extensively withinSOILR making it a part of the interface would be a promiseto the user that we will keep on supporting it which is a muchbigger commitment

Until now the responsibility beyond the scope of classModel stays with the user

Supplementary material related to this article isavailable online athttpwwwgeosci-model-devnet510452012gmd-5-1045-2012-supplementzip

AcknowledgementsFinancial support for the development of thisproject was provided by the Max Planck Society We would like tothank Ulrich Weber and Martin Jung for providing global climatedata used in the example Maarten Braakhekke provided helpfulcomments on a previous version of this manuscript

The service charges for this open access publicationhave been covered by the Max Planck Society

Edited by S Arndt

References

Adair E Parton W Del Grosso S Silver W Harmon MHall S Burke I and Hart S Simple three-pool modelaccurately describes patterns of long-term litter decomposi-tion in diverse climates Glob Change Biol 14 2636ndash2660doi101111j1365-2486200801674x 2008

Agren G and Bosatta E Theoretical ecosystem ecology under-standing element cycles Cambridge University Press 1998

Andren O and Katterer T ICBM The Introductory Carbon Bal-ance Model for Exploration of Soil Carbon Balances EcolAppl 7 1226ndash1236httpwwwjstororgstable2641210 1997

Bolker B M Pacala S W and Parton W J Linearanalysis of soil decomposition insights from the CEN-TURY model Ecol Appl 8 425ndash439doi1018901051-0761(1998)008[0425LAOSDI]20CO2 1998

Bruun S Six J Jensen L and Paustian K Estimating turnoverof soil organic carbon fractions based on radiocarbon measure-ments Radiocarbon 47 99ndash113 2008

Burger M Juenemann K and Koenig T RUnit R Unit testframework R package version 04 25 2009

Burke I Kaye J Bird S Hall S McCulley R and Som-merville G Evaluating and testing models of terrestrial biogeo-chemistry the role of temperature in controlling decompositionModels in ecosystem science Princeton University Press Prince-ton New Jersey USA 225ndash253 2003

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1057

More detailed models can be implemented to simulate spe-cific controls on the decomposition process This allows fortesting of multiple working hypotheses about the structureand functioning of soils and their behavior over time SOILRnot only allows for exploring dynamics on the parameterspace of a model but also on the structural domain

This first version of SOILR allows simulations of organicmatter decomposition and future versions will include rep-resentations of other biogeochemical elements such as nitro-gen and phosphorus as well as their isotopic composition Amodule for parameter fitting will also be included in futurereleases

Appendix A

Implementation details and design decisions regardingSOIL R

A1 The choice of the object-oriented programing(OOP) system

While in object oriented languages the implementation of ob-ject oriented design principles is usually hardwired inR itis a choice between at least three different approaches thusforcing the user to explain why a particular system was usedIn our case the choice ofS4 is a compromise On one handthere is very limited support inS4 for real encapsulation ex-pressed most notably by the possibility to read and even writethe values of slots from outside the class by theslot func-tion or theoperator respectively This default behavior isactually not even trivially changed On the other hand thereare some important advantages

1 Compatibility with the functional paradigm ofR and itsassociated benefits such as lazy evaluation concurrencyand in the future maybe even automatic parallelizationwhich depends on the absence of side effects (unavoid-able with a reference based system likeR5)

2 The integration withRrsquos standard library which in-creases

a the probability of future maintenance and

b acceptance by otherR users

3 The relative seamless integration to commonR work-flows without in depth knowledge of object orientedprograming

Considering that ifR is capable to implement an OOPsystem by means of on board tools it will probably be flexibleenough to change the default behavior of this OOP systemwith on board tools as well SOILR is a rather small packageand we thinkS4 is and appropriate choice for our needs

A2 Comparison betweenSIMECOL and SOIL R

SIMECOL (Petzoldt and Rinke 2007) an R package for theimplementation of ecological models is an alternative to ourown implementation Here we compare the two approachesin terms of their design

A21 Scope

SOILR is focused solely on soil organic matter decompo-sition while SIMECOL aims to be a general framework forecological modeling inR SIMECOL represents an abstrac-tion level somewhere between SOILR andRrsquos S4 systemHence the obvious way for SOILR to make use ofSIMECOL

would be to implement ourModel class as a subclass ofSIMECOL rsquos simObj One motivation to do so consists in thepossibility to inherit functionality from the ancestor which isusually additionally shared by other subclasses thus enablingeasier communication between them Whether subclassing isthe appropriate strategy thus depends on the amount of in-heritable code and the number of subclasses We found thatwithin SOILR Model would be the only one subclass ofSIMECOLrsquos model with nearly no code shared owing to dif-ferences in functionality and design goals (see below)

A22 Functionality

One major difference withSIMECOLrsquos simObj is thatSOILRrsquos Model initialize method requires objects of classTimeMap or its subclasses thus guaranteeing that the dif-ferent objects conforming a model share a common supportin the time domain even if the creation ofTimeMap ob-jects usually takes place far away from the initialization of aModel object since this usually happens behind the sceneseg by conversion ofdataframes the user provides asinput This is a significant difference fromSIMECOLrsquos ap-proach Implementing this functionality in a subclass ofSIMECOLrsquos model would be misleading and would not con-form well with our design goals

A23 Design goals

The main aim of SOILRrsquos Model class is to provide a fencebetween interface and implementation While the interfaceshould change as little as possible to protect code using theclass we want to have as much freedom as possible to changeits implementation We strive to achieve this by avoiding ev-ery possible syntactic distinction between references to ob-ject data and object methods from the outside WithRrsquos S4system one (and maybe the only) way to do so is to wrapall access to object data with get and set methods This isone aspect of a concept often referred to asencapsulationand regarded as one of the key components of OOP In lan-guages such asSmalltalk (Kay 1993) or Ruby (Matsumotoand Ishituka 2002) fully dedicated to OOP this approach ismandatory A method call (a message send to an object) is

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1058 C A Sierra et al SOIL R v 10

the one and only way for objects to communicate with eachother

The S4 approach inR is much less strict and allowsdirect manipulation of the data belonging to an object bymeans of the operator(or the slot function respectively)thus revealing the implementation of an object to the out-side code using this object User code based onwill breakif the implementation changes and the desired slot disap-pears while a get method may be able to retrieve the de-sired information from other data The use of the slot op-erator from outside should therefore be avoided (Genolini2008 Gentleman 2003) Imagine for instance acircle ob-ject c thatstoresits radius andcomputesthe diameter whengetDiameter(c) is called If the radius is accessed solelyby calls ofgetRadius(c) the implementation of the circleclass can later be changed to store the diameter and computethe radiuswithoutany affect to outside code using the class

Applications to SOILRrsquosModel occur if one considers theincreasing number of constructors with redundant parametersets The distinction between parameters and derived vari-ables may even become difficult Differing fromSIMECOL

we unify access toModel elements and avoid a syntacticdifference of parameters and derived values as expressed bySIMECOLrsquos functionsparams andout In addition to theget functions we provide for all data intended to be ac-cessed from outside access through the typical operators[]and$ for our Model class This gives access to all data themodel can provide either during the initialization or com-puted by the methods of the class In fact[] and $ inter-nally use theget methods and may perform any numberof checks and computations to provide a consistent outputThis facility is powerful enough to avoid the use ofcom-pletely for our class This is exactly our intention since theimplementation of the class may change accessing its ele-ments viais strongly discouraged While we will maintainthe defined interface via[] $ and theget functionswe cannot guarantee that code relying onwill work in fu-ture versions of SOILR

Another difference withSIMECOL is also related to the[]operator It enables the user to create the desired output ondemand thus avoiding duplication between output objectsIf the user asks forC shehe getsC and nottimeandC which sometimes may not be intended if the user isconcerned about issues of memory or duplication Howeverit may be very useful to have both in other situations whenthe times argument to the constructor that created themodel in the first place is not available anymore With[]the user can decide which fields the output should contain

An additional intended feature of our[] operator is to al-ways producedataframes and not aResult objectthat would (or at least should) be more protective of its dataagainst alterations post simulation than adataframe Ifwe provided code to post-process results we would certainlyimplement such aResult class to make sure that ourpost-processing is based on valid data Since at the moment

we donrsquot we also do not force a structured output object tothe user

At the moment we do not even provide output asdeSolve objects since every structured output is part of theinterface and may be relied on by user code Although weare happy and thankful to usedeSolve extensively withinSOILR making it a part of the interface would be a promiseto the user that we will keep on supporting it which is a muchbigger commitment

Until now the responsibility beyond the scope of classModel stays with the user

Supplementary material related to this article isavailable online athttpwwwgeosci-model-devnet510452012gmd-5-1045-2012-supplementzip

AcknowledgementsFinancial support for the development of thisproject was provided by the Max Planck Society We would like tothank Ulrich Weber and Martin Jung for providing global climatedata used in the example Maarten Braakhekke provided helpfulcomments on a previous version of this manuscript

The service charges for this open access publicationhave been covered by the Max Planck Society

Edited by S Arndt

References

Adair E Parton W Del Grosso S Silver W Harmon MHall S Burke I and Hart S Simple three-pool modelaccurately describes patterns of long-term litter decomposi-tion in diverse climates Glob Change Biol 14 2636ndash2660doi101111j1365-2486200801674x 2008

Agren G and Bosatta E Theoretical ecosystem ecology under-standing element cycles Cambridge University Press 1998

Andren O and Katterer T ICBM The Introductory Carbon Bal-ance Model for Exploration of Soil Carbon Balances EcolAppl 7 1226ndash1236httpwwwjstororgstable2641210 1997

Bolker B M Pacala S W and Parton W J Linearanalysis of soil decomposition insights from the CEN-TURY model Ecol Appl 8 425ndash439doi1018901051-0761(1998)008[0425LAOSDI]20CO2 1998

Bruun S Six J Jensen L and Paustian K Estimating turnoverof soil organic carbon fractions based on radiocarbon measure-ments Radiocarbon 47 99ndash113 2008

Burger M Juenemann K and Koenig T RUnit R Unit testframework R package version 04 25 2009

Burke I Kaye J Bird S Hall S McCulley R and Som-merville G Evaluating and testing models of terrestrial biogeo-chemistry the role of temperature in controlling decompositionModels in ecosystem science Princeton University Press Prince-ton New Jersey USA 225ndash253 2003

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

1058 C A Sierra et al SOIL R v 10

the one and only way for objects to communicate with eachother

The S4 approach inR is much less strict and allowsdirect manipulation of the data belonging to an object bymeans of the operator(or the slot function respectively)thus revealing the implementation of an object to the out-side code using this object User code based onwill breakif the implementation changes and the desired slot disap-pears while a get method may be able to retrieve the de-sired information from other data The use of the slot op-erator from outside should therefore be avoided (Genolini2008 Gentleman 2003) Imagine for instance acircle ob-ject c thatstoresits radius andcomputesthe diameter whengetDiameter(c) is called If the radius is accessed solelyby calls ofgetRadius(c) the implementation of the circleclass can later be changed to store the diameter and computethe radiuswithoutany affect to outside code using the class

Applications to SOILRrsquosModel occur if one considers theincreasing number of constructors with redundant parametersets The distinction between parameters and derived vari-ables may even become difficult Differing fromSIMECOL

we unify access toModel elements and avoid a syntacticdifference of parameters and derived values as expressed bySIMECOLrsquos functionsparams andout In addition to theget functions we provide for all data intended to be ac-cessed from outside access through the typical operators[]and$ for our Model class This gives access to all data themodel can provide either during the initialization or com-puted by the methods of the class In fact[] and $ inter-nally use theget methods and may perform any numberof checks and computations to provide a consistent outputThis facility is powerful enough to avoid the use ofcom-pletely for our class This is exactly our intention since theimplementation of the class may change accessing its ele-ments viais strongly discouraged While we will maintainthe defined interface via[] $ and theget functionswe cannot guarantee that code relying onwill work in fu-ture versions of SOILR

Another difference withSIMECOL is also related to the[]operator It enables the user to create the desired output ondemand thus avoiding duplication between output objectsIf the user asks forC shehe getsC and nottimeandC which sometimes may not be intended if the user isconcerned about issues of memory or duplication Howeverit may be very useful to have both in other situations whenthe times argument to the constructor that created themodel in the first place is not available anymore With[]the user can decide which fields the output should contain

An additional intended feature of our[] operator is to al-ways producedataframes and not aResult objectthat would (or at least should) be more protective of its dataagainst alterations post simulation than adataframe Ifwe provided code to post-process results we would certainlyimplement such aResult class to make sure that ourpost-processing is based on valid data Since at the moment

we donrsquot we also do not force a structured output object tothe user

At the moment we do not even provide output asdeSolve objects since every structured output is part of theinterface and may be relied on by user code Although weare happy and thankful to usedeSolve extensively withinSOILR making it a part of the interface would be a promiseto the user that we will keep on supporting it which is a muchbigger commitment

Until now the responsibility beyond the scope of classModel stays with the user

Supplementary material related to this article isavailable online athttpwwwgeosci-model-devnet510452012gmd-5-1045-2012-supplementzip

AcknowledgementsFinancial support for the development of thisproject was provided by the Max Planck Society We would like tothank Ulrich Weber and Martin Jung for providing global climatedata used in the example Maarten Braakhekke provided helpfulcomments on a previous version of this manuscript

The service charges for this open access publicationhave been covered by the Max Planck Society

Edited by S Arndt

References

Adair E Parton W Del Grosso S Silver W Harmon MHall S Burke I and Hart S Simple three-pool modelaccurately describes patterns of long-term litter decomposi-tion in diverse climates Glob Change Biol 14 2636ndash2660doi101111j1365-2486200801674x 2008

Agren G and Bosatta E Theoretical ecosystem ecology under-standing element cycles Cambridge University Press 1998

Andren O and Katterer T ICBM The Introductory Carbon Bal-ance Model for Exploration of Soil Carbon Balances EcolAppl 7 1226ndash1236httpwwwjstororgstable2641210 1997

Bolker B M Pacala S W and Parton W J Linearanalysis of soil decomposition insights from the CEN-TURY model Ecol Appl 8 425ndash439doi1018901051-0761(1998)008[0425LAOSDI]20CO2 1998

Bruun S Six J Jensen L and Paustian K Estimating turnoverof soil organic carbon fractions based on radiocarbon measure-ments Radiocarbon 47 99ndash113 2008

Burger M Juenemann K and Koenig T RUnit R Unit testframework R package version 04 25 2009

Burke I Kaye J Bird S Hall S McCulley R and Som-merville G Evaluating and testing models of terrestrial biogeo-chemistry the role of temperature in controlling decompositionModels in ecosystem science Princeton University Press Prince-ton New Jersey USA 225ndash253 2003

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

C A Sierra et al SOIL R v 10 1059

Chambers J Software for data analysis Programing with RSpringer Verlag 2008

Coleman K and Jenkinson D ROTHC-263 A model for theturnover of carbon in soils Rothamsted Research 1999

Cramer W Bondeau A Woodward F I Prentice I C BettsR A Brovkin V Cox P M Fisher V Foley J A FriendA D Kucharik C Lomas M R Ramankutty N SitchS Smith B White A and Young-Molling C Global re-sponse of terrestrial ecosystem structure and function to CO2and climate change results from six dynamic global vegetationmodels Glob Change Biol 7 357ndash373doi101046j1365-2486200100383x 2001

Easter M Paustian K Killian K Williams S Feng T Al-Adamat R Batjes N Bernoux M Bhattacharyya T CerriC Cerri C Coleman K Falloon P Feller C Gicheru PKamoni P Milne E Pal D Powlson D Rawajfih Z SessayM and Wokabi S The GEFSOC soil carbon modelling systemA tool for conducting regional-scale soil carbon inventories andassessing the impacts of land use change on soil carbon AgrEcosyst Environ 122 13ndash25doi101016jagee2007010042007

Edgewall Software The Trac User and Administration Guide 012available athttptracedgewallorgwikiTracGuide(last access12 July 2011) 2011

Foley J An equilibrium model of the terrestrial carbon budgetTellus B 47 310ndash319 2011

Genolini C A (Not So) Short Introduction to S4 available athttpcranr-projectorgdoccontribGenolini-S4tutorialV0-5enpdf(last access 22 August 2012) 2008

Gentleman R S4 Classes in 15 pages more or less avail-able athttpwwwstataucklandacnzS-WorkshopGentlemanS4Objectspdf(last access 22 August 2012) 2003

Grosso S D Parton W Mosier A Holland E Pendall ESchimel D and Ojima D Modeling soil CO2 emissions fromecosystems Biogeochem 73 71ndash91doi101007s10533-004-0898-z 2005

Harmon M and Domingo J A userrsquos guide to STANDCARB ver-sion 20 a model to simulate the carbon stores in forest standsDepartment of Forest Science Oregon State University Corval-lis Oregon 2001

Held I M The Gap between Simulation and Understandingin Climate Modeling B Am Meteorol Soc 86 1609ndash1614doi101175BAMS-86-11-1609 2005

Henin S Monnier G and Turc L Un aspect de la dynamiquedes matieres organiques du sol Comptes rendus hebdomadairesdes seances de lrsquoAcademie des sciences 248 138ndash141 1959

Hocking T D Wutzler T Ponting K and Grosjean P Sustain-able Extensible Documentation Generation using inlinedocs JStat Softw in press 2012

Jacobson M Earth system science from biogeochemical cycles toglobal change Academic Press 2000

Jenkinson D S and Rayner J H The Turnover of Soil OrganicMatter in Some of the Rothamsted Classical Experiments SoilSci 123 298ndash305 1977

Jenkinson D S Andrew S P S Lynch J M Goss M J andTinker P B The Turnover of Organic Carbon and Nitrogen inSoil Philosoph Trans 329 361ndash368 1990

Jenny H Gessel S P and Bingham F T Comparative Study ofDecomposition Rates of Organic Matter in Temperate and Trop-

ical Regions Soil Sci 68 419ndash432 1949Jost J Dynamical systems examples of complex behaviour

Springer Verlag Berlin 2005Kay A The early history of Smalltalk ACM available athttp

wwwsmalltalkorgsmalltalkTheEarlyHistoryOfSmalltalkAbstracthtml(last access 22 August 2012) 1993

Kelly R H Parton W J Hartman M D Stretch L K OjimaD S and Schimel D S Intra-annual and interannual variabilityof ecosystem processes in shortgrass steppe J Geophys Res105 20093ndash20100doi1010292000JD900259 2000

Kirschbaum M U The temperature dependence of soil or-ganic matter decomposition and the effect of global warmingon soil organic C storage Soil Biol Biochem 27 753ndash760doi1010160038-0717(94)00242-S 1995

Knuth D E Literate Programming Comput J 27 97ndash111 1984Knutti R The end of model democracy Climatic Change 102

395ndash404doi101007s10584-010-9800-2 2010Knutti R Furrer R Tebaldi C Cermak J and Meehl

G A Challenges in Combining Projections fromMultiple Climate Models J Climate 23 2739ndash2758doi1011752009JCLI33611 2009

Leisch F Sweave part I Mixing R and LaTeX R News 2 28ndash312002

Leisch F Sweave part II Package vignettes R News 3 21ndash242003

LeVeque R Finite difference methods for ordinary and partial dif-ferential equations Society for Industrial and Applied Mathe-matics Philadelphia 2007

Lloyd J and Taylor J A On the Temperature Dependence of SoilRespiration Funct Ecol 8 315ndash323 1994

Luo Y and Weng E Dynamic disequilibrium of the terrestrial car-bon cycle under global change Trends Ecol Evolut 26 96ndash104doi101016jtree201011003 2011

Manzoni S and Porporato A A theoretical analysis of nonlinear-ities and feedbacks in soil carbon and nitrogen cycles Soil BiolBiochem 39 1542ndash1556 2007

Manzoni S and Porporato A Soil carbon and nitrogen mineral-ization Theory and models across scales Soil Biol Biochem41 1355ndash1379doi101016jsoilbio200902031 2009

Manzoni S Katul G G and Porporato A Analysis of soil car-bon transit times and age distributions using network theories JGeophys Res 114doi1010292009JG001070 2009

Matsumoto Y and Ishituka K Ruby programming language Ad-dison Wesley Publishing Company 2002

Means J E Cromack Jr K and MacMillan P C Comparisonof decomposition models using wood density of Douglas-fir logsCan J Forest Res 15 1092ndash1098doi101139x85-178 1985

Melillo J Borchers J and Chaney J Vegetationecosystemmodeling and analysis project Comparing biogeography andgeochemistry models in a continental-scale study of terres-trial ecosystem responses to climate change and CO2 doublingGlobal Biogeochem Cy 9 407ndash438 1995

Minderman G Addition Decomposition and Accumulation of Or-ganic Matter in Forests J Ecol 56 355ndash362 1968

Nikiforoff C Some general aspects of the chernozem formationSoil Sci Soc Amer J 1 333ndash342 1936

Olson J S Energy Storage and the Balance of Producers and De-composers in Ecological Systems Ecology 44 322ndash331 1963

wwwgeosci-model-devnet510452012 Geosci Model Dev 5 1045ndash1060 2012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012

1060 C A Sierra et al SOIL R v 10

OrsquoSullivan B Mercurial the definitive guide Oreilly amp AssociatesInc available athttpmercurialseleniccom(last access 22 Au-gust 2012) 2009

Parton W Schimel D Cole C and Ojima D Analysis of factorscontrolling soil organic matter levels in Great Plains grasslandsSoil Sci Soc Amer J 51 1173ndash1179 1987

Parton W J Morgan J A Kelly R H and Ojima D S Mod-eling soil C responses to environmental change in grassland sys-tems in The potential of US grazing lands to sequester carbonand mitigate the greenhouse effect edited by Follett R KimbleJ and Lal R CRC 371ndash398 2001

Paul E and Clark F Soil microbiology and biochemistry Aca-demic Press San Diego USA 1996

Paustian KAgren G and Bosatta E Modelling litter qualityeffects on decomposition and soil organic matter dynamics inDriven by nature plant litter quality and decomposition editedby Cadisch G and Giller K E CABI Publishing UK 313ndash335 1997

Petzoldt T and Rinke K simecol An Object-Oriented Frameworkfor Ecological Modeling in R Journal of Statistical Software 221ndash31 available athttpwwwjstatsoftorgv22i09 2007

R Development Core Team R A Language and Environment forStatistical Computing R Foundation for Statistical ComputingVienna Austria available athttpwwwR-projectorg ISBN3-900051-07-0 2011

Randerson J T Hoffman F M Thornton P E MahowaldN M Lindsay K Lee Y-H Nevison C D Doney S CBonan G Stockli R Covey C Running S W and FungI Y Systematic assessment of terrestrial biogeochemistry incoupled climatendashcarbon models Glob Change Biol 15 2462ndash2484doi101111j1365-2486200901912x 2009

Schlesinger W Biogeochemistry An Analysis of Global ChangeAcademic Press 1997

Sierra C A Harmon M E and Perakis S S Decomposition ofheterogeneous organic matter and its long-term stabilization insoils Ecol Monogr 81 619ndash634doi10189011-08111 2011

Soetaert K Petzoldt T and Setzer R W Solving DifferentialEquations in R Package deSolve Journal of Statistical Software33 1ndash25 available athttpwwwjstatsoftorgv33i09 2010

Swift M Heal O and Anderson J Decomposition in terrestrialecosystems University of California Press available athttpbooksgoogledebooksid=hSWMkhdSfPAC 1979

SymPy Development Team SymPyndashPython library for symbolicmathematics Tech rep Technical report (since 2006) avail-able athttpcodegooglecompsympy(last access November2009) 2008

Vanrsquot Hoff J Etudes de dynamique chimique Frederick Muller ampCo Amsterdam 1884

Weedon G P Gomes S Viterbo P Shuttleworth W J BlythE Osterle H Adam J C Bellouin N Boucher O and BestM Creation of the WATCH Forcing Data and Its Use to As-sess Global and Regional Reference Crop Evaporation over Landduring the Twentieth Century J Hydrometeorol 12 823ndash848doi1011752011JHM13691 2011

Wu L and McGechan M A Review of Carbon and Nitrogen Pro-cesses in Four Soil Nitrogen Dynamics Models J Agr EngRes 69 279ndash305doi101006jaer19970250 1998

Wutzler T and Reichstein M Colimitation of decomposition bysubstrate and decomposers ndash a comparison of model formula-tions Biogeosciences 5 749ndash759doi105194bg-5-749-20082008

Geosci Model Dev 5 1045ndash1060 2012 wwwgeosci-model-devnet510452012