Description Usage Format Author(s) References See Also Examples
Model describing nutrients (N), phytoplankton (P), zooplankton (Z), and detritus (D).
1 | NPZD()
|
An S4 object according to the odeModel
specification.
The object contains the following slots:
main
NPZD model specifications.
parms
vector with the named parameters of the model -
see code.
times
simulation time and integration interval.
init
vector with start values for state variables.
Karline Soetaert
Chapter 2.8.1. from the book by Soetaert and Herman, 2009. A practical guide to ecological Modelling. Using R as a simulation platform. Springer.
R-package simecol for a description of the simObj
class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # initialize model
myNPZD <- NPZD()
# show model code, parameter settings,...
print(myNPZD)
#----------------------#
# RUNNING the model: #
#----------------------#
# 2 steps
# first year = spinup
res <- out(sim(myNPZD))
num <- nrow(res) # last element
# step 2 : the model is reinitialised with the final conditions of previous run
init(myNPZD) <- c(PHYTO =res$PHYTO[num],
ZOO =res$ZOO[num],
DETRITUS=res$DETRITUS[num],
DIN =res$DIN[num])
# step 2: another 2 years simulated
Times <-seq(0,730,by=1)
times(myNPZD) <- Times
res <- out(sim(myNPZD))
#------------------------#
# PLOTTING model output: #
#------------------------#
par(mfrow=c(2,2), oma=c(0,0,3,0))
plot (Times,res$PAR ,type="l",lwd=2,main="PAR" ,
xlab="time, hours",ylab="microEinst/m2/s")
plot (Times,res$Chlorophyll,type="l",lwd=2,main="Chlorophyll",
xlab="time, hours",ylab="microg/l")
plot (Times,res$ZOO ,type="l",lwd=2,main="Zooplankton",
xlab="time, hours",ylab="mmolN/m3")
plot (Times,res$DIN ,type="l",lwd=2,main="DIN" ,
xlab="time, hours",ylab="mmolN/m3")
mtext(outer=TRUE,side=3,"NPZD model",cex=1.5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.