File: aquaphy.Rd

package info (click to toggle)
r-cran-desolve 1.40-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,592 kB
  • sloc: fortran: 18,729; ansic: 4,956; makefile: 11
file content (199 lines) | stat: -rw-r--r-- 6,848 bytes parent folder | download | duplicates (5)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
\name{aquaphy}
\alias{aquaphy}
\title{A Physiological Model of Unbalanced Algal Growth}
\description{A phytoplankton model with uncoupled carbon and nitrogen
  assimilation as a function of light and Dissolved Inorganic Nitrogen
  (DIN) concentration.

  Algal biomass is described via 3 different state variables:
  \itemize{
    \item low molecular weight carbohydrates (LMW), the product of
      photosynthesis,
    \item storage molecules (RESERVE) and 
    \item the biosynthetic and photosynthetic apparatus (PROTEINS).
  }
  All algal state variables are expressed in
  \eqn{\rm mmol\, C\, m^{-3}}{mmol C / m^3}.
  Only proteins contain nitrogen and
  chlorophyll, with a fixed stoichiometric ratio.  As the relative
  amount of proteins changes in the algae, so does the N:C and the Chl:C
  ratio.
  
  An additional state variable, dissolved inorganic nitrogen (DIN) has
  units of \eqn{\rm mmol\, N\, m^{-3}}{mmol N / m^3}.
  
  The algae grow in a dilution culture (chemostat): there is constant
  inflow of DIN and outflow of culture water, including DIN and algae,
  at the same rate.
  
  Two versions of the model are included.

  \itemize{
  \item In the default model, there is a day-night illumination regime, i.e.
    the light is switched on and off at fixed times (where the sum of
    illuminated + dark period = 24 hours).
  \item In another version, the light is imposed as a forcing function data
    set.
  }
  
  This model is written in \code{FORTRAN}.
}
\usage{aquaphy(times, y, parms, PAR = NULL, ...)}
\arguments{
  \item{times}{time sequence for which output is wanted; the first value
    of times must be the initial time,}
  \item{y}{the initial (state) values ("DIN", "PROTEIN", "RESERVE",
    "LMW"), in that order,}
  \item{parms }{vector or list with the aquaphy model parameters; see
    the example for the order in which these have to be defined.}
  \item{PAR }{a data set of the photosynthetically active radiation
    (light intensity), if \code{NULL}, on-off PAR is used, }
  \item{...}{any other parameters passed to the integrator \code{ode}
    (which solves the model).}
}
\author{Karline Soetaert <karline.soetaert@nioz.nl>}
\examples{
## ======================================================
##
## Example 1. PAR an on-off function
##
## ======================================================


## -----------------------------
## the model parameters:
## -----------------------------

parameters <- c(maxPhotoSynt   = 0.125,      # mol C/mol C/hr
                rMortPHY       = 0.001,      # /hr
                alpha          = -0.125/150, # uEinst/m2/s/hr
                pExudation     = 0.0,        # -
                maxProteinSynt = 0.136,      # mol C/mol C/hr
                ksDIN          = 1.0,        # mmol N/m3
                minpLMW        = 0.05,       # mol C/mol C
                maxpLMW        = 0.15,       # mol C/mol C
                minQuotum      = 0.075,      # mol C/mol C
                maxStorage     = 0.23,       # /h
                respirationRate= 0.0001,     # /h
                pResp          = 0.4,        # -
                catabolismRate = 0.06,       # /h
                dilutionRate   = 0.01,       # /h
                rNCProtein     = 0.2,        # mol N/mol C
                inputDIN       = 10.0,       # mmol N/m3
                rChlN          = 1,          # g Chl/mol N
                parMean        = 250.,       # umol Phot/m2/s
                dayLength      = 15.         # hours
                )

## -----------------------------
## The initial conditions
## -----------------------------

state <- c(DIN    = 6.,     # mmol N/m3
          PROTEIN = 20.0,   # mmol C/m3
          RESERVE = 5.0,    # mmol C/m3
          LMW     = 1.0)    # mmol C/m3

## -----------------------------
## Running the model
## -----------------------------

times <- seq(0, 24*20, 1)

out <- as.data.frame(aquaphy(times, state, parameters))

## -----------------------------
## Plotting model output
## -----------------------------

par(mfrow = c(2, 2), oma = c(0, 0, 3, 0))
col <- grey(0.9)
ii <- 1:length(out$PAR)              

plot(times[ii], out$Chlorophyll[ii], type = "l",
      main = "Chlorophyll", xlab = "time, hours",ylab = "ug/l")
polygon(times[ii], out$PAR[ii]-10, col = col, border = NA); box()
lines(times[ii], out$Chlorophyll[ii], lwd = 2 )


plot (times[ii], out$DIN[ii], type = "l", main = "DIN",
      xlab = "time, hours",ylab = "mmolN/m3")
polygon(times[ii], out$PAR[ii]-10, col = col, border = NA); box()
lines(times[ii], out$DIN[ii], lwd = 2 )


plot (times[ii], out$NCratio[ii], type = "n", main = "NCratio",
      xlab = "time, hours", ylab = "molN/molC")
polygon(times[ii], out$PAR[ii]-10, col = col, border = NA); box()
lines(times[ii], out$NCratio[ii], lwd = 2 )


plot (times[ii], out$PhotoSynthesis[ii],type = "l",
       main = "PhotoSynthesis", xlab = "time, hours",
       ylab = "mmolC/m3/hr")
polygon(times[ii], out$PAR[ii]-10, col = col, border = NA); box()
lines(times[ii], out$PhotoSynthesis[ii], lwd = 2 )

mtext(outer = TRUE, side = 3, "AQUAPHY, PAR= on-off", cex = 1.5)

## -----------------------------
## Summary model output
## -----------------------------
t(summary(out))

## ======================================================
##
## Example 2. PAR a forcing function data set
##
## ======================================================

times <- seq(0, 24*20, 1)

## -----------------------------
## create the forcing functions
## -----------------------------

ftime  <- seq(0,500,by=0.5)
parval <- pmax(0,250 + 350*sin(ftime*2*pi/24)+
   (runif(length(ftime))-0.5)*250)
Par    <- matrix(nc=2,c(ftime,parval))


state <- c(DIN     = 6.,     # mmol N/m3
           PROTEIN = 20.0,   # mmol C/m3
           RESERVE = 5.0,    # mmol C/m3
           LMW     = 1.0)    # mmol C/m3
              
out <- aquaphy(times, state, parameters, Par)

plot(out, which = c("PAR", "Chlorophyll", "DIN", "NCratio"), 
     xlab = "time, hours", 
     ylab = c("uEinst/m2/s", "ug/l", "mmolN/m3", "molN/molC"))

mtext(outer = TRUE, side = 3, "AQUAPHY, PAR=forcing", cex = 1.5)

# Now all variables plotted in one figure...
plot(out, which = 1:9, type = "l")

par(mfrow = c(1, 1))

}
\references{
  Lancelot, C., Veth, C. and Mathot, S. (1991). Modelling ice-edge
  phytoplankton bloom in the Scotia-Weddel sea sector of the Southern
  Ocean during spring 1988. Journal of Marine Systems 2, 333--346.
  
  Soetaert, K. and Herman, P. (2008). A practical guide to ecological
  modelling.  Using R as a simulation platform. Springer.
}
\details{
  The model is implemented primarily to demonstrate the linking of
  FORTRAN with \R-code.

  The source can be found in the \file{doc/examples/dynload} subdirectory of the package.
}
\seealso{
  \code{\link{ccl4model}}, the CCl4 inhalation model.
}
\keyword{models}