-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path23-sediment_biogeochemistry.Rmd
3478 lines (2519 loc) · 187 KB
/
23-sediment_biogeochemistry.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
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# (PART) AED Benthic Modules {.unnumbered}
# Sediment Biogeochemistry
## Contributors
Daniel Paraska, Matthew R. Hipsey
## Overview
This module is a sediment reactive transport model, based on a 1D approximation of the sediment solid and pore-water profiles. Each active sediment zone (or column) is discretized into a user defineable number of layers that start at thicknesses of around 1 mm at the sediment-water interface and increase exponentially down to a pre-defined sediment depth. The model resolves in each layer both physical processes (e.g. pore-water diffusion or bioturbation) and chemical processes (e.g. redox transformations).
<center>
```{r SedOverview-1, echo=FALSE, fig.cap="Schematic of the main physical and chemical processes that cause chemical concentration and flux change in the sediment and across the sediment-water interface, and therefore are included in most sediment diagenesis models.", out.width = '85%'}
knitr::include_graphics("images/23-sediment_biogeochemistry/Boxes&Arrows/Overview-05.png")
```
</center>
Under some conditions, the sediment stores can release nutrients to the water column, while under other conditions, the sediment can remove nutrients, through burial over the long-term, and through processes such as denitrification in the surface layers. The fine balance that controls the conditions under which the sediment will store, release or remove nutrients is largely governed by the aerobic state of the sediment pore water, and the amount of reactive organic matter fuelling the reactions. The depth-resolved sediment model accounts for mixing from the hydrodynamic model into the upper sediment layers, and then calculates whether organic matter is consumed aerobically, through denitrification or, deeper down, through sulfate reduction or even methanogenesis.
Sediment early-diagenesis models are complex environmental reactive transport simulation tools. The meta-analysis by Paraska et al. (2014) discussed the history of their evolution to these complex configurations, in which the original models of Boudreau (1996), Van Cappellen and Wang (1996) and Soetaert et al. (1996) were taken up and applied in many contexts by new modellers, who added new features and extended their capabilities, or discarded old features as required. The meta-analysis also identified the major challenges associated with developing new sediment diagenesis models. Here, the AED modelling package for sediment biogeochemistry is presented, CANDI-AED, which is an extension of the Approach 1 models, but reengineered and augmented with new model approaches and capabilities as a way to address some of these challenges.
Paraska et al. (2015) outlined the significance and uncertainty associated with different parameterisation approaches of organic matter dynamics. In these cases, simulations were run to test the significance of different theoretical approaches and model structural assumptions, using an idealised model setup with only primary oxidation reactions and no physical processes or spatial resolution. The true impact of these different model approaches within a spatially-resolved model, accounting for all of the advection, diffusion and secondary reaction processes, however, is yet to be determined and it is unclear whether some formulations may suit some application contexts better than others. Therefore there is a need for a fully flexible model structure that can include these different organic matter breakdown parameterisations and allow users to assess critically the alternative approaches. In addition, other aspects related to secondary redox reactions, mineral reactions, precipitation and adsorption should similarly be subject to comparative assessments.
The model included in AED aimed to address challenges of building a generic and full-featured, open-source model code with the flexibility to do the following:
- set different kinetic rate equation approaches
- set different organic matter pools and breakdown processes
- use standard inhibition or thermodynamic limits on primary oxidation
- optionally use manganese, iron and iron sulphide reactions
- simulate adsorbed metals and nutrients
- simulate calcium, iron and manganese carbonates
- connect the boundary to either another model, a programmed file or a fixed concentration
Therefore the numerical model presented in this module has many optional features and alternative parameterisations for key processes, without mandating their inclusion in the calculations or enforcing a fixed model structure.
The sediment model CANDI-AED presented here is implemented as an optionally configurable module in the AED model library. Through the model coupling approach it may be applied with any of the hydrodynamic models linked to AED (e.g. GLM, Tuflow), or alternatively, options to run in isolation are also possible. This chapter provides a scientific description of the model and describes attributes of the model associated with its practical implementation and operation. A case-study of the model framework is also demonstrated.
The major output of CANDI-AED includes concentration depth profiles and fluxes across the sediment-water interface (figure \@ref(fig:SedOverview-2)).
<center>
```{r SedOverview-2, echo=FALSE, fig.cap="Examples of the final outputs after running CANDI-AED: concentration-depth profiles and flux-time plots.", out.width = '100%'}
knitr::include_graphics("images/23-sediment_biogeochemistry/Outputs/Overview-17.png")
```
</center>
## Model Description
### General description
The heart of this model is the reaction, diffusion, advection model of Berner (1980), which was implemented as the Carbon and Nutrient Diagenesis model of Boudreau (1996), later further developed as the C.CANDI code (Luff et al. 2000). The CANDI-AED implementation, however, has evolved from the original code, and includes extensions related to the treatment of organic matter, the simulation of the geochemical conditions known to influence the diagenetic equations, extensions for nutrients and trace metals, and dynamics at the sediment-water interface. However, the core organic matter breakdown equations (and their numerical solution) remains similar as the original descriptions presented in Boudreau (1996), and to other similar sediment models. An overview of the model is shown in Figure \@ref(fig:23-pic2).
<center>
```{r 23-pic2, echo=FALSE, fig.cap="Overview of the chemical processes in CANDI-AED: organic matter transformation and oxidation, and reduction/oxidation, crystallisation, adsorption and precipitation reactions of inorganic by-products. Most of the processes are triggered by the input of POM at the sediment-water interface.", out.width = '85%'}
knitr::include_graphics("images/23-sediment_biogeochemistry/Boxes&Arrows/FullCandi-02.png")
```
</center>
<br>
The model is based on the advection-dispersion reaction equation for the concentration of dissolved and particulate substances. For dissolved substances $C_d$, the balance equation is defined as:
<center>
```{=tex}
\begin{equation}
\frac{\phi \delta C_d}{\delta t} = \overbrace{ D_{B}\frac{\delta^{2} C_d}{\delta x^{2}} + \phi D_{S}\frac{\delta^{2} C_d}{\delta x^{2}} }^\text{biodiffusion and molecular diffusion} - \underbrace{u \frac{\delta C_d}{\delta x}}_\text{advection (flow)} + \overbrace{\alpha(C_{d_0}-C_d)}^\text{irrigation} + \underbrace{\phi \sum R_d}_\text{reactions} + \color{brown}{S}
(\#eq:sdg-1)
\end{equation}
```
</center>
where the left hand side (LHS) is the "unsteady" term ($C_d$ change in time), the first term on the right hand side (RHS) is the dispersion/mixing term, the second term on the RHS is the advection/movement term, and $R_d$ denotes a generic reaction term. An optional $S$ term is included to represent sources from other modules (e.g., seagrass root injection of $O_2$).
For particulate (solid) substances, $C_s$:
<center>
```{=tex}
\begin{equation}
\frac{(1-\phi)\rho \delta C_s}{\delta t} = \overbrace{ D_{B}\frac{\delta^{2}[(1-\phi)\rho C_s] }{\delta x^{2}} }^\text{biodiffusion} - \underbrace{\omega \frac{\delta [(1-\phi)\rho C_s]}{\delta x}}_\text{advection (sedimentation)} + \overbrace{(1-\phi) \sum R_s}^\text{reactions} + \color{brown}{S}
(\#eq:sdg-2)
\end{equation}
```
</center>
where $(1-\phi)$ denotes the solid fraction of the sediment, and $R_s$ is a generic reaction term.
The above equations are solved numerically for the simulated set of constituents. The user can define the variables that are included in the $\mathbf{SDG}$ module, such that $C_d$ and $C_s$, are the set of dissolved and particulate variables selected for simulation, respectively. Eight of the variables (compulsory variables) must be requested by the user in the variable setup file, or the model will not run (see the [variables summary](#VariableSummary) below). Three other compulsory variables are always simulated and the user does not need to request them. The other variables can be requested if the user desires them. A number of options are available for resolving the physical processes, including the rate of diffusion, advection, irrigation and the boundary condition options.
In addition to physical processes, the CANDI-AED model considers two types of chemical reactions - the slow, kinetically controlled reactions, and the fast thermodynamically based equilibrium reactions. The latter are simulated in the sediment through appropriate configuration of the [geochemistry reactions](#EquilibriumGeochemistry); the configuration of the equilibrium model will apply to both the water and each of the sediment layers. The kinetically controlled reactions are mostly microbially-mediated and include the reactions for [organic matter breakdown](#SedPrimaryRedoxReactions) and eventual oxidation, the [re-oxidation of various by-products](#SedSecondaryRedoxReactions) and the dynamics of the metal sulfides. These reactions can be complex and are outlined in further detail in the next sections.
### Process Descriptions
#### Sediment model domain
The sediment model is discretised into a user-definable number of depth layers (`maxnpts`) down to a pre-defined sediment depth(`xl`). The grid of layers is set to have either even spacing (`job` = 1) or to be exponentially increasing (`job` = 0), where the layers sizes have a thickness of a few mm at the sediment-water interface and which increase exponentially down into the sediment (figure \@ref(fig:Init-1)). When the spacing increases exponentially, the first two layers are hard-coded to be a miniumum of 0.25 cm, in order to avoid numerical instability from sharp concentration differences over distances that are too small.
This fixed depth of sediment has a concentration of all variables at all depth layers, and boundary conditions at the upper and lower ends of the domain.
```{r Init-1, echo=FALSE, fig.cap="Initialisation of the depth layers. The number of layers is set by `maxnpts` and the depth of the simulation by `xl`. The setup can have even spacing (left) using parameter `job` = 1 or increasing spacing (right) `job` = 2.",fig.show='hold',fig.align='center' ,out.width = '60%'}
knitr::include_graphics("images/23-sediment_biogeochemistry/Initialisation/job1job2-01.png")
```
#### Physical Transport
##### *Solids* {.unnumbered}
CANDI-AED adopts the approach of Boudreau (1996) to advection and dispersion, which is similar to most other diagenesis models. Advection of the solid sediment matrix is occurs at the rate of sediment deposition ($\omega_{00}$ in cm y^-1^). The sediment does not move, however, since the height of the modelling domain is fixed, as more sediment accumulates at the surface, a sediment particle moves downwards. An alternative way to view this is that the modelling domain moves upwards.
```{r Phys1, echo = FALSE, out.width='60%', class = "text-image",fig.show='hold',fig.align='center', fig.cap = "Upon sedimentation, the frame of reference shifts upwards. The bottom area is effectively lost from the modelling domain over time. Particles and porewater are advected downward relative to the modelling domain."}
knitr::include_graphics("images/23-sediment_biogeochemistry/AdvectionDispersion/AdvectionDispersion-05.png")
```
##### *Porewater* {.unnumbered}
For the porewater components, diffusion coefficients are used that are based on free-solution molecular diffusion constants corrected for sediment tortuosity, $θ$. Porewater moves downwards at the same rate as the solids ($\omega_{00}$). A further porewater advection term (`poreflux`) is available, which could represent, for example, pressure on the sediment from a groundwater source. If `poreflux` is positive, then porewater moves upwards, relative to particles. Conversely, if `poreflux` is negative, then the porewater moves downwards relative to the particles. In most simulations, `poreflux` is zero and advection is the transport process. A dynamic `poreflux` can be assigned using the column headings `w00h00` in [swibc.dat](#DynamicOptionsSwibcFile) or `pf` in [deepbc.dat](#DynamicOptionsDeepbcFile) (see setup section below).
```{r Phys2, echo = FALSE, out.width='100%', class = "text-image",fig.show='hold',fig.align='center', fig.cap = "Porewater is advected at the same rate as burial. If `poreflux` is non-zero, an additional rate of advection is applied to porewater. The direction is upwards when `poreflux` is positive, downwards when *poreflux* is negative."}
knitr::include_graphics("images/23-sediment_biogeochemistry/AdvectionDispersion/Poreflux-04.png")
```
Diffusion of solutes is calculated using a diffusivity constant. One default value, which is temperature-dependent, is used for most dissolved variables (table \@ref(tab:Diff-table)). This value is based on the diffusivity of chloride. Twelve other variables have their own values, which are also temperature-dependent. Some also use the function *a*, which can also include salinity and pressure (table \@ref(tab:Diff-table)).
<center>
```{r Diff-table, echo=FALSE, message=FALSE, warning=FALSE}
library(knitr)
library(kableExtra)
library(readxl)
options(knitr.kable.NA = "")
Diff_tab <- read_xlsx("tables/23-sediment_biogeochemistry/UserManual.xlsx", sheet="Diffcoef2")
kable(Diff_tab[,1:2],"html", escape = F, align = "c"
, caption = "Temperature-dependent calculations for diffusivity constants. All state variables in CANDI-AED use the default value, unless specified in this table. The function *a* is a further correction for salinity and pressure.",bootstrap_options = "hover")%>%
kable_styling(Diff_tab, bootstrap_options = "hover",
full_width = T, position = "left",
font_size = 12) %>%
row_spec(0, background = "#14759e", bold = TRUE, color = "white") %>%
column_spec(1, width_min = "20em" ,color="black",bold = F) %>%
column_spec(2, width_min = "20em" ,color="black") %>%
# column_spec(3, width_min = "15em" ,color="black") %>%
# row_spec(1:2, background = 'white') %>%
scroll_box(width = "40em", height = "20em",fixed_thead = FALSE)
```
</center>
##### *Porosity* {.unnumbered}
Porosity ($\phi$) is defined as the amount of water per total volume of space, as a real number between 0 and 1. A value for porosity is set at each depth layer during initialisation (see [initialisation section](#SedInitialisation) below) and remains constant throughout the simulation (Figure \@ref(fig:Phys-6)). The porosity array is used in the model to calculate other variables, such as
- advection
- poreflux
- porewater volume
- solid volume
- diffusive velocity
- solid fraction
Porosity is also used in the model to calculate $ps$, $psp$ and $pps$, which are used to convert between solid and dissolved state variables, using these conversions:
```{=tex}
\begin{eqnarray}
ps = 1 - \phi
\\
(\#eq:poros-1)
\\
psp = \frac {ps} {\phi}
\\
(\#eq:poros-2)
\\
pps = \frac {\phi} {ps}
(\#eq:poros-3)
\end{eqnarray}
```
Porosity is configured by setting three parameters: the porosity at the sediment-water interface (`p0`), the porosity at the depth where compaction causes constant porosity with depth (`p00`), and the attenuation coefficient on the exponential curve (`bp`) (equation \@ref(eq:init-1)). These parameters are set separately for each zone in `aed_candi_params.csv`. Porosity is the amount of water per total volume of space, as a real number between 0 and 1.
```{=tex}
\begin{eqnarray}
\phi = (\rho _0 - \rho _{00}) \times e^{-bp \times depth} + \rho _{00}
(\#eq:init-1)
\end{eqnarray}
```
<br>
```{r Phys-6, echo=FALSE, fig.cap="Example depth profile of porosity.",fig.show='hold',fig.align='center' ,out.width = '60%'}
knitr::include_graphics("images/23-sediment_biogeochemistry/Initialisation/Porosity-01.png")
```
\
Porosity and bioirrigation profiles are output in the file `Depths.sed`, along with the depths (in cm), and so the user can examine the shapes of the profiles with depth.
#### Primary Redox Reactions {#SedPrimaryRedoxReactions}
The key chemical process that causes ongoing change in the sediment is the breakdown of organic matter. Organic matter supplies fuel, above all, reduced carbon, to microorganisms living in the sediment.
##### *Organic matter pools and reactivity* {.unnumbered}
Organic matter ($OM$) degradation pathways can include labile and refractory components, and the breakdown pathways simulated are summarized conceptually in Figure \@ref(fig:OMModels). Reactions included in the kinetic component include the hydrolysis of the complex (e.g., high molecular weight) $OM$ pools ($POM_{VR}$, $POM_R$, $DOM_R$, $POM_L$) and transformation of low molecular weight (LMW) $DOM_L$ by oxidants ($O_2$, $NO_3^-$, $MnO_2$, $Fe(III)$ and $SO_4^{2-}$ - the so-called ['terminal metabolism'](#SedTheRedoxSequence) pathway), and the release of resulting nutrients ($NH_4^+$, $PO_4^{3-}$) and reduced by-products ($Mn^{2+}$, $Fe^{2+}$, $N_2$, $H_2S$, $CH_4$) and $CO_2$. Oxidants, nutrients and by-products are all capable of interacting, for example, through re-oxidation of reduced species (outlined in the [secondary redox section](#SedSecondaryRedoxReactions) below).
The user can decide how complex or simple the organic matter breakdown pathway should be, with three options of varying complexity for parameterising the pathways included (Figure \@ref(fig:OMModels)). The first option (`OMModel` = 1) is a common multi-G model in which the $POM$ phases are decomposed straight to $CO_2$ and other breakdown products. Here $POM$ is a variable that is not precisely defined, and its components (such as C, N and P) are assigned by parameters based on a user-defined stoichiometry. `OMModel` 1 has a switch `VCW` (logical) that replaces the kinetic rate constants for $POM$ with a depth-dependent breakdown rate, as used by Van Cappellen and Wang (1996).
The second option (`OMModel` = 2) is another '2G' model with both particulate and dissolved organic matter ($POM$ and $DOM$) phases included and parameterisation hydrolysis of $POM$ to $DOM$, and then $DOM$ to $CO_2$ and other breakdown products. The $POM$ and $DOM$ phases consist of three variables each, which trace the reaction and transport of carbon, nitrogen and phosphorus, thereby allowing for variable stoichiometry of organic matter to occur temporally and spatially.
The third option (`OMModel` = 3) has many $POM$ phases, which are all hydrolysed to $DOM$, which then undergoes fermentation and terminal metabolism. This allows the carbon, nitrogen and phosphorus to be calculated precisely before and after a model run, and allows the free energies of the reaction of each phase to be included. This third option is the most detailed and mechanistic, and allows for expansion of more detailed reaction mechanisms to be included, but is recommended only for experienced users.
CANDI-AED also contains options for very unreactive organic matter parameter. The model can decrease the reactivity of the particulate refractory phase towards zero as the concentration approaches a minimum. For example, for $POC_R$, the parameter `pocu` sets the minimum concentration and `KOMPres_C` sets the sensitivity of the decrease, as in equation \@ref(eq:pomr-1) below. The equivalent parameters for N an P are `ponu` and `popu`, and `KOMPres_N` and `KOMPres_P`.
```{=tex}
\begin{eqnarray}
komlim = \frac {PON_R - ponu} {PON_R - ponu + KOMPres_N}
\\
\\
R_{PONR} = (ponr2donr) (komlim)
(\#eq:pomr-1)
\end{eqnarray}
```
(The equation above is a simplified version, where the full equation had checks to prevent the rate going below zero, plus the respiration processes of $MPB$.)
```{r OMModels, echo=FALSE, fig.cap="Three options for different levels of complexity in organic matter breakdown, by setting the `OMModel` switch. Top left – Model in which $POM$ breaks down directly to $CO_2$ and other waste products. Top right - Model with the breakdown rate set by depth. Bottom left – Model in which POM is first hydrolysed to $DOM$ and then oxidised to $CO_2$. Bottom right – Model in which $POM$ is hydrolysed to $DOM$, which can then be fermented and oxidised.", fig.show="hold", out.width="75%" ,fig.align='center'}
knitr::include_graphics("images/23-sediment_biogeochemistry/Boxes&Arrows/OMModel-06.png")
```
<br>
<center>
```{r OMModel-table, echo=FALSE, message=FALSE, warning=FALSE}
library(knitr)
library(kableExtra)
library(readxl)
options(knitr.kable.NA = "")
OMModel_tab <- read_xlsx("tables/23-sediment_biogeochemistry/UserManual.xlsx", sheet="OMModel")
# View(sediment_VarsTable)
OMModel_Groups <- unique(OMModel_tab$Group)
kable(OMModel_tab[,1:3],"html", escape = F, align = "c"
, caption = "Organic matter breakdown processes. The index *i* in *∑ R~Oxi~* refers to the sequence of *TEA* in table [](@ref(tab:OMChem-table)). For `OMModel` 2, $POM$ and $DOM$ are each three state variables of $POC$, $PON$ and $POP$, and $DOC$, $DON$ and $DOP$.",bootstrap_options = "hover")%>%
pack_rows(OMModel_Groups[1],
min(which(OMModel_tab$Group == OMModel_Groups[1])),
max(which(OMModel_tab$Group == OMModel_Groups[1])),
background = '#ebebeb'
,color="black") %>%
pack_rows(OMModel_Groups[2],
min(which(OMModel_tab$Group == OMModel_Groups[2])),
max(which(OMModel_tab$Group == OMModel_Groups[2])),
background = '#ebebeb'
,color="black") %>%
pack_rows(OMModel_Groups[3],
min(which(OMModel_tab$Group == OMModel_Groups[3])),
max(which(OMModel_tab$Group == OMModel_Groups[3])),
background = '#ebebeb'
,color="black") %>%
pack_rows(OMModel_Groups[4],
min(which(OMModel_tab$Group == OMModel_Groups[4])),
max(which(OMModel_tab$Group == OMModel_Groups[4])),
background = '#ebebeb'
,color="black") %>%
kable_styling(OMModel_tab, bootstrap_options = "hover",
full_width = T, position = "left",
font_size = 11) %>%
row_spec(0, background = "#14759e", bold = TRUE, color = "white") %>%
column_spec(1, width_min = "18em" ,color="black",bold = F) %>%
column_spec(2, width_min = "18em" ,color="black") %>%
column_spec(3, width_min = "18em" ,color="black") %>%
# column_spec(4, width_min = "15em") %>%
row_spec(1:4, background = 'white') %>%
scroll_box(width = "770px", height = "28em",fixed_thead = FALSE)
```
</center>
##### *C:N:P partitioning* {.unnumbered}
The C:N:P stoichiometry is set differently for each `OMModel`.
Using `OMModel` = 1, the ratios are set separately for the labile and refractory phases, using the *x*, *y* and *z* ratios outlined in table \@ref(tab:OMChem-table). For example, `xlab` is the carbon fraction of $POM_L$, which is usually set to around 106, while `zlab` is the $POM_L$ phosphorus fraction, which is usually set to around 1. These ratios are fixed throughout the simulation. The *x*, *y* and *z* coefficients are used to set the proportions of the other species in the redox equation (such as oxidants and reduction products), the acid-base products (such as $HCO_3^-$ and $CO_2$) and the amounts of free $NH_4^+$ and $PO_4^{3-}$ released from organic matter degradation oxidation.
The *x*, *y* and *z* ratios in table \@ref(tab:OMChem-table) are written in the standard form of the equations in the sediment model literature. The carbon in the organic matter is assumed to be carbon (0) and each carbon atom requires four electrons from the oxidant to form the carbon (IV) in $CO_2$, and therefore *x* carbons require 4*x* electrons. In practice, the model code performs reactions per carbon, and so all of these coefficients are divided by *x*, for all reactants and products. This is done in order to make the reactions `OMModel` 1 equivalent to `OMModel` 2.
Using `OMModel` = 2, the C:N:P ratio is set by the concentrations of separate organic species, such as $POC_L$, $PON_L$ and $POP_L$, as opposed to the $POM$ phases of `OMModel` 1. The ratio is fixed by the boundary and initial conditions, however, if the boundary is dynamic, then the ratio can change through the course of the simulation. Only $DOC_L$ participates in the redox reactions, and so the equivalent of *CH~2~O* in table \@ref(tab:OMChem-table) is $DOC_L$. The release of organic N as free $NH_4^+^$ is calculated $PON_L$ oxidation at `ponl2dic` and the release of organic P as free $PO_4^{3-}$ as $POP_L$ at `popl2dic`.
Using `OMModel` = 3 is similar to `OMModel` = 1. The ratios are applied to $POM_1$, $POM_2$ etc. as `xPOM1`, `yPOM2` etc.
##### *The redox sequence* {#SedTheRedoxSequence .unnumbered}
The terminal redox reaction pathways are the six major pathways that are available in most diagenesis models, and are driven by different organic matter pools, depending on the `OMModel` configuration chosen from the above options. CANDI-AED allows the use of Approach 1 or 2 organic matter oxidation rate equations, as examined in detail in Paraska et al. (2015), and also explained below. The six major pathways are:
- Aerobic
- Denitrifying
- Manganese reduction
- Iron reduction
- Sulfate reduction
- Methanogenesis
The decay of the complex $OM$ types to the LMW $DOM$ required for the heterotrophic bacteria to utilise are all modelled with a simple first-order decay rate. The subsequent reactions for terminal metabolism that describe the breakdown of $OM$ to $CO_2$ and other breakdown products are described in table \@ref(tab:OMChem-table).
CANDI-AED uses a more detailed set of reactions for the denitrifying process, which are described in the [Nitrogen cycling](#SedNitrogenCycling) section below. The chemical equations may be written as in table \@ref(tab:OMChem-table) and the reaction rates for each of these are calculated dynamically based on Monod expressions which mediate the reaction rate according to the concentration of potential oxidants higher in the redox sequence, and the concentration of the available oxidant.\@ref(fig:dev-Grid1)
<br>
<center>
```{r OMChem-table, echo=FALSE, message=FALSE, warning=FALSE}
library(knitr)
library(kableExtra)
library(readxl)
options(knitr.kable.NA = "")
OMChem_tab <- read_xlsx("tables/23-sediment_biogeochemistry/UserManual.xlsx", sheet="OMChem3")
# View(sediment_VarsTable)
OMChem_Groups <- unique(OMChem_tab$Group)
kable(OMChem_tab[,1:3],"html", escape = F, align = "c"
, caption = "Primary terminal redox reactions. x, y and z are stoichiometric coefficients.",bootstrap_options = "hover")%>%
#
# pack_rows(OMChem_Groups[1],
# min(which(OMModel_tab$Group == OMModel_Groups[1])),
# max(which(OMModel_tab$Group == OMModel_Groups[1])),
# background = '#ebebeb'
# ,color="black") %>%
# pack_rows(OMChem_Groups[2],
# min(which(OMModel_tab$Group == OMModel_Groups[2])),
# max(which(OMModel_tab$Group == OMModel_Groups[2])),
# background = '#ebebeb'
# ,color="black") %>%
# pack_rows(OMChem_Groups[3],
# min(which(OMModel_tab$Group == OMModel_Groups[3])),
# max(which(OMModel_tab$Group == OMModel_Groups[3])),
# background = '#ebebeb'
# ,color="black") %>%
# pack_rows(OMChem_Groups[4],
# min(which(OMModel_tab$Group == OMModel_Groups[4])),
# max(which(OMModel_tab$Group == OMModel_Groups[4])),
# background = '#ebebeb'
# ,color="black") %>%
kable_styling(OMChem_tab, bootstrap_options = "hover",
full_width = T, position = "left",
font_size = 11) %>%
row_spec(0, background = "#14759e", bold = TRUE, color = "white") %>%
column_spec(1, width_min = "10em" ,color="black",bold = T) %>%
column_spec(2, width_min = "2em" ,color="black") %>%
column_spec(3, width_min = "15em" ,color="black") %>%
# column_spec(4, width_min = "15em") %>%
row_spec(1:4, background = 'white') %>%
scroll_box(width = "770px", height = "40em",fixed_thead = FALSE)
```
</center>
<br>
<br>
<!-- \begin{eqnarray} -->
<!-- \\ -->
<!-- N2O breakdown -->
<!-- \\ -->
<!-- (\#eq:primary-0) -->
<!-- \\ -->
<!-- \overbrace{(CH_2O)_{106}(NH_3)_{16}(H_3PO_4)}^{\textrm{organic matter}} &+& 138O_2 \rightarrow \nonumber -->
<!-- \\ -->
<!-- && 106CO_2 + 16HNO_3 + H_3PO_4 + 122H_2O -->
<!-- \\ -->
<!-- \textrm{Free energy, } \Delta G_0 &=& -3190\:kJmol^{-1} \nonumber -->
<!-- \\ -->
<!-- (\#eq:primary-1) -->
<!-- \\ -->
<!-- \end{eqnarray} -->
<!-- \begin{eqnarray} -->
<!-- (CH_2O)_{106}(NH_3)_{16}(H_3PO_4) &+& 236MnO_2 +472H^+ \rightarrow \nonumber -->
<!-- \\ -->
<!-- && 106CO_2 + 236Mn^{2+} + 8N_2 + H_3PO_4 + 366H_2O -->
<!-- \\ -->
<!-- \textrm{Free energy, } \Delta G_0 &=& -3050\:kJmol^{-1} \nonumber -->
<!-- \\ -->
<!-- (\#eq:primary-2) -->
<!-- \\ -->
<!-- (CH_2O)_{106}(NH_3)_{16}(H_3PO_4) &+& 94.4HNO_3 \rightarrow \nonumber -->
<!-- \\ -->
<!-- && 106CO_2 + 55.5N_2 + H_3PO_4 + 177H_2O -->
<!-- \\ -->
<!-- \textrm{Free energy, } \Delta G_0 &=& -3030\:kJmol^{-1} \nonumber -->
<!-- \\ -->
<!-- (\#eq:primary-3) -->
<!-- \\ -->
<!-- (CH_2O)_{106}(NH_3)_{16}(H_3PO_4) &+& 212Fe_2O_3 +848H^+ \rightarrow \nonumber -->
<!-- \\ -->
<!-- && 106CO_2 + 16NH_3 + H_3PO_4 + 742H_2O + 424Fe^{2+} -->
<!-- \\ -->
<!-- \textrm{Free energy, } \Delta G_0 &=& -1410\:kJmol^{-1} \nonumber -->
<!-- \\ -->
<!-- (\#eq:primary-4) -->
<!-- \\ -->
<!-- (CH_2O)_{106}(NH_3)_{16}(H_3PO_4) &+& 53SO_4^{2-} \rightarrow \nonumber -->
<!-- \\ -->
<!-- && 106CO_2 + 16NH_3 + H_3PO_4 + 106H_2O + 53S^{2-} -->
<!-- \\ -->
<!-- \textrm{Free energy, } \Delta G_0 &=& -380\:kJmol^{-1} \nonumber -->
<!-- \\ -->
<!-- (\#eq:primary-5) -->
<!-- \\ -->
<!-- (CH_2O)_{106}(NH_3)_{16}(H_3PO_4) && \rightarrow \nonumber -->
<!-- \\ -->
<!-- && 53CO_2 + 53CH_4 + 16NH_3 + H_3PO_4 -->
<!-- \\ -->
<!-- \textrm{Free energy, } \Delta G_0 &=& -350\:kJmol^{-1} \nonumber -->
<!-- (\#eq:primary-6) -->
<!-- \end{eqnarray} -->
The kinetic rate constant *k~OM~* gives the maximum oxidation rate, which is different for each reactive organic matter type, but the same for each oxidation pathway.
When using `OMModel` 3, the kinetic rate constant is the rate of bacterial growth. The rates are calculated as the product of the rate constant, the concentration and a series of limitation and inhibition factors that scale between 0 and 1.
##### *Limitation and inhibition factors* {.unnumbered}
A common feature of all diagenesis models is that the oxidation rate expression $R_{Ox}$ is a product of up to seven terms:
- an organic matter reaction rate constant *k~OM~*
- the organic matter concentration limitation, $F_{OM}$
- a temperature dependence $F_{Tem}$
- a microbial biomass factor, $F_{Bio}$
- a term limitation factor, $F_{TEA}$
- an inhibition term, $F_{IN}$ and
- a thermodynamic factor, $F_{T}$
- a thermodynamic factor, $F_{an}$
<center>
```{=tex}
\begin{equation}
R_{Ox_{i}} = k_{OM}F_{OM}F_{Tem}F_{Bio}F_{TEA{i}}F_{In_{i}}F_{T}F_{an}
\\
(\#eq:factors-1)
\end{equation}
```
</center>
In CANDI-AED, organic matter limitation, $F_{OM}$, is only used with `OMModel` 3. It takes the general form
<center>
```{=tex}
\begin{equation}
F_{OM_{i}} = \frac{OM_{i}} {(OM_{i} + K_{OM})}
\\
(\#eq:factors-2)
\end{equation}
```
</center>
where $OM_i$ is an organic matter species, such as $D_{Hyd}$ or $OAc$ and *K~OM~* is a limiting concentration. This functions like other Monod terms, limiting the reaction rate when the concentration of $OM_{i}$ is low. Using `OMModel` 1 or 2 (the common and simplest options), $F_{OM}$ is effectively 1 and it is assumed that organic matter concentration never limits the reaction rate.
The temperature factor $F_{Tem}$ is rarely employed in diagenesis models, but in a handful of cases it uses a Q~10~ relationship between 2 and 4 (see Fossing et al. 2004 for a clear explanation of how temperature affects reaction rates and Eldridge and Morse (2008) or Reed et al. (2011) for a specific examination of the effect of temperature). The current version of the model has switches built in for the temperature dependence factor, $F_{Tem}$, where values of 1 or 2 turn them off and on. However, implementation and testing of the factors has not been carried out for this version of the model.
The *TEA* factor, $F_{TEA}$, term accounts for the $R_{Ox}$ dependence on the oxidant concentration when the oxidant concentration is low. The $F_{TEA}$ term in Approach 1 is a Monod expression (table \@ref(tab:OMApproach-table), figure \@ref(fig:OMModels-2)), which uses Monod half-saturation constants (*K~Ox~*), and which is chosen because it best reflects laboratory data of bacterially-controlled oxidation reactions (Boudreau and Westrich, 1984, Gaillard and Rabouille 1992). In Approach 2, the $F_{TEA}$ is either 0, 1 or the ratio of *Ox~i~* to *L~Ox~*, depending on the oxidant concentration relative to *L~Ox~*, a specified limiting concentration (table \@ref(tab:OMApproach-table)). We use the notation *K~Ox~* and *L~Ox~* to emphasise that a distinction should be made between the Monod half constants in Approach 1 and the limiting concentrations used in Approach 2; the difference in conceptual representation is not always clear in Approach 2 papers that use the notation *K~Ox~*. We recommend that the user set the parameter `OMModel` to 1, unless they specifically need to emulate an Approach 2 model, such as that by Van Cappellen and Wang (1996).
<center>
```{r OMApproach-table, echo=FALSE, message=FALSE, warning=FALSE}
library(knitr)
library(kableExtra)
library(readxl)
options(knitr.kable.NA = "")
OMApproach_tab <- read_xlsx("tables/23-sediment_biogeochemistry/UserManual.xlsx", sheet="OMApproach")
kable(OMApproach_tab[,1:3],"html", escape = F, align = "c"
, caption = "Limitation and inhibition equations for the two different approaches (`OMApproach`).",bootstrap_options = "hover")%>%
kable_styling(OMApproach_tab, bootstrap_options = "hover",
full_width = T, position = "left",
font_size = 12) %>%
row_spec(0, background = "#14759e", bold = TRUE, color = "white") %>%
column_spec(1, width_min = "10em" ,color="black",bold = F) %>%
column_spec(2, width_min = "15em" ,color="black") %>%
column_spec(3, width_min = "15em" ,color="black") %>%
# row_spec(1:2, background = 'white') %>%
scroll_box(width = "40em", height = "17em",fixed_thead = FALSE)
```
</center>
<br>
<center>
```{r OMModels-2, echo=FALSE, fig.cap="Schematic of examples of how inhibition and limitation scale between 0 and 1 over a range of concentrations. Left: limitation function. Right: inhibtion function.", fig.show="hold", out.width="85%" ,fig.align='center'}
knitr::include_graphics("images/23-sediment_biogeochemistry/OMSetup/FTEAFIn-02.png")
```
</center>
$F_T$ is the thermodynamic factor. The current version of the model includes $F_T$ only for `OMModel` 3, for terminal oxidation reactions and fermentation. This factor uses the ratio of products and reactants, as well as the free energy of each reaction pathway ($\Delta G^0$).
The $F_T$ is a factor that scales between 0, which stops the reaction, and 1, which allows the reaction to proceed, in the same way as $F_{TEA}$ and $F_{In}$. The form of the equation proposed by Jin and Bethke is that shown in equation \@ref(eq:factors-3).The *m* and *χ* are stoichiometric coefficients, *ΔG~ATP~* is the energy required to synthesise one mole of ATP, *R* is the gas constant and *T* is the temperature. In the case where the $F_T$ \< 0 then the factor is set to 0 by convention, otherwise a negative FT would represent the case where microbes carried out a reaction that was unfavourable to their metabolism.
<center>
```{=tex}
\begin{equation}
F_T = 1 - e^{\frac {∆G_r + m ∆G_{ATP}} {χR} }
(\#eq:factors-3)
\end{equation}
```
</center>
\
*ΔG~r~* is the changing free energy in the system, which controls whether the $F_T$ becomes favourable or not as the environment changes, and is calculated according to the simplified version in equation \@ref(eq:factors-4) (see Jin and Bethke 2005 for a more precise definition):
<center>
```{=tex}
\begin{equation}
∆G_r = ∆G^0 + RT ln ( \frac {[redox \ products]^{molar \ ratios} } { [redox \ reactants]^{molar \ ratios} } )
\\
(\#eq:factors-4)
\end{equation}
```
</center>
where *ΔG~0~* is the standard state free energy of a redox reaction, calculated as the sum of the energy of the reduction of a *TEA* and the oxidation of an organic substrate. These energies are well constrained by laboratory data, though there may be differences between laboratory and field conditions that create some uncertainty in their use (Bethke et al. 2011). Practically, this equation allows for *ΔG~r~* to be very close to *∆G~0~* when the reactants are at high concentrations relative to the products. Inversely, when the products are at relatively high concentrations, *ΔG~r~* becomes more positive, making $F_T$ more negative. Equation \@ref(eq:factors-3) requires the constants *m* and *χ*, which are parameters that could be measured empirically, however as yet they have not all been measured for every redox pathway for every substrate, and therefore authors have had to estimate some values when using equation \@ref(eq:factors-3) (Dale et al. 2008). It also requires *ΔG~ATP~*, which is around 45 kJ (mol substrate)^-1^ but has varied published values. Around neutral *pH* the conditions for fermentation product consumption by iron reducers, sulphate reducers and methanogens are all thermodynamically favourable, but this changes with *pH* (Bethke et al. 2011). Acidity either promotes or hinders the reaction depending on whether the protons are produced or consumed in the reaction.
$F_{an}$ is a factor that slows down sulfate reduction and methanogenesis. As stated above, the kinetic rate constant *k~OM~* is the same for all redox pathways. The higher-energy pathways are designed to inhibit the lower-energy pathways, but not to occur faster, which is consistent with most other diagenesis models. However, there is an option to slow sulfate reduction and methanogenesis if the user desires. The parameter `f_an` can be set between 0 and 1 to make the $F_{an}$ factor more or less sensitive. Any value greater than 1 makes the factor ineffective (equation \@ref(eq:#factors-4)). The $F_{an}$ factor is calculated as the fraction of $F_{Sul}$ and $F_{Met}$ over the sum of all of the other pathways.
```{=tex}
\begin{equation}
For \ \ R_{O_{2}},\ \ R_{NO_{3}},\ \ R_{MnO_{2}}, \ \ and \ \ R_{FeOH} \
\\
\\
F_{an (factor)} = 1
\\
\\
For \ \ R_{SO_{4}} \ \ and \ \ R_{Met} \
\\
\\
F_{an (factor)} =\left\{
\begin{array}{@{}ll@{}}
1, & f_{an (parameter)} \: \ge \: 1 \\
\frac {F_{SO_{4}} + F_{Met}}{f_{an (parameter)} + F_{O_{2}} + F_{NO_{3}} + F_{MnO_{2}} + F_{FeOH} + F_{SO_{4}} + F_{Met}}, & f_{an (parameter)} \lt 1\\
\end{array}\right.
(#eq:factors-4)
\end{equation}
```
##### *Nitrogen cycling* {#SedNitrogenCycling .unnumbered}
The redox sequence in CANDI-AED is slightly different to the sequence in other diagenesis models: here the nitrogen redox reactions are split into several processes. Most diagenesis models have an overall reaction of $NO_3^-$ oxidising organic matter and producing $N_2$, as shown in figure \@ref(fig:NModel-1). This reaction is less favourable than aerobic oxidation and it is inhibited by $O_2$.
<center>
```{r NModel-1, echo=FALSE, fig.cap="Schematic of the basic nitrogen-organic matter redox process from most other diagenesis models.", fig.show="hold", out.width="35%" ,fig.align='center'}
knitr::include_graphics("images/23-sediment_biogeochemistry/OMSetup/NModel1.png")
```
</center>
In CANDI-AED, there are separate nitrogen reactions for oxidising organic matter:
- **Denitrousation**: $N_2O$ reduction to $N_2$\
- **Denitratation**: $NO_3^-$ reduction to $NO_2^-$\
- **Denitritation**: $NO_2^-$ reduction\
- **Nitrous denitritation**: $NO_2^-$ reduction to $N_2O$\
- **DNRA**: (Dissimilatory nitrate reduction to ammonia) $NO_2^-$ reduction to $NH_4^+$
These reactions interact as shown in figure \@ref(fig:NModel-2). In CANDI-AED, the denitrousation reaction is configured to be more favourable than aerobic oxidation, based on the free energy data reported in Lam and Kuypers (2011). Therefore $N_2O$ inhibits aerobic respiration and all lower-energy pathways. Denitratation and all other reactions are less favourable than aerobic oxidation. Denitritation is the term used for the oxidation of $NO_2^-$, the products of which are produced through either nitrous denitritation (to $N_2O$) or DNRA (to $NH_4^+$), depending on the abundance of $NO_2^-$.The rate equations are as shown in table \@ref(tab:NRate-table).
<center>
```{r NModel-2, echo=FALSE, fig.cap="Schematic of the nitrogen-organic matter redox processes used in the CANDI-AED model.", fig.show="hold", out.width="85%" ,fig.align='center'}
knitr::include_graphics("images/23-sediment_biogeochemistry/OMSetup/NModel2.png")
```
<br>
```{r NRate-table, echo=FALSE, message=FALSE, warning=FALSE}
library(knitr)
library(kableExtra)
library(readxl)
options(knitr.kable.NA = "")
NRates_tab <- read_xlsx("tables/23-sediment_biogeochemistry/UserManual.xlsx", sheet="NRates")
kable(NRates_tab[,1:2],"html", escape = F, align = "c"
, caption = "Rate equations for organic matter oxidation by nitrogen.",bootstrap_options = "hover")%>%
kable_styling(NRates_tab, bootstrap_options = "hover",
full_width = T, position = "left",
font_size = 12) %>%
row_spec(0, background = "#14759e", bold = TRUE, color = "white") %>%
column_spec(1, width_min = "10em" ,color="black",bold = F) %>%
column_spec(2, width_min = "25em" ,color="black") %>%
# column_spec(3, width_min = "15em" ,color="black") %>%
row_spec(1:5, background = 'white') %>%
scroll_box(width = "44em", height = "37em",fixed_thead = FALSE)
```
</center>
Along with the nitrogen--organic matter redox reactions, there are sets of nitrogen oxidation reactions, where the oxidant is $O_2$ or $NO_2^-$. These are outlined in more detail in the AED inorganic nitrogen chapter.
##### *Calculation of the primary reactions* {#SedCalculationofthePrimaryReactions .unnumbered}
The chemical reactions in table \@ref(tab:OMChem-table) represent the overall process, however, the model code does not contain them in that form. A description of the numerical solution is presented below in the section [Numerical solution](#SedNumericalSolution) and a summary of the process as it pertains to primary reactions is given here. The model code contains:
**The 'Reaction' function**: the balance of each reaction rate for each species.
**The 'Rates' function**: the reaction rates, as the product of
- the species,
- the kinetic constants,
- the stoichiometric coefficients and
- the factors.
<center>
```{r OMCalcs-1, echo=FALSE, fig.cap="An illustration of one example of how the reaction rates are calculated in the model code. The balance equation is calculated as the gains and losses from the individual rates, and the rates are calculated from constants or other variables.", fig.show="hold", out.width="100%" ,fig.align='center'}
knitr::include_graphics("images/23-sediment_biogeochemistry/OMSetup/EquationStructure-02.png")
```
</center>
#### Secondary Redox Reactions {#SedSecondaryRedoxReactions}
The reactions of chemical species produced by the primary redox reactions (\@ref(tab:SecondChem-table)) are referred to as secondary redox reactions, and are usually given bimolecular rate laws, which are first order with respect to the oxidant and reductant (\@ref(tab:SecondChem-table)). The rates are controlled by a kinetic constant with units (mmol L)\^-1 y\^-1.
<center>
```{r SecondChem-table, echo=FALSE, message=FALSE, warning=FALSE}
library(knitr)
library(kableExtra)
library(readxl)
options(knitr.kable.NA = "")
SecondChem_tab <- read_xlsx("tables/23-sediment_biogeochemistry/UserManual.xlsx", sheet="SecondChem (3)")
kable(SecondChem_tab[,1:5],"html", escape = F, align = "c"
, caption = "Chemical reactions for secondary redox reactions.",bootstrap_options = "hover")%>%
kable_styling(SecondChem_tab, bootstrap_options = "hover",
full_width = T, position = "left",
font_size = 11) %>%
row_spec(0, background = "#14759e", bold = TRUE, color = "white") %>%
column_spec(1, width_min = "15em" ,color="black",bold = T) %>%
column_spec(2, width_min = "3em" ,color="black") %>%
column_spec(3, width_min = "12em" ,color="black") %>%
column_spec(4, width_min = "3em" ,color="black") %>%
column_spec(5, width_min = "12em" ,color="black") %>%
row_spec(1:5, background = 'white') %>%
scroll_box(width = "770px", height = "45em",fixed_thead = FALSE)
```
</center>
##### *Calculation of the secondary reactions* {#SedCalculationoftheSecondaryReactions .unnumbered}
As with the [primary reactions](SedCalculationofthePrimaryReactions), the secondary redox reactions are present in the code as the combination of
**The 'Reaction' function**: the sum of the rates of change of each species.
**The 'Rates' function**: the reaction rates, as the product of
- the species,
- the kinetic constants,
- the stoichiometric coefficients and
- the factors.
<center>
```{r OMCalcs-2, echo=FALSE, fig.cap="An illustration of one example of how the reaction rates are calculated in the model code. The balance equation is calculated as the gains and losses from the individual rates, and the rates are calculated from constants or other variables.", fig.show="hold", out.width="100%" ,fig.align='center'}
knitr::include_graphics("images/23-sediment_biogeochemistry/OMSetup/EquationStructure-03.png")
```
</center>
#### Equilibrium Geochemistry {#EquilibriumGeochemistry}
##### *pH* {.unnumbered}
The *pH* is initialised at a fixed value of around 8, which the user does not control. Setting the parameter `rxn_mode` to 0 or 4 keeps the *pH* constant throughout the simulation. Setting `rxn_mode` to 1, 2 or 3 updates the *pH* calculation at each time step. The *pH* is calculated as the sum of all charged species, where any unbalanced charge is calculated as 'charge balance' ($ubalchg$), which is assumed to be H^+^. The charge balance is at each time step is solved as a state variable, which is subject to advection, diffusion and bioturbation reactions.
The *pH* is used in the calculation of $PO_4^{3-}$ adsorption if the parameter `ads_use_pH` is set to `TRUE`.
*pH* is not used in any of the other calculations.
##### *Mineral precipitation and ageing* {#SedMineralPrecipitationAndAgeing .unnumbered}
In CANDI-AED, dissolved species can combine to form precipitated minerals: $MnO_{2A}$, $Fe(OH)_{3A}$, $FeS$, $MnCO_3$, $FeCO_3$, and $CaCO_3$. Another process is the ageing of amorphous $MnO_{2A}$ and $Fe(OH)_{3A}$ to the unreactive, crystalline phases $MnO_{2B}$ and $Fe(OH)_{3B}$. The third type of process is ageing process of $FeS$ to $FeS_2$ (adding a further S atom to the compound). The reactions rates are outlined in tables \@ref(tab:Geochem-table1) to \@ref(tab:Geochem-table3).
The form of the rate is dependent on the complexity of the reaction mode chosen, using the parameter `rxn_mode`. The simplest option is for the reactions not to occur. The next option is for the reaction to proceed as a biomolecular rate law, in a similar way to the secondary redox reactions, by selecting `rxn_mode` = 2.
There are also two methods that set the precipitation rate based on the relative concentrations of dissolved and precipitated species. One method uses the ion activity product (*IAP*), which is a state variable and is calculated at each depth and timestep. The calculation method is based on that from Tufano et al. (2009). This method is generally selected with `rxn_mode` = 3 (see tables \@ref(tab:Geochem-table1) to \@ref(tab:Geochem-table3)). The other method is the "omega" method, using the equations from Van Cappellen and Wang (1996), generally by using `rxn_mode` = 4 (see tables \@ref(tab:Geochem-table1) to \@ref(tab:Geochem-table3)).
<center>
```{r Geochem-table1, echo=FALSE, message=FALSE, warning=FALSE}
library(knitr)
library(kableExtra)
library(readxl)
options(knitr.kable.NA = "")
MnOFeO_tab <- read_xlsx("tables/23-sediment_biogeochemistry/UserManual.xlsx", sheet="MnOFeO")
MnOFeO_Groups <- unique(MnOFeO_tab$Group)
kable(MnOFeO_tab[,1:4],"html", escape = F, align = "c"
, caption = "Reactions and rate equations for precipitation and ageing for MnO~2~ and Fe(OH)~3~",bootstrap_options = "hover")%>%
pack_rows(MnOFeO_Groups[1],
min(which(MnOFeO_tab$Group == MnOFeO_Groups[1])),
max(which(MnOFeO_tab$Group == MnOFeO_Groups[1])),
background = '#ebebeb'
,color="black") %>%
pack_rows(MnOFeO_Groups[2],
min(which(MnOFeO_tab$Group == MnOFeO_Groups[2])),
max(which(MnOFeO_tab$Group == MnOFeO_Groups[2])),
background = '#ebebeb'
,color="black") %>%
kable_styling(MnOFeO_tab, bootstrap_options = "hover",
full_width = T, position = "left",
font_size = 12) %>%
row_spec(0, background = "#14759e", bold = TRUE, color = "white") %>%
column_spec(1, width_min = "10em" ,color="black",bold = F) %>%
column_spec(2, width_min = "15em" ,color="black") %>%
column_spec(3, width_min = "3em" ,color="black") %>%
column_spec(4, width_min = "15em" ,color="black") %>%
# row_spec(1:4, background = 'white') %>%
scroll_box(width = "48em", height = "30em",fixed_thead = FALSE)
```
</center>
$MnO_{2A}$ ageing
```{=tex}
\begin{equation}
MnO_{2A} \rightarrow MnO_{2B}
\end{equation}
```
::: {.panelset .sideways}
::: panel
[rxn_mode = 0]{.panel-name}
```{=tex}
\begin{equation}
R_{MnO_{2B}ppt} = 0
\end{equation}
```
:::
::: panel
[rxn_mode = 1]{.panel-name}
```{=tex}
\begin{equation}
R_{MnO_{2B}ppt} = 0
\end{equation}
```
:::
::: panel
[rxn_mode = 2]{.panel-name}
```{=tex}
\begin{equation}
R_{MnO_{2B}ppt} = k_{MnO_{2B}ppt} Mn_{O_{2A}}
\end{equation}
```
:::
::: panel
[rxn_mode = 3]{.panel-name}
```{=tex}
\begin{equation}
R_{MnO_{2B}ppt} = k_{MnO_{2B}ppt} Mn_{O_{2A}}
\end{equation}
```
:::
::: panel
[rxn_mode = 4]{.panel-name}
```{=tex}
\begin{equation}
R_{MnO_{2B}ppt} = k_{MnO_{2B}ppt} Mn_{O_{2A}}
\end{equation}
```
:::
:::
\
\
<!-- _______________________________________________________________________________ -->
$MnO_{2A}$ precipitation
```{=tex}
\begin{equation}
2Mn^{2+} + O_2 + 4HCO_3^- \rightarrow 2MnO_{2A} + 4CO_2 +2H_2O
\end{equation}
```
::: {.panelset .sideways}
::: panel
[rxn_mode = 0]{.panel-name}
```{=tex}
\begin{equation}
R_{MnO_{2A}ppt} = 0
\end{equation}
```
:::
::: panel
[rxn_mode = 1]{.panel-name}
```{=tex}
\begin{equation}
R_{MnO_{2A}ppt} = 0
\end{equation}
```
:::
::: panel
[rxn_mode = 2]{.panel-name} Continuous
```{=tex}
\begin{equation}
R_{MnO_{2A}ppt} = k_{MnO_{2A}ppt} Mn^{2+}
\end{equation}
```
:::
::: panel
[rxn_mode = 3]{.panel-name} IAP method
```{=tex}
\begin{equation}
R_{MnO_{2A}ppt} = \left\{
\begin{array}{@{}ll@{}}
k_{MnO_{2A}ppt} MnO_{2A}, & IAP_{MnO2} = 0 \\
k_{MnO_{2A}ppt} \left( 1 - \frac {1}{IAP_{MnO2}} \right) , & IAP_{MnO2} \lt 1 \\
k_{MnO_{2A}ppt} \left( 1 - \frac {IAP_{MnO2}}{1} \right) & IAP_{MnO2} \ge 1
\end{array}\right.
\end{equation}
```
:::
::: panel
[rxn_mode = 4]{.panel-name} Continuous
```{=tex}
\begin{equation}
R_{MnO_{2A}ppt} = k_{MnO_{2A}ppt} Mn^{2+}
\end{equation}
```
:::
:::
<!-- _______________________________________________________________________________ -->
\
\
$Fe(OH)_{3A}$ ageing
```{=tex}
\begin{equation}
Fe(OH)_{3A} \rightarrow Fe(OH)_{3B}
\end{equation}
```
::: {.panelset .sideways}
::: panel
[rxn_mode = 0]{.panel-name}
```{=tex}
\begin{equation}
R_{Fe(OH)_{3A}ppt} = 0
\end{equation}
```
:::
::: panel
[rxn_mode = 1]{.panel-name}
```{=tex}
\begin{equation}
R_{Fe(OH)_{3A}ppt} = 0
\end{equation}
```
:::
::: panel
[rxn_mode = 2]{.panel-name}
```{=tex}
\begin{equation}
R_{Fe(OH)_{3A}ppt} = k_{Fe(OH)_{3A}ppt} Fe(OH)_{3A}
\end{equation}
```
:::
::: panel
[rxn_mode = 3]{.panel-name}
```{=tex}
\begin{equation}
R_{Fe(OH)_{3A}ppt} = k_{Fe(OH)_{3A}ppt} Fe(OH)_{3A}
\end{equation}
```
:::
::: panel
[rxn_mode = 4]{.panel-name}
```{=tex}
\begin{equation}
R_{Fe(OH)_{3A}ppt} = k_{Fe(OH)_{3A}ppt} Fe(OH)_{3A}
\end{equation}
```
:::
:::
\
\
\
\
<!-- _______________________________________________________________________________ --> $Fe(OH)_{3A}$ precipitation