REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_FennelBiology.H
Go to the documentation of this file.
1#ifndef REMORA_FENNEL_BIOLOGY_H_
2#define REMORA_FENNEL_BIOLOGY_H_
3
4#include <REMORA_Biology.H>
6
7namespace REMORABiology {
8
9/**
10 * Source of the atmospheric pCO2 used by the surface CO2 gas exchange.
11 *
12 * ROMS picks one of these with PCO2AIR_DATA / PCO2AIR_SECULAR or neither. The
13 * two time-dependent forms date the model clock with remora_caldate.
14 */
15enum class PCO2AirType {
16 constant, //!< remora.fennel.pCO2air, unchanging
17 data, //!< annual climatology of Laurent et al. (2017)
18 secular //!< secular trend plus harmonics, referenced to 1951
19};
20
21/**
22 * Schmidt-number formulation for the air-sea gas transfer velocity.
23 *
24 * CO2 offers the Wanninkhof (1992) and (2014) coefficient sets; O2 adds the
25 * Keeling et al. (1998) OCMIP set. The choice also selects the leading rate
26 * coefficient, 0.31 for 1992 and 0.251 for 2014, so the two must move
27 * together and are not independently settable.
28 */
33
34enum class O2SchmidtType {
37 ocmip
38};
39
41 // Maximum number of iterations to achieve convergence of the nonlinear solution.
42 int BioIter = 1;
43
44 // Light attenuation due to seawater [1/m].
45 amrex::Real AttSW = amrex::Real(0.04);
46
47 // Light attenuation by chlorophyll [1/(mg_Chl m2)].
48 amrex::Real AttChl = amrex::Real(0.02486);
49
50 // Fraction of shortwave radiation that is photosynthetically active.
51 amrex::Real PARfrac = amrex::Real(0.43);
52
53 // Eppley temperature-limited and light-limited growth tuning parameter.
54 amrex::Real Vp0 = amrex::Real(1.0);
55
56 // Radiation threshold for nitrification inhibition [Watts/m2].
57 amrex::Real I_thNH4 = amrex::Real(0.0095);
58
59 // Half-saturation radiation for nitrification inhibition [Watts/m2].
60 amrex::Real D_p5NH4 = amrex::Real(0.1);
61
62 // Nitrification rate: oxidation of NH4 to NO3 [day-1].
63 amrex::Real NitriR = amrex::Real(0.05);
64
65 // Inverse half-saturation for phytoplankton NO3 uptake [1/(millimole_N m-3)].
66 amrex::Real K_NO3 = amrex::Real(2.0);
67
68 // Inverse half-saturation for phytoplankton NH4 uptake [1/(millimole_N m-3)].
69 amrex::Real K_NH4 = amrex::Real(2.0);
70
71 // Inverse half-saturation for phytoplankton PO4 uptake [1/(millimole_P m-3)].
72 amrex::Real K_PO4 = amrex::Real(32.0);
73
74 // Zooplankton half-saturation squared constant for ingestion [millimole_N m-3]^2.
75 amrex::Real K_Phy = amrex::Real(1.0);
76
77 // Maximum chlorophyll to carbon ratio [mg_Chl/mg_C].
78 amrex::Real Chl2C_m = amrex::Real(0.0535);
79
80 // Chlorophyll minimum threshold value [mg_Chl/m3].
81 amrex::Real ChlMin = amrex::Real(0.01);
82
83 // Phytoplankton Carbon:Nitrogen ratio [mole_C/mole_N].
84 amrex::Real PhyCN = amrex::Real(6.625);
85
86 // Phytoplankton Phosphate:Nitrogen ratio [mole_P/mole_N].
87 amrex::Real R_P2N = amrex::Real(0.0625);
88
89 // Phytoplankton NH4 inhibition parameter [1/(millimole_N)].
90 amrex::Real PhyIP = amrex::Real(1.5);
91
92 // Phytoplankton initial slope of P-I curve [1/(Watts m-2 day)].
93 amrex::Real PhyIS = amrex::Real(0.025);
94
95 // Phytoplankton minimum threshold value [millimole_N/m3].
96 amrex::Real PhyMin = amrex::Real(0.01);
97
98 // Phytoplankton mortality rate [1/day].
99 amrex::Real PhyMR = amrex::Real(0.15);
100
101 // Zooplankton Nitrogen assimilation efficiency.
102 amrex::Real ZooAE_N = amrex::Real(0.75);
103
104 // Zooplankton Carbon:Nitrogen ratio [mole_C/mole_N].
105 amrex::Real ZooCN = amrex::Real(6.625);
106
107 // Basal metabolism of zooplankton [1/day].
108 amrex::Real ZooBM = amrex::Real(0.1);
109
110 // Zooplankton specific excretion rate [1/day].
111 amrex::Real ZooER = amrex::Real(0.1);
112
113 // Zooplankton maximum growth rate [1/day].
114 amrex::Real ZooGR = amrex::Real(0.6);
115
116 // Zooplankton minimum threshold value [millimole_N/m3].
117 amrex::Real ZooMin = amrex::Real(0.01);
118
119 // Zooplankton mortality rate [1/day].
120 amrex::Real ZooMR = amrex::Real(0.025);
121
122 // Large nitrogen detritus remineralization rate [day-1].
123 amrex::Real LDeRRN = amrex::Real(0.01);
124
125 // Large detritus remineralization rate C-fraction [day-1].
126 amrex::Real LDeRRC = amrex::Real(0.01);
127
128 // Coagulation rate: aggregation rate of SDeN + Phyt ==> LDeN [day-1].
129 amrex::Real CoagR = amrex::Real(0.005);
130
131 // Small nitrogen detritus remineralization rate [day-1].
132 amrex::Real SDeRRN = amrex::Real(0.1);
133
134 // Small detritus remineralization rate C-fraction [day-1].
135 amrex::Real SDeRRC = amrex::Real(0.03);
136
137 // Vertical sinking velocity for phytoplankton [m/day].
138 amrex::Real wPhy = amrex::Real(0.1);
139
140 // Vertical sinking velocity for large detritus [m/day].
141 amrex::Real wLDet = amrex::Real(1.0);
142
143 // Vertical sinking velocity for small detritus [m/day].
144 amrex::Real wSDet = amrex::Real(0.1);
145
146 // River nitrogen detritus remineralization rate [1/day].
147 amrex::Real RDeRRN = amrex::Real(0.03);
148
149 // River carbon detritus remineralization rate [1/day].
150 amrex::Real RDeRRC = amrex::Real(0.03);
151
152 // CO2 partial pressure in the air (parts per million by volume). Used when
153 // pco2air_type is constant; otherwise the value is computed from the date.
154 amrex::Real pCO2air = amrex::Real(370.0);
155
156 // Enable ROMS PO4 option, adding phosphate as an active biological tracer.
157 bool po4 = false;
158
159 // Enable ROMS CARBON option, adding large and small carbon detritus,
160 // total inorganic carbon, and alkalinity tracers.
161 bool carbon = false;
162
163 // Enable one additional biological tracer for dissolved oxygen. OXYGEN can
164 // be activated independently of the CARBON option in ROMS.
165 bool oxygen = false;
166
167 // Enable ROMS ODU option, adding dissolved oxygen demand units.
168 bool odu = false;
169
170 // Runtime analogue of ROMS DENITRIFICATION bottom remineralization option.
171 bool denitrification = false;
172
173 // Runtime analogue of ROMS BIO_SEDIMENT bottom remineralization option.
174 bool bio_sediment = true;
175
176 // Enable ROMS RIVER_DON option, adding a river dissolved organic nitrogen
177 // pool that remineralizes to NH4, plus its carbon counterpart when carbon
178 // is on. Neither pool sinks, matching ROMS.
179 bool river_don = false;
180
181 // Enable ROMS TALK_NONCONSERV option. Alkalinity is otherwise diagnostic,
182 // a function of salinity alone; with this on it responds to nitrate
183 // uptake, nitrification, zooplankton metabolism and remineralization.
184 // Requires carbon, since alkalinity is a carbon-block tracer.
185 bool talk_nonconserv = false;
186
187 // remora.fennel.pco2air_type: constant / data / secular. The two
188 // time-dependent forms date the model clock through REMORA_DateClock.H,
189 // which is ROMS caldate with time_ref = 0: model time zero is 0001-01-01,
190 // and a run is placed at a real date through remora.start_time.
192
193 // remora.fennel.co2_schmidt / remora.fennel.oxygen_schmidt.
196
197 void init_params (const std::string& remora_prefix);
198};
199
200namespace Fennel {
201static constexpr int NumBaseTracers = 7;
202static constexpr int NumCarbonTracers = 4;
203
205 int no3 = -1;
206 int nh4 = -1;
207 int chlo = -1;
208 int phyt = -1;
209 int zoop = -1;
210 int lden = -1;
211 int sden = -1;
212 int rden = -1;
213 int po4 = -1;
214 int ldec = -1;
215 int sdec = -1;
216 int tic = -1;
217 int talk = -1;
218 int rdec = -1;
219 int oxyg = -1;
220 int odu = -1;
221};
222
223/** \brief Map the Fennel tracers onto cons components starting at \p base.
224 *
225 * \p base is REMORA::bio_comp_start(), which is Tracer_comp plus the number of passive
226 * (dye) scalars. Passing it explicitly keeps biology working when a run carries dye as
227 * well, since the biology block then does not start at Tracer_comp.
228 */
229inline Components components (FennelParameters const& parameters, int base) noexcept
230{
231 int comp = base;
232 Components c;
233 c.no3 = comp++;
234 c.nh4 = comp++;
235 c.chlo = comp++;
236 c.phyt = comp++;
237 c.zoop = comp++;
238 c.lden = comp++;
239 c.sden = comp++;
240 c.rden = parameters.river_don ? comp++ : -1;
241 c.po4 = parameters.po4 ? comp++ : -1;
242 c.ldec = parameters.carbon ? comp++ : -1;
243 c.sdec = parameters.carbon ? comp++ : -1;
244 c.tic = parameters.carbon ? comp++ : -1;
245 c.talk = parameters.carbon ? comp++ : -1;
246 c.rdec = (parameters.carbon && parameters.river_don) ? comp++ : -1;
247 c.oxyg = parameters.oxygen ? comp++ : -1;
248 c.odu = parameters.odu ? comp++ : -1;
249 return c;
250}
251
252inline int num_tracers (FennelParameters const& parameters) noexcept
253{
254 return NumBaseTracers + (parameters.po4 ? 1 : 0) +
255 (parameters.carbon ? NumCarbonTracers : 0) +
256 (parameters.river_don ? 1 : 0) +
257 ((parameters.river_don && parameters.carbon) ? 1 : 0) +
258 (parameters.oxygen ? 1 : 0) + (parameters.odu ? 1 : 0);
259}
260}
261
262
263/** \brief Fennel ecosystem; polymorphism is host-only, kernels capture plain data. */
264class FennelBiology final : public Biology {
265public:
266 std::string name () const override { return "fennel"; }
267 void configure (const std::string& remora_prefix) override;
268 const BiologyDeclaration& declaration () const noexcept override { return m_declaration; }
269 void advance (const BiologyAdvanceContext& context) const override;
270
271private:
274 int m_use_cpp = 1;
275 int m_debug = 0;
276 int m_debug_i = 2;
277 int m_debug_j = 2;
278#ifdef REMORA_USE_FENNEL_FORT
279 void advance_fortran (const BiologyAdvanceContext& context) const;
280#endif
281};
282
283}
284#endif
Common host-side ecosystem interface.
Fennel ecosystem; polymorphism is host-only, kernels capture plain data.
const BiologyDeclaration & declaration() const noexcept override
void advance(const BiologyAdvanceContext &context) const override
void configure(const std::string &remora_prefix) override
std::string name() const override
static constexpr int NumCarbonTracers
Components components(FennelParameters const &parameters, int base) noexcept
Map the Fennel tracers onto cons components starting at base.
int num_tracers(FennelParameters const &parameters) noexcept
static constexpr int NumBaseTracers
@ secular
secular trend plus harmonics, referenced to 1951
@ constant
remora.fennel.pCO2air, unchanging
@ data
annual climatology of Laurent et al. (2017)
Host views at the existing biology source-update stage.
Configured inventory and output aliases, frozen before scalar allocation.
void init_params(const std::string &remora_prefix)