-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path16-phytoplankton.Rmd
683 lines (581 loc) · 32.1 KB
/
16-phytoplankton.Rmd
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
# Phytoplankton
## Contributors
## Overview
The approach to simulate algal biomass is to adopt several plankton functional types ("PFT's") that are typically defined based on specific groups such as diatoms, dinoflagellates and cyanobacteria. Whilst each group that is simulated is unique, they share a common mathematical approach and each simulate growth, death and sedimentation processes, and customisable internal nitrogen, phosphorus and/or silica stores if desired. Distinction between groups is made by adoption of groups specific parameters for environmental dependencies, and/or enabling options such as vertical migration or N fixation.
## Model Description
The main balance equation for a single configured phytoplankton group, $PHY_a$, is described as:
\begin{eqnarray}
\frac{D}{Dt}PHY_{a} = \color{darkgray}{ \mathbb{M} + \mathcal{S} } \quad
&+& \overbrace{ f_{gpp}^{PHY_{a}} - f_{rsp}^{PHY_{a}} - f_{mor}^{PHY_{a}} - f_{exc}^{PHY_{a}} + f_{set}^{PHY_{a}} + \hat{f}_{res}^{PHY_{a}} }^\text{aed_phytoplankton} \\ (\#eq:phy1)
&-& \color{brown}{ f_{grz}^{ZOO} - \hat{f}_{grz}^{BIV} } \\ \nonumber
\end{eqnarray}
where $\mathbb{M}$ and $\mathcal{S}$ refer to water mixing and boundary source terms, respectively. The main processes controlling the rate of phytoplanklton biomass accumulation are gross primary productivity, respiration, mortality, excretion and exudation, settling and vertical migration, and resuspension. In addition, the coloured $\color{brown}{f}$ terms reflect phytoplankton related fluxes computed by other (optionally) linked modules such as the zooplankton ($\mathrm{ZOO}$) or bivalve ($\mathrm{BIV}$) modules, which compute grazing/filtration fluxes based on their rate of phytoplankton consumption.
The default method for simulating phytoplankton biomass assess a constant intracellular C:N:P ratio. In this case, only a single state variable for carbon biomass is simulated and subject to trasnport, with the N and P content computed based on the C concentration at any point in time or space. The module also supports the simulation of dynamic intracellular stoichiometry should this be required. Within this setting, state variables are also optionally created for phytoplankton biomass N and P content (termed $IN$ and $IP$, respectively):
\begin{eqnarray}
\frac{D}{Dt}IN_{a} = \color{darkgray}{ \mathbb{M} + \mathcal{S} } \quad
&+& \overbrace{ f_{upt}^{IN_{a}} - f_{rsp}^{IN_{a}} - f_{mor}^{IN_{a}} - f_{exc}^{IN_{a}} + f_{set}^{IN_{a}} + \hat{f}_{res}^{IN_{a}} }^\text{aed_phytoplankton} \\ (\#eq:phy2)
&-& \color{brown}{ f_{grz}^{ZOO} - \hat{f}_{grz}^{BIV} } \\ \nonumber
\end{eqnarray}
and
\begin{eqnarray}
\frac{D}{Dt}IP_{a} = \color{darkgray}{ \mathbb{M} + \mathcal{S} } \quad
&+& \overbrace{ f_{upt}^{IP_{a}} - f_{rsp}^{IP_{a}} - f_{mor}^{IP_{a}} - f_{exc}^{IP_{a}} + f_{set}^{IP_{a}} + \hat{f}_{res}^{IP_{a}} }^\text{aed_phytoplankton} \\ (\#eq:phy3)
&-& \color{brown}{ f_{grz}^{ZOO} - \hat{f}_{grz}^{BIV} } \\ \nonumber
\end{eqnarray}
A detailed overview of the above functions for C, N and P for each of the various process rates is provided next.
### Process Descriptions
#### Photosynthesis & Nutrient Uptake {-}
For each phytoplankton group, $a$, the maximum potential growth rate at 20˚C is multiplied by the minimum value of expressions for limitation by light, phosphorus, nitrogen and silica (when configured). While there may be some interaction between limiting factors, a minimum expression is likely to provide a realistic representation of growth limitation (Rhee and Gotham, 1981).
Therefore, photosynthesis is parameterized as the uptake of carbon, and depends on the temperature, light and nutrient dimensionless functions (adopted from Hipsey & Hamilton, 2008; Li et al., 2013):
<br>
:::: {.bluebox data-latex=""}
\begin{equation}
\text{Phytoplankton Growth Equation}
(\#eq:phyto1)
\end{equation}
\begin{align}
{f_{gpp}^{PHY_{a}}} &= \: [PHY_{a}] \times
\end{align}
\begin{align}
\underbrace{{R_{growth}^{PHY_{a}}}}_{\text{Max growth rate at 20˚C}} \times \underbrace{(1-{k_{pr}^{PHY_{a}}})}_{\text{Photorespiratory loss}} \times \underbrace{{\Phi_{tem}^{PHY_{a}}}(T)}_{\text{Temperature scaling}} \times \underbrace{{\Phi_{str}^{PHY_{a}}}(T)}_{\text{Metabolic stress}} \times
\end{align}
\begin{align}
&{\text{min}}\begin{Bmatrix}\underbrace{\Phi_{light}^{PHY_{a}}(I)}_{\text{Light limitation}},\underbrace{\Phi_{N}^{PHY_{a}}(NO_{3},NH_{4},PHY_{N_{a}})}_{\text{N limitation}},\underbrace{\Phi_{P}^{PHY_{a}}(PO_{4},PHY_{P_{a}})}_{\text{P limitation}},\underbrace{\Phi_{Si}^{PHY_{a}}(RSi)}_{\text{Si limitation}}\end{Bmatrix} \times
\end{align}
::::
<br>
**Temperature limitation**: Temperature is a key environmental driver that shapes the responses of different phytoplankton groups. To allow for reduced growth at non-optimal temperatures, a temperature function is used where the maximum productivity occurs at a temperature $T_{OPT}$; above this productivity decreases to zero at the maximum allowable temperature, $T_{MAX}$. Below the standard temperature, $T_{STD}$ the productivity follows a simple Arrenhius scaling formulation. In order to fit a function with these restrictions the following conditions are assumed: at $T=T_{STD}$,$\ {\ \Phi}_{tem}\left(T\right)=1$ and at $T=T_{OPT},\ \ \frac{d\Phi_{tem}\left(T\right)}{dT}=0$, and at $T=T_{MAX}$,$\ \Phi_{tem}\left(T\right)=0$. This can be numerically solved using Newton’s iterative method and can be specific for each phytoplankton group. The temperature function is calculated according to (Griffin et al. 2001):
<center>
<br>
\begin{equation}
\Phi_{tem}^{{PHY}_a}\left(T\right)=\vartheta_a^{T-20}-\vartheta_a^{k\left[T-{c1}_a\right]}+{c0}_a
(\#eq:phyto2)
\end{equation}
<br>
</center>
where ${c1}_a$ and ${c0}_a$ are solved numerically given input values of: $T_a^{std}$, $T_a^{opt}$ and $T_a^{max}$.
**Light limitation**: The level of light limitation on phytoplankton growth can be modelled as photoinhibition or non-photoinhibition. In the absence of significant photoinhibition, Webb et al. (1974) suggested a relationship for the fractional limitation of the maximum potential rate of carbon fixation for the case where light saturation behavior was absent (Talling, 1957), and the equations can be analytically integrated with respect to depth (Hipsey and Hamilton, 2008). For the case of photoinhibition, the light saturation value of maximum production ($I_S$) is used and the net level effect can be averaged over the cell by integrating over depth.
The `aed_phytoplankton` module contains several light functions, including those from a recent review by Baklouti et al. (2006). The user must select the sensitivity to light according to a photosynthesis-irradiance (P-I curve) formulation and each species must be set to be either non-photoinhibited or photoinhibited according to the options in Table 9.
```{r echo=FALSE,message=FALSE, warning=FALSE}
library(knitr)
knit_hooks$set(customcap= function(before, options, envir) {
if(!before) {
paste('<p class="caption"> (\\#fig:chunk1)',options$customcap,"</p>",sep="")
}
})
```
```{r, echo=FALSE,message=FALSE, warning=FALSE, customcap="Light limitation of pytoplankton via various model approaches.", out.width = '100%'}
htmltools::includeHTML('phytoplankton_plots/app.html')
```
**Nutrient limitation**: Limitation of the photosynthetic rate may be dampened according to nitrogen or phosphorus availability, and this is either approximated using a Monod expression of the static model is chosen, or based on the internal nutrient stoichiometry if the dynamic (Droop uptake) model is selected:
For advanced users, an optional metabolic scaling factor can be included to reduce the photosynthetic capacity of the simulated organisms, for example due to metabolic stress due to undertaking N~2~ fixation:
<center>
<br>
\begin{equation}
\Phi_{str}^{{PHY}_a}=\underbrace{f_{NF}^{{PHY}_a}+\left[{1-f}_{NF}^{{PHY}_a}\right]\Phi_N^{{PHY}_a}\left({NO}_3,{NH}_4,{PHY_N}_a\right)}_{N_{2}\text{ fixation growth scaling}}
(\#eq:phyto3)
\end{equation}
<br>
</center>
The above discussion relates to photosynthesis and carbon uptake by the phytoplankton community. In addition users must choose one of two options to model the P, N uptake dynamics for each algal group: i) a constant nutrient to carbon ratio, or ii) simulation of dynamic intracellular stores. For the first model a simple Michaelis-Menten equation is used to model nutrient limitation with a half-saturation constant for the effect of external nutrient concentrations on the growth rate.
The internal phosphorus and nitrogen dynamics within the phytoplankton groups can be modelled using dynamic intracellular stores that are able to regulate growth based on the model of Droop (1974). This model allows for the phytoplankton to have dynamic nutrient uptake rates with variable internal nutrient concentrations bounded by user-defined minimum and maximum values (e.g., see Li et al., 2013).
The uptake of nitrogen must be partitioned into uptake of NO~3~, and NH~4~. The distinction between uptake of NO~3~ and NH~4~ is calculated automatically via a preference factor:
<center>
<br>
\begin{equation}
{\ p}_{NH4}^{{PHY}_a}=\frac{{NO}_3\ {NH}_4}{\left({NH}_4+K_N^{{PHY}_a}\right)\left({NO}_3+K_N^{{PHY}_a}\right)}\frac{{NH}_4{\ K}_N^{{PHY}_a}}{\left({NH}_4+{NO}_3\right)\left({NO}_3+K_N^{{PHY}_a}\right)}
(\#eq:phyto4)
\end{equation}
<br>
\begin{equation}
p_{NO3}^{{PHY}_a}=1-{\ p}_{NH4}^{{PHY}_a}
(\#eq:phyto5)
\end{equation}
<br>
</center>
For diatom groups, silica processes are simulated that include uptake of dissolved silica. The silica limitation function for diatoms is similar to the constant cases for nitrogen and phosphorus which assumes a fixed C:Si ratio.
#### Respiration, Excretion & Mortality {-}
Metabolic loss of nutrients from mortality and excretion is proportional to the internal nitrogen to chla ratio multiplied by the loss rate and the fraction of excretion and mortality that returns to the detrital pool. Loss terms for respiration, natural mortality and excretion are modelled with a single ‘respiration’ rate coefficient. This loss rate is then divided into the pure respiratory fraction and losses due to mortality and excretion. The constant $f_{DOM}$ is the fraction of mortality and excretion to the dissolved organic pool with the remainder into the particulate organic pool.
Nutrient losses through mortality and excretion for the internal nutrient model are similar to the simple model described above, except that dynamically calculated internal nutrient concentrations are used.
<center>
<br>
\begin{align*}
\hat{R}&=R_{resp}^{{PHY}_a}\ \ \Phi_{sal}^{{PHY}_a}\left(S\right)\ \ \left(\vartheta_{resp}^{{PHY}_a}\right)^{T-20}
(\#eq:phyto6)\\
f_{resp}^{{PHY_C}_a}&=k_{fres}^{{PHY}_a}\ \hat{R}\ \left[{PHY_C}_a\right]
(\#eq:phyto7)\\
f_{excr}^{{PHY_C}_a}&=\left(1-k_{fres}^{{PHY}_a}\right)\ k_{fdom}^{{PHY}_a}\ \hat{R}\ \ \left[{PHY_C}_a\right]
(\#eq:phyto8)\\
f_{mort}^{{PHY_C}_a}&=\left(1-k_{fres}^{{PHY}_a}\right)\ \left({1-k}_{fdom}^{{PHY}_a}\right)\ \hat{R}\ \left[{PHY_C}_a\right]
(\#eq:phyto9)\\
f_{excr}^{{PHY_N}_a}&=k_{fdom}^{{PHY}_a}\ \hat{R}\ \left[{PHY_N}_a\right]
(\#eq:phyto10)\\
f_{mort}^{{PHY_N}_a}&=\left(1-k_{fdom}^{{PHY}_a}\right)\ \hat{R}\ \left[{PHY_N}_a\right]
(\#eq:phyto11)\\
f_{excr}^{{PHY_P}_a}&=k_{fdom}^{{PHY}_a}\ \hat{R}\ \left[{PHY_P}_a\right]
(\#eq:phyto12)\\
f_{mort}^{{PHY_P}_a}&=\left(1-k_{fdom}^{{PHY}_a}\right)\ \hat{R}\ \ \left[{PHY_P}_a\right]
(\#eq:phyto13)\\
f_{excr}^{{PHY_{Si}}_a}&=\hat{R}\ \left[{PHY_{Si}}_a\right]
(\#eq:phyto14)
\end{align*}
<br>
</center>
The salinity effect on mortality is given by various quadratic formulations, depending on the groups sensitivity to salinity (Griffin et al 2001; Robson and Hamilton, 2004). An example of the use of various salinity limitation options is shown in Figure 3.
```{r, echo=FALSE,message=FALSE, warning=FALSE, customcap="Salinity growth suppression of pytoplankton via various model approaches.", out.width = '100%'}
knitr::include_app('https://gilesnknight.shinyapps.io/aed_manual_salinity_growth_suppression/', height = '511px')
```
```{r, echo=FALSE,message=FALSE, warning=FALSE, customcap="Salinity respiration amplification of pytoplankton via various model approaches.", out.width = '100%'}
knitr::include_app('https://gilesnknight.shinyapps.io/aed_manual_salinity_respiration_amplification/', height = '511px')
```
### Optional Module Links
Other modules can influence phytoplankton sources/sinks, as indicated in Eq \@ref(eq:phy1) for $PHY$. These include:
- aed_oxygen: $O_2$ is influenced by the rate of photosynthesis and respiration.
- aed_carbon: $DIC$ is influenced by the rate of photosynthesis and respiration.
- aed_phosphorus: $PO_4$ is consumed during photosynthesis.
- aed_nitrogen: $NO_3$ and $NH_4$ are consumed during photosynthesis.
- aed_silica: $SiO2$ is consumed during photosynthesis.
- aed_organic_matter: $DOM$ and $POM$ is contributed to by the rate of phytoplankton excretion and mortality.
- aed_zooplankton: zooplankton can optionally graze upon any phytoplankton groups.
- aed_bivalve: bivalves can optionally graze upon any phytoplankton groups.
- aed_noncohesive: optional link to simulate the phytoplankton resuspension.
- aed_seddiagenesis: benthic phytoplankton (MPB) can grow and influence oxygen, carbon and nutrient fluxes at the sediment-water interface.
### Feedbacks to the Host Model
The phytoplankton module can feedback conditions to the hydrodynamic model by modifying the light extinction coefficient. For each group simulated a specific attenuation coefficient, $K_e$, is applied, and is specific for each group simulated.
This total light extinction computed by the PHY model is:
\begin{equation}
K_{d}^{phy} = \sum_{a}K_{e_{PHY_a}} PHY_a
\end{equation}
<!-- \\ (\#eq:phy_light_extc) -->
<br>
### Variable Summary
The default variables created by this module, and the optionally required linked variables needed for full functionality of this module are summarised in Table \@ref(tab:16-statetable). The diagnostic outputs able to be output are summarised in Table \@ref(tab:16-diagtable).
#### State Variables {-}
```{r 16-statetable, echo=FALSE, message=FALSE, warning=FALSE}
library(knitr)
library(kableExtra)
library(readxl)
library(rmarkdown)
theSheet <- read_excel('tables/aed_variable_tables.xlsx', sheet = 11)
theSheet <- theSheet[theSheet$Table == "State variable",]
theSheetGroups <- unique(theSheet$Group)
theSheet$`AED name` <- paste0("`",theSheet$`AED name`,"`")
for(i in seq_along(theSheet$Symbol)){
if(!is.na(theSheet$Symbol[i])==TRUE){
theSheet$Symbol[i] <- paste0("$$",theSheet$Symbol[i],"$$")
} else {
theSheet$Symbol[i] <- NA
}
}
for(i in seq_along(theSheet$Unit)){
if(!is.na(theSheet$Unit[i])==TRUE){
theSheet$Unit[i] <- paste0("$$\\small{",theSheet$Unit[i],"}$$")
} else {
theSheet$Unit[i] <- NA
}
}
for(i in seq_along(theSheet$Comments)){
if(!is.na(theSheet$Comments[i])==TRUE){
theSheet$Comments[i] <- paste0("",theSheet$Comments[i],"")
} else {
theSheet$Comments[i] <- " "
}
}
kbl(theSheet[,3:NCOL(theSheet)], caption = "Phytoplankton - *state* variables", align = "l",) %>%
pack_rows(theSheetGroups[1],
min(which(theSheet$Group == theSheetGroups[1])),
max(which(theSheet$Group == theSheetGroups[1])),
background = '#ebebeb') %>%
pack_rows(theSheetGroups[2],
min(which(theSheet$Group == theSheetGroups[2])),
max(which(theSheet$Group == theSheetGroups[2])),
background = '#ebebeb') %>%
row_spec(0, background = "#14759e", bold = TRUE, color = "white") %>%
kable_styling(full_width = F,font_size = 11) %>%
column_spec(2, width_min = "7em") %>%
column_spec(3, width_max = "18em") %>%
column_spec(4, width_min = "10em") %>%
column_spec(5, width_min = "5em") %>%
column_spec(7, width_min = "10em") %>%
column_spec(7, width_max = "20em") %>%
scroll_box(width = "770px", height = "820px",
fixed_thead = FALSE)
```
<br>
#### Diagnostics {-}
```{r 16-diagtable, echo=FALSE, message=FALSE, warning=FALSE}
library(knitr)
library(kableExtra)
library(readxl)
library(rmarkdown)
theSheet <- read_excel('tables/aed_variable_tables.xlsx', sheet = 11)
theSheet <- theSheet[theSheet$Table == "Diagnostics",]
theSheetGroups <- unique(theSheet$Group)
theSheet$`AED name` <- paste0("`",theSheet$`AED name`,"`")
for(i in seq_along(theSheet$Symbol)){
if(!is.na(theSheet$Symbol[i])==TRUE){
theSheet$Symbol[i] <- paste0("$$",theSheet$Symbol[i],"$$")
} else {
theSheet$Symbol[i] <- NA
}
}
for(i in seq_along(theSheet$Unit)){
if(!is.na(theSheet$Unit[i])==TRUE){
theSheet$Unit[i] <- paste0("$$\\small{",theSheet$Unit[i],"}$$")
} else {
theSheet$Unit[i] <- NA
}
}
for(i in seq_along(theSheet$Comments)){
if(!is.na(theSheet$Comments[i])==TRUE){
theSheet$Comments[i] <- paste0("",theSheet$Comments[i],"")
} else {
theSheet$Comments[i] <- " "
}
}
kbl(theSheet[,3:NCOL(theSheet)], caption = "Phytoplankton - *diagnostic* variables", align = "l",) %>%
pack_rows(theSheetGroups[1],
min(which(theSheet$Group == theSheetGroups[1])),
max(which(theSheet$Group == theSheetGroups[1])),
background = '#ebebeb') %>%
pack_rows(theSheetGroups[2],
min(which(theSheet$Group == theSheetGroups[2])),
max(which(theSheet$Group == theSheetGroups[2])),
background = '#ebebeb') %>%
pack_rows(theSheetGroups[3],
min(which(theSheet$Group == theSheetGroups[3])),
max(which(theSheet$Group == theSheetGroups[3])),
background = '#ebebeb') %>%
row_spec(0, background = "#00796b", bold = TRUE, color = "white") %>%
kable_styling(full_width = F,font_size = 11) %>%
column_spec(2, width_min = "7em") %>%
column_spec(3, width_max = "18em") %>%
column_spec(4, width_min = "10em") %>%
column_spec(5, width_min = "6em") %>%
column_spec(7, width_min = "10em") %>%
scroll_box(width = "770px", height = "1900px",
fixed_thead = FALSE)
```
<br>
<!-- ```{r 16-diagnostics, echo=FALSE, message=FALSE, warning=FALSE} -->
<!-- library(knitr) -->
<!-- library(kableExtra) -->
<!-- diagnostics <- read.csv("tables/16-phytoplankton/diagnostics.csv", check.names=FALSE) -->
<!-- kable(diagnostics,"html", escape = F, align = "c", caption = "Diagnostics") %>% -->
<!-- kable_styling(diagnostics, bootstrap_options = "basic", -->
<!-- full_width = F, position = "center", font_size = 12) %>% -->
<!-- column_spec(1, width_min = "6em") %>% -->
<!-- column_spec(2, width_min = "6em") %>% -->
<!-- column_spec(3, width_min = "6em") %>% -->
<!-- column_spec(4, width_min = "6em") %>% -->
<!-- column_spec(5, width_min = "6em") %>% -->
<!-- row_spec(1:17, background = 'white') %>% -->
<!-- scroll_box(width = "770px", height = "500px", -->
<!-- fixed_thead = FALSE) -->
<!-- ``` -->
### Parameter and Option Summary
The module requires users to set both module level confiuration options and parameters, and group-specific parameters.
The group-specific parameters and settings are read in through the `aed_phyto_pars`, summarised in Table \@ref(tab:16-parstable).
```{r 16-parstable, echo=FALSE, message=FALSE, warning=FALSE}
library(knitr)
library(kableExtra)
library(readxl)
library(rmarkdown)
theSheet <- read_excel('tables/aed_variable_tables.xlsx', sheet = 11)
theSheet <- theSheet[theSheet$Table == "Parameter",]
theSheetGroups <- unique(theSheet$Group)
theSheet$`AED name` <- paste0("`",theSheet$`AED name`,"`")
for(i in seq_along(theSheet$Symbol)){
if(!is.na(theSheet$Symbol[i])==TRUE){
theSheet$Symbol[i] <- paste0("$$",theSheet$Symbol[i],"$$")
} else {
theSheet$Symbol[i] <- " "
}
}
for(i in seq_along(theSheet$Unit)){
if(!is.na(theSheet$Unit[i])==TRUE){
theSheet$Unit[i] <- paste0("$$\\small{",theSheet$Unit[i],"}$$")
} else {
theSheet$Unit[i] <- NA
}
}
for(i in seq_along(theSheet$Comments)){
if(!is.na(theSheet$Comments[i])==TRUE){
theSheet$Comments[i] <- paste0("",theSheet$Comments[i],"")
} else {
theSheet$Comments[i] <- "-"
}
}
kbl(theSheet[,3:NCOL(theSheet)], caption = "Phytoplankton group-specific parameters and configuration options", align = "l",) %>%
pack_rows(theSheetGroups[1],
min(which(theSheet$Group == theSheetGroups[1])),
max(which(theSheet$Group == theSheetGroups[1])),
background = '#ebebeb') %>%
pack_rows(theSheetGroups[2],
min(which(theSheet$Group == theSheetGroups[2])),
max(which(theSheet$Group == theSheetGroups[2])),
background = '#ebebeb') %>%
pack_rows(theSheetGroups[3],
min(which(theSheet$Group == theSheetGroups[3])),
max(which(theSheet$Group == theSheetGroups[3])),
background = '#ebebeb') %>%
pack_rows(theSheetGroups[4],
min(which(theSheet$Group == theSheetGroups[4])),
max(which(theSheet$Group == theSheetGroups[4])),
background = '#ebebeb') %>%
pack_rows(theSheetGroups[5],
min(which(theSheet$Group == theSheetGroups[5])),
max(which(theSheet$Group == theSheetGroups[5])),
background = '#ebebeb') %>%
pack_rows(theSheetGroups[6],
min(which(theSheet$Group == theSheetGroups[6])),
max(which(theSheet$Group == theSheetGroups[6])),
background = '#ebebeb') %>%
pack_rows(theSheetGroups[7],
min(which(theSheet$Group == theSheetGroups[7])),
max(which(theSheet$Group == theSheetGroups[7])),
background = '#ebebeb') %>%
pack_rows(theSheetGroups[8],
min(which(theSheet$Group == theSheetGroups[8])),
max(which(theSheet$Group == theSheetGroups[8])),
background = '#ebebeb') %>%
pack_rows(theSheetGroups[9],
min(which(theSheet$Group == theSheetGroups[9])),
max(which(theSheet$Group == theSheetGroups[9])),
background = '#ebebeb') %>%
row_spec(0, background = "#e64a19", bold = TRUE, color = "white") %>%
kable_styling(full_width = F,font_size = 11) %>%
column_spec(2, width_min = "7em") %>%
column_spec(3, width_max = "19em") %>%
column_spec(4, width_min = "10em") %>%
column_spec(5, width_min = "5em") %>%
column_spec(7, width_min = "10em") %>%
scroll_box(width = "770px", height = "2500px",
fixed_thead = FALSE)
```
<br>
The module level parameters and settings are read in as normal through the `aed.nml`, summarised in Table \@ref(tab:16-configtable).
```{r 16-configtable, echo=FALSE, message=FALSE, warning=FALSE}
library(knitr)
library(kableExtra)
library(readxl)
library(rmarkdown)
theSheet <- read_excel('tables/aed_variable_tables.xlsx', sheet = 11)
theSheet <- theSheet[theSheet$Table == "Configuration",]
theSheetGroups <- unique(theSheet$Group)
theSheet$`AED name` <- paste0("`",theSheet$`AED name`,"`")
for(i in seq_along(theSheet$Symbol)){
if(!is.na(theSheet$Symbol[i])==TRUE){
theSheet$Symbol[i] <- paste0("$$",theSheet$Symbol[i],"$$")
} else {
theSheet$Symbol[i] <- " "
}
}
for(i in seq_along(theSheet$Unit)){
if(!is.na(theSheet$Unit[i])==TRUE){
theSheet$Unit[i] <- paste0("$$\\small{",theSheet$Unit[i],"}$$")
} else {
theSheet$Unit[i] <- NA
}
}
for(i in seq_along(theSheet$Comments)){
if(!is.na(theSheet$Comments[i])==TRUE){
theSheet$Comments[i] <- paste0("",theSheet$Comments[i],"")
} else {
theSheet$Comments[i] <- "-"
}
}
kbl(theSheet[,3:NCOL(theSheet)], caption = "Phytoplankton group-specific parameters and configuration options", align = "l",) %>%
pack_rows(theSheetGroups[1],
min(which(theSheet$Group == theSheetGroups[1])),
max(which(theSheet$Group == theSheetGroups[1])),
background = '#ebebeb') %>%
pack_rows(theSheetGroups[2],
min(which(theSheet$Group == theSheetGroups[2])),
max(which(theSheet$Group == theSheetGroups[2])),
background = '#ebebeb') %>%
pack_rows(theSheetGroups[3],
min(which(theSheet$Group == theSheetGroups[3])),
max(which(theSheet$Group == theSheetGroups[3])),
background = '#ebebeb') %>%
pack_rows(theSheetGroups[4],
min(which(theSheet$Group == theSheetGroups[4])),
max(which(theSheet$Group == theSheetGroups[4])),
background = '#ebebeb') %>%
row_spec(0, background = "#ff7043", bold = TRUE, color = "white") %>%
kable_styling(full_width = F,font_size = 11) %>%
column_spec(2, width_min = "7em") %>%
column_spec(3, width_max = "19em") %>%
column_spec(4, width_min = "10em") %>%
column_spec(5, width_min = "5em") %>%
column_spec(7, width_min = "10em") %>%
scroll_box(width = "770px", height = "1500px",
fixed_thead = FALSE)
```
<br>
<!-- ```{r 16-parametersummmary, echo=FALSE, message=FALSE, warning=FALSE} -->
<!-- library(knitr) -->
<!-- library(kableExtra) -->
<!-- library(dplyr) -->
<!-- library(tidyverse) -->
<!-- parameter_summary <- read.csv("tables/16-phytoplankton/parameter_summary.csv", check.names=FALSE) -->
<!-- kable(parameter_summary,"html", escape = F, align = "c", caption = "Diagnostics", -->
<!-- bootstrap_options = "hover") %>% -->
<!-- kable_styling(parameter_summary, bootstrap_options = "hover", -->
<!-- full_width = F, position = "center", font_size = 12) %>% -->
<!-- column_spec(1, width_min = "6em") %>% -->
<!-- column_spec(2, width_min = "6em") %>% -->
<!-- column_spec(3, width_min = "6em") %>% -->
<!-- column_spec(4, width_min = "6em") %>% -->
<!-- column_spec(5, width_min = "6em") %>% -->
<!-- column_spec(6, width_min = "6em") %>% -->
<!-- column_spec(7, width_min = "6em") %>% -->
<!-- column_spec(8, width_min = "6em") %>% -->
<!-- column_spec(9, width_min = "6em") %>% -->
<!-- column_spec(10, width_min = "6em") %>% -->
<!-- column_spec(11, width_min = "6em") %>% -->
<!-- column_spec(12, width_min = "6em") %>% -->
<!-- column_spec(13, width_min = "6em") %>% -->
<!-- column_spec(14, width_min = "6em") %>% -->
<!-- column_spec(15, width_min = "6em") %>% -->
<!-- column_spec(16, width_min = "6em") %>% -->
<!-- column_spec(17, width_min = "6em") %>% -->
<!-- column_spec(18, width_min = "6em") %>% -->
<!-- column_spec(19, width_min = "6em") %>% -->
<!-- column_spec(20, width_min = "6em") %>% -->
<!-- column_spec(21, width_min = "6em") %>% -->
<!-- column_spec(22, width_min = "6em") %>% -->
<!-- column_spec(23, width_min = "6em") %>% -->
<!-- column_spec(24, width_min = "6em") %>% -->
<!-- row_spec(1:55, background = 'white') %>% -->
<!-- row_spec(1:1, background = '#E8EAEF') %>% -->
<!-- row_spec(6:6, background = '#E8EAEF') %>% -->
<!-- row_spec(13:13, background = '#E8EAEF') %>% -->
<!-- row_spec(18:18, background = '#E8EAEF') %>% -->
<!-- row_spec(24:24, background = '#E8EAEF') %>% -->
<!-- row_spec(29:29, background = '#E8EAEF') %>% -->
<!-- row_spec(42:42, background = '#E8EAEF') %>% -->
<!-- row_spec(51:51, background = '#E8EAEF') %>% -->
<!-- scroll_box(width = "770px", height = "500px", -->
<!-- fixed_thead = FALSE) -->
<!-- ``` -->
## Setup & Configuration
### Setup Example
<!-- ```{r 16-parameterconfig, echo=FALSE, message=FALSE, warning=FALSE} -->
<!-- library(knitr) -->
<!-- library(kableExtra) -->
<!-- parameter_config <- read.csv("tables/16-phytoplankton/parameter_config.csv", check.names=FALSE) -->
<!-- kable(parameter_config,"html", escape = F, align = "c", caption = "Parameters and configuration", -->
<!-- bootstrap_options = "hover") %>% -->
<!-- kable_styling(parameter_config, bootstrap_options = "hover", -->
<!-- full_width = F, position = "center", font_size = 12) %>% -->
<!-- column_spec(1, width_min = "10em") %>% -->
<!-- column_spec(2, width_min = "10em") %>% -->
<!-- column_spec(3, width_min = "6em") %>% -->
<!-- column_spec(4, width_min = "6em") %>% -->
<!-- column_spec(5, width_min = "6em") %>% -->
<!-- column_spec(6, width_min = "6em") %>% -->
<!-- column_spec(7, width_min = "6em") %>% -->
<!-- row_spec(1:19, background = 'white') %>% -->
<!-- scroll_box(width = "770px", height = "500px", -->
<!-- fixed_thead = FALSE) -->
<!-- ``` -->
An example `aed.nml` configuration block for the `aed_phytoplankton` module that includes a single simulated group plus microphytobenthos (MPB) and resuspension effects, and doesn't consider Si limitation, is shown below:
```{fortran, eval = FALSE}
&aed_phytoplankton
!-- Configure phytoplankton groups to simulate
num_phytos = 1
the_phytos = 1
settling = 1
!-- Benthic phytoplankton group (microphytobenthos)
do_mpb = 1
R_mpbg = 0.5
R_mpbr = 0.05
I_Kmpb = 100.
mpb_max = 2000.
resuspension = 0.45
n_zones = 4
active_zones = 2,3,4,5
resus_link = 'NCS_resus'
!-- Set link variables to other modules
p_excretion_target_variable ='OGM_dop'
n_excretion_target_variable ='OGM_don'
c_excretion_target_variable ='OGM_doc'
si_excretion_target_variable =''
p_mortality_target_variable ='OGM_pop'
n_mortality_target_variable ='OGM_pon'
c_mortality_target_variable ='OGM_poc'
si_mortality_target_variable =''
p1_uptake_target_variable ='PHS_frp'
n1_uptake_target_variable ='NIT_nit'
n2_uptake_target_variable ='NIT_amm'
si_uptake_target_variable =''
do_uptake_target_variable ='OXY_oxy'
c_uptake_target_variable =''
!-- General options
dbase = '../External/AED/aed_phyto_pars.nml'
diag_level = 1
/
```
<br>
Note that when simulating benthic phytoplankton, the bottom zones in the model to be active must be selected.
Another example `aed.nml` block for the phytoplankton module that includes no benthic (bottom) phytoplankton, and three different groups is shown below:
<br>
```{fortran, eval = FALSE}
&aed_phytoplankton
!-- Configure phytoplankton groups to simulate
num_phytos = 3
the_phytos = 1,2,3 ! cyanos,greens,diatoms
settling = 3,1,1 ! approach to settling/migration
!-- Benthic phytoplankton group (microphytobenthos)
do_mpb = 0
!-- Set link variables to other modules
p_excretion_target_variable ='OGM_dop'
n_excretion_target_variable ='OGM_don'
c_excretion_target_variable ='OGM_doc'
si_excretion_target_variable=''
p_mortality_target_variable ='OGM_pop'
n_mortality_target_variable ='OGM_pon'
c_mortality_target_variable ='OGM_poc'
si_mortality_target_variable=''
p1_uptake_target_variable ='PHS_frp'
n1_uptake_target_variable ='NIT_amm'
n2_uptake_target_variable ='NIT_nit'
si_uptake_target_variable ='SIL_rsi'
do_uptake_target_variable ='OXY_oxy'
c_uptake_target_variable ='CAR_dic'
!-- General options
dbase = 'aed/aed_phyto_pars.csv'
diag_level = 10
min_rho = 900.0
max_rho = 1200.0
/
```
<br>
The numbers reported here are for example purposes and should be reviewed before use based on the users chosen site context.
<br>
```{block2, note-text, type='rmdnote'}
In addition to adding the above code block to `aed.nml`, users must also supply a valid AED phytoplankton parameter database file (`aed_phyto_pars`).
The database file can be supplied in either `NML` or `CSV` format, though after AED 2.0 it is reccomended users use the `CSV` option.
Users can create a standard file in the correct format from the online [**AED parameter database**](https://aed.see.uwa.edu.au/research/models/AED/aed_dbase/db_edit.php) by selecting from the available groups of interest, downloading via the **"Make CSV"** button, and then tailoring to the simulation being undertaken as required. Carefully check the parameter units and values!
```
<br>
## Case Studies & Examples
### Case Study : Falling Creek Reservoir
Falling Creek Reservoir (FCR) is a water supply reservoir in Virginia.
<!-- <center> -->
<!-- ```{r echo=FALSE, message=FALSE, warning=FALSE, width = 501, height = 385} -->
<!-- library(leaflet) -->
<!-- leaflet(height=385, width=500) %>% -->
<!-- setView(lng = 115.835235, lat = -31.991618, zoom = 11) %>% -->
<!-- addTiles() %>% -->
<!-- addProviderTiles(providers$Stamen.Terrain) %>% -->
<!-- addMarkers(lng = 115.835235, lat = -31.991618, popup = "Swan River") -->
<!-- ``` -->
<!-- </center> -->
<center>
![Figure X: Example outputs from the FCR GLM-AED model, showing a) the total chl-a concentration depth profiles, and b) the change in biomass of the indivdual simulated groups.](images/phytoplankton/fcr_phyto_example1.png){width=90%}
</center>
<br>
An example GLM-AED simulation for FCR is available in the GLM example simulations provided on GitHub.
<!-- ### Publications -->