REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_DataStruct.H
Go to the documentation of this file.
1#ifndef _REMORA_DATA_STRUCT_H_
2#define _REMORA_DATA_STRUCT_H_
3
4#include <string>
5#include <iostream>
6
7#include <AMReX_ParmParse.H>
8#include <AMReX_Print.H>
9#include <AMReX_Gpu.H>
10
11#include <REMORA_Constants.H>
12#include "REMORA_IndexDefines.H"
13
14/** \brief Type of coupling between levels in AMR */
15enum struct CouplingType {
17};
18
19/** \brief Coordinates */
20enum class Coord {
21 x, y, z
22};
23
24/** \brief Horizontal advection schemes */
28
29/** \brief Type of initial condition type. Analytic reads from prob.cpp. Netcdf is from file */
30enum class IC_Type {
32};
33
34/** \brief Coriolis factor */
35enum class Cor_Type {
37};
38
39/** \brief plotfile format */
40enum class PlotfileType {
42};
43
44/** \brief vertical mixing type */
45enum class VertMixingType {
47};
48
49/** \brief horizontal viscosity/diffusion type */
53
54/** \brief How to scale scaled_to_grid coefficients on AMR levels */
57};
58
59/** \brief stability function for GLS */
63
64/** \brief equation of state */
65enum class EOSType {
67};
68
69/** \brief bottom stress formulation */
73
74/** \brief initialization for pm and pn */
75enum class GridScaleType {
77};
78
79/** \brief surface momentum flux */
80enum class SMFluxType {
82};
83
84/** \brief surface wind */
85enum class WindType {
87};
88
89/** \brief masks */
90enum class MaskType {
92};
93
94/** \brief harmonic mixing; which surfaces to calculate along */
97};
98
100 public:
101 /** \brief read in and initialize parameters */
102 void init_params(int ncons)
103 {
104 amrex::ParmParse pp(pp_prefix);
105
106 pp.queryAdd("flat_bathymetry", flat_bathymetry);
107
108 // Which horizontal advection scheme for tracers
109 static std::string tracer_hadv_string = "upstream3";
110 pp.queryAdd("tracer_horizontal_advection_scheme",tracer_hadv_string);
111 if (tracer_hadv_string == "centered4")
113 else if (tracer_hadv_string == "upstream3")
115 else
116 amrex::Error("Advection scheme unknown.");
117
118 // Which horizontal advection scheme
119 static std::string uv_hadv_string = "upstream3";
120 pp.queryAdd("uv_horizontal_advection_scheme",uv_hadv_string);
121 if (uv_hadv_string == "upstream3")
123 else if (uv_hadv_string == "centered2")
125 else
126 amrex::Error("UV advection scheme unknown.");
127
128 pp.queryAdd("rdrag", rdrag);
129 pp.queryAdd("rdrag2", rdrag2);
130 pp.queryAdd("Zos", Zos);
131 pp.queryAdd("Zob", Zob);
132 pp.queryAdd("Cdb_max", Cdb_max);
133 pp.queryAdd("Cdb_min", Cdb_min);
134
135 // Include salinity?
136 pp.queryAdd("use_salt", use_salt);
137
138 // Include Coriolis forcing?
139 pp.queryAdd("use_coriolis", use_coriolis);
140
141 // Include prestep / lagged predictor / corrections
142 pp.queryAdd("use_prestep", use_prestep);
143
144 //This affect forcing and some of the mixing terms for velocity
145 pp.queryAdd("use_uv3dmix", use_uv3dmix);
146
147 //This accounts for the main 2d loop but may not include coupling and copying properly
148 pp.queryAdd("use_barotropic", use_barotropic);
149
150 pp.queryAdd("use_curvilinear_grid", use_curvilinear_grid);
151
152 // Whether to do rivers. By default, rivers are temp and salt sources. Rivers
153 // have to be momentum sources.
154 pp.queryAdd("do_rivers", do_rivers);
155
156 pp.queryAdd("do_rivers_temp", do_rivers_temp);
157 pp.queryAdd("do_rivers_salt", do_rivers_salt);
158 pp.queryAdd("do_rivers_scalar", do_rivers_scalar);
159
160 do_rivers_cons.assign(ncons, 0);
161 // If we aren't doing rivers, set all of these flags to false
164 for (int icomp = Tracer_comp; icomp < ncons; ++icomp) {
165 do_rivers_cons[icomp] = do_rivers ? do_rivers_scalar : false;
166 }
167
168 pp.queryAdd("init_l1ad_T", init_l1ad_T);
169
170 pp.queryAdd("init_ana_T", init_ana_T);
171
172 pp.queryAdd("init_l0int_T", init_l0int_T);
173
174 static std::string eos_type_string = "linear";
175 pp.queryAdd("eos_type",eos_type_string);
176 if (eos_type_string == "linear" || eos_type_string == "Linear" ||
177 eos_type_string == "lin" || eos_type_string == "Lin") {
179 pp.queryAdd("Tcoef",Tcoef);
180 pp.queryAdd("Scoef",Scoef);
181 } else if (eos_type_string == "nonlinear" || eos_type_string == "Nonlinear" ||
182 eos_type_string == "non-linear" || eos_type_string == "Non-linear" ||
183 eos_type_string == "nonlin" || eos_type_string == "Nonlin") {
185 } else {
186 amrex::Abort("Dont know this eos_type");
187 }
188 pp.queryAdd("R0",R0);
189 pp.queryAdd("S0",S0);
190 pp.queryAdd("T0",T0);
191 pp.queryAdd("rho0", rho0);
192
193 pp.queryAdd("bulk_fluxes",bulk_fluxes);
194 pp.queryAdd("atm2ocn_flux_mode", atm2ocn_flux_mode);
195 {
196 amrex::ParmParse pp_driver("driver");
197 std::string driver_atm2ocn_mode = "state";
198 pp_driver.query("atm2ocn_mode", driver_atm2ocn_mode);
199 if (amrex::toLower(driver_atm2ocn_mode) == "flux") {
200 atm2ocn_flux_mode = true;
201 }
202 }
204 do_salt_flux = true;
205 do_temp_flux = true;
206 }
207 // Outputs forcing variables if true
208 pp.queryAdd("output_forcing", output_forcing);
209 pp.queryAdd("air_pressure",Pair);
210 pp.queryAdd("air_temperature",Tair);
211 pp.queryAdd("air_humidity",Hair);
212 pp.queryAdd("surface_radiation_flux",srflux);
213 pp.queryAdd("srflx_from_netcdf",srflx_from_netcdf);
214 pp.queryAdd("longwave_down", longwave_down);
215 pp.queryAdd("longwave_down_from_netcdf",longwave_down_from_netcdf);
216 pp.queryAdd("longwave_netcdf_is_net", longwave_netcdf_is_net);
217 pp.queryAdd("longwave_netcdf_varname", longwave_netcdf_varname);
218 pp.queryAdd("cloud",cloud);
219 pp.queryAdd("rain",rain);
220 pp.queryAdd("blk_ZQ",blk_ZQ);
221 pp.queryAdd("blk_ZT",blk_ZT);
222 pp.queryAdd("blk_ZW",blk_ZW);
223 pp.queryAdd("eminusp",eminusp);
224 pp.queryAdd("eminusp_correct_ssh",eminusp_correct_ssh);
225 // Control flags for loading atmospheric variables from NetCDF
226 pp.queryAdd("Tair_from_netcdf",Tair_from_netcdf);
227 pp.queryAdd("qair_from_netcdf",qair_from_netcdf);
228 pp.queryAdd("qair_is_percent",qair_is_percent);
229 pp.queryAdd("Pair_from_netcdf",Pair_from_netcdf);
230 pp.queryAdd("rain_from_netcdf",rain_from_netcdf);
231 pp.queryAdd("cloud_from_netcdf",cloud_from_netcdf);
232 pp.queryAdd("EminusP_from_netcdf",EminusP_from_netcdf);
233
235 // If user provides net longwave from NetCDF, force use of file-based longwave.
236 longwave_down = true;
238 }
239
241 amrex::Warning("remora.longwave_netcdf_varname is set but remora.longwave_down_from_netcdf is false; the value will be ignored.");
242 }
243
245 amrex::Abort("If evaporation minus precipitation (E-P) sea surface height correction is on, bulk fluxes must be on as well (remora.bulk_fluxes=true)");
246 }
247 if (eminusp and !bulk_fluxes) {
248 amrex::Abort("Evaporation minus precipitation (E-P) requires bulk flux parametrizations (remora.bulk_fluxes=true)");
249 }
250
251 {
252 static bool printed_ep_source = false;
253 if (!printed_ep_source) {
254 printed_ep_source = true;
256 amrex::Print() << "[REMORA] Active E-P source: NetCDF EminusP (remora.EminusP_from_netcdf=true).\n";
257 } else {
258 amrex::Print() << "[REMORA] Active E-P source: bulk evap-rain diagnostic.\n";
259 }
260 }
261 }
262
263 //Read in linear eos parameters
264 //Grid stretching
265 pp.queryAdd("theta_s",theta_s);
266 pp.queryAdd("theta_b",theta_b);
267 pp.queryAdd("tcline",tcline);
268
269 //coriolis factor
270 pp.queryAdd("coriolis_f0",coriolis_f0);
271 pp.queryAdd("coriolis_beta",coriolis_beta);
272
273 pp.queryAdd("Akv_bak",Akv_bak);
274 pp.queryAdd("Akt_bak",Akt_bak);
275
276
277 static std::string grid_scale_type_string = "constant";
278 pp.queryAdd("grid_scale_type",grid_scale_type_string);
279
280 if (amrex::toLower(grid_scale_type_string) == "constant") {
282 } else if (amrex::toLower(grid_scale_type_string) == "custom") {
283 amrex::Warning("Initialization of grid scale from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
285 } else if (amrex::toLower(grid_scale_type_string) == "analytic") {
287 } else {
288 amrex::Error("Don't know this grid_scale_type");
289 }
290
291 static std::string ic_type_string = "analytic";
292 bool found_ic_bc = pp.queryAdd("ic_bc_type", ic_type_string);
293 pp.queryAdd("ic_type", ic_type_string);
294
295 if (found_ic_bc) {
296 amrex::Warning("remora.ic_bc_type is now called remora.ic_type, and will eventually be deprecated");
297 }
298
299 if ( amrex::toLower(ic_type_string) == "custom") {
300 amrex::Warning("Problem initialization from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
302 } else if ( amrex::toLower(ic_type_string) == "analytic") {
304 } else if ( amrex::toLower(ic_type_string) == "netcdf") {
306 } else if ( amrex::toLower(ic_type_string) == "real") {
307 amrex::Warning("Problem initialization from NetCDF (remora.ic_type) is now called 'netcdf'. 'real' will be deprecated");
309 } else {
310 amrex::Error("Don't know this ic_type");
311 }
312
313 // Which type of refinement
314 static std::string coupling_type_string = "TwoWay";
315 pp.queryAdd("coupling_type",coupling_type_string);
316 if (amrex::toLower(coupling_type_string) == "twoway" ||
317 amrex::toLower(coupling_type_string) == "two_way") {
319 } else if (amrex::toLower(coupling_type_string) == "oneway" ||
320 amrex::toLower(coupling_type_string) == "one_way") {
322 } else {
323 amrex::Abort("Dont know this coupling_type");
324 }
325
326 // Which type of coriolis forcing
327 if (use_coriolis) {
328 static std::string coriolis_type_string = "beta_plane";
329 pp.queryAdd("coriolis_type",coriolis_type_string);
330 if ( amrex::toLower(coriolis_type_string) == "custom") {
331 amrex::Warning("Coriolis initialization from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
333 } else if ( amrex::toLower(coriolis_type_string) == "analytic") {
335 } else if ((amrex::toLower(coriolis_type_string) == "beta_plane") ||
336 (amrex::toLower(coriolis_type_string) == "betaplane")) {
338 } else if ( (amrex::toLower(coriolis_type_string) == "netcdf")) {
340 } else if ( (amrex::toLower(coriolis_type_string) == "real")) {
341 amrex::Warning("Coriolis initialization from NetCDF is now called 'netcdf'. 'real' will be deprecated");
343 } else {
344 amrex::Abort("Don't know this coriolis_type");
345 }
346 }
347
348 static std::string smflux_type_string = "analytic";
349 int smflux_specified = pp.queryAdd("smflux_type",smflux_type_string);
350 if ( amrex::toLower(smflux_type_string) == "custom") {
351 amrex::Warning("Surface momentum flux initialization from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
353 } else if ( amrex::toLower(smflux_type_string) == "analytic") {
355 } else if ( amrex::toLower(smflux_type_string) == "netcdf") {
357 } else {
358 amrex::Abort("Don't know this smflux_type");
359 }
360
361 static std::string wind_type_string = "analytic";
362 int wind_specified = pp.queryAdd("wind_type",wind_type_string);
363 if ( amrex::toLower(wind_type_string) == "custom") {
364 amrex::Warning("Surface wind initialization from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
366 } else if ( amrex::toLower(wind_type_string) == "analytic") {
368 } else if ( amrex::toLower(wind_type_string) == "netcdf") {
370 } else {
371 amrex::Abort("Don't know this smflux_type");
372 }
373
374 if (wind_specified && smflux_specified) {
375 amrex::Abort("Cannot specify both wind and surface momentum flux");
376 }
377
378 static std::string mask_type_string = "none";
379 // If initial condition type is netcdf, default to netcdf masks
380 if (ic_type == IC_Type::netcdf) {
381 mask_type_string = "netcdf";
382 }
383 pp.queryAdd("mask_type", mask_type_string);
384 if (amrex::toLower(mask_type_string) == "none") {
386 } else if (amrex::toLower(mask_type_string) == "analytic") {
388 } else if (amrex::toLower(mask_type_string) == "netcdf") {
390 } else {
391 amrex::Abort("Don't know this mask_type");
392 }
393
394 static std::string bottom_stress_type_string = "linear";
395 pp.queryAdd("bottom_stress_type", bottom_stress_type_string);
396 if (amrex::toLower(bottom_stress_type_string) == "linear") {
398 } else if (amrex::toLower(bottom_stress_type_string) == "quadratic") {
400 } else if (amrex::toLower(bottom_stress_type_string) == "logarithmic") {
402 } else {
403 amrex::Abort("Don't know this bottom_stress_type");
404 }
405
406 amrex::Real tnu2_salt = amrex::Real(0.0);
407 amrex::Real tnu2_temp = amrex::Real(0.0);
408 amrex::Real tnu2_scalar = amrex::Real(0.0);
409 static std::string horiz_mixing_type_string = "analytic";
410 pp.queryAdd("horizontal_mixing_type", horiz_mixing_type_string);
411 if (amrex::toLower(horiz_mixing_type_string) == "analytical" ||
412 amrex::toLower(horiz_mixing_type_string) == "analytic") {
414 } else if (amrex::toLower(horiz_mixing_type_string) == "constant") {
416 } else if (amrex::toLower(horiz_mixing_type_string) == "scaled_to_grid") {
418 } else {
419 amrex::Abort("Don't know this horizontal mixing type");
420 }
421 pp.queryAdd("visc2",visc2);
422 pp.queryAdd("tnu2_salt",tnu2_salt);
423 pp.queryAdd("tnu2_temp",tnu2_temp);
424 pp.queryAdd("tnu2_scalar",tnu2_scalar);
425
426 // For scaled_to_grid runs with AMR refinement: optionally scale the coefficients
427 // by the horizontal refinement ratio (linear in grid size).
428 static std::string scaled_to_grid_amr_scaling_string = "none";
429 pp.queryAdd("scaled_to_grid_amr_scaling", scaled_to_grid_amr_scaling_string);
430 if (amrex::toLower(scaled_to_grid_amr_scaling_string) == "none") {
432 } else if (amrex::toLower(scaled_to_grid_amr_scaling_string) == "linear") {
434 } else {
435 amrex::Abort("Don't know this scaled_to_grid_amr_scaling option");
436 }
437
438 tnu2.assign(ncons, tnu2_scalar);
439 if (ncons > Temp_comp) {
440 tnu2[Temp_comp] = tnu2_temp;
441 }
442 if (ncons > Salt_comp) {
443 tnu2[Salt_comp] = tnu2_salt;
444 }
445
446 static std::string harmonic_mixing_type_string = "s";
447 pp.queryAdd("harmonic_mixing_type", harmonic_mixing_type_string);
448 if (amrex::toLower(harmonic_mixing_type_string) == "s") {
450 } else if (amrex::toLower(harmonic_mixing_type_string) == "geopotential" ||
451 amrex::toLower(harmonic_mixing_type_string) == "geo") {
453 } else {
454 amrex::Abort("Don't know this harmonic_mixing_type");
455 }
456
457 pp.queryAdd("Akk_bak", Akk_bak);
458 pp.queryAdd("Akp_bak", Akp_bak);
459 static std::string vert_mixing_type_string = "analytic";
460 static std::string gls_stability_type_string = "Canuto_A";
461 pp.queryAdd("vertical_mixing_type", vert_mixing_type_string);
462 pp.queryAdd("gls_stability_type", gls_stability_type_string);
463 if (amrex::toLower(vert_mixing_type_string) == "analytical" ||
464 amrex::toLower(vert_mixing_type_string) == "analytic") {
466 } else if (amrex::toLower(vert_mixing_type_string) == "gls") {
468 if (amrex::toLower(gls_stability_type_string) == "canuto_a") {
470 }
471 else if (amrex::toLower(gls_stability_type_string) == "canuto_b") {
473 }
474 else if (amrex::toLower(gls_stability_type_string) == "galperin") {
476 }
477 else {
478 amrex::Abort("Don't know this GLS stability type");
479 }
480 } else {
481 amrex::Abort("Don't know this vertical mixing type");
482 }
483 // Read in GLS params
485 pp.queryAdd("gls_P", gls_p);
486 pp.queryAdd("gls_M", gls_m);
487 pp.queryAdd("gls_N", gls_n);
488 pp.queryAdd("gls_Kmin", gls_Kmin);
489 pp.queryAdd("gls_Pmin", gls_Pmin);
490
491 pp.queryAdd("gls_cmu0", gls_cmu0);
492 pp.queryAdd("gls_c1", gls_c1);
493 pp.queryAdd("gls_c2", gls_c2);
494 pp.queryAdd("gls_c3m", gls_c3m);
495 pp.queryAdd("gls_c3p", gls_c3p);
496 pp.queryAdd("gls_sigk", gls_sigk);
497 pp.queryAdd("gls_sigp", gls_sigp);
499 gls_Gh0 = amrex::Real(0.0329); // 0.0329 GOTM, 0.0673 Burchard
500 gls_Ghcri = amrex::Real(0.03);
501 gls_L1 = amrex::Real(0.107);
502 gls_L2 = amrex::Real(0.0032);
503 gls_L3 = amrex::Real(0.0864);
504 gls_L4 = amrex::Real(0.12);
505 gls_L5 = amrex::Real(11.9);
506 gls_L6 = amrex::Real(0.4);
507 gls_L7 = amrex::Real(0.0);
508 gls_L8 = amrex::Real(0.48);
510 gls_Gh0 = amrex::Real(0.0444); // 0.044 GOTM, 0.0673 Burchard
511 gls_Ghcri = amrex::Real(0.0414);
512 gls_L1 = amrex::Real(0.127);
513 gls_L2 = amrex::Real(0.00336);
514 gls_L3 = amrex::Real(0.0906);
515 gls_L4 = amrex::Real(0.101);
516 gls_L5 = amrex::Real(11.2);
517 gls_L6 = amrex::Real(0.4);
518 gls_L7 = amrex::Real(0.0);
519 gls_L8 = amrex::Real(0.318);
520 } else {
521 gls_Gh0 = amrex::Real(0.028);
522 gls_Ghcri = amrex::Real(0.02);
523 }
524 }
525
526 // Read and compute inverse nudging coeffs from inputs given in days,
527 // and store in a vector corresponding to BdyVars enum
528 amrex::Real tnudg = amrex::Real(0.0);
529 amrex::Real znudg = amrex::Real(0.0);
530 amrex::Real m2nudg = amrex::Real(0.0);
531 amrex::Real m3nudg = amrex::Real(0.0);
532 pp.queryAdd("tnudg",tnudg);
533 pp.queryAdd("znudg",znudg);
534 pp.queryAdd("m2nudg",m2nudg);
535 pp.queryAdd("m3nudg",m3nudg);
536 pp.queryAdd("obcfac",obcfac);
537
539 nudg_coeff[BdyVars::u ] = (m3nudg > 0.0) ? amrex::Real(1.0) / (m3nudg * amrex::Real(86400.0)) : 0.0;//BdyVars::u
540 nudg_coeff[BdyVars::v ] = (m3nudg > 0.0) ? amrex::Real(1.0) / (m3nudg * amrex::Real(86400.0)) : 0.0;//BdyVars::v
541 nudg_coeff[BdyVars::t ] = ( tnudg > 0.0) ? amrex::Real(1.0) / ( tnudg * amrex::Real(86400.0)) : 0.0;//BdyVars::t
542 nudg_coeff[BdyVars::s ] = ( tnudg > 0.0) ? amrex::Real(1.0) / ( tnudg * amrex::Real(86400.0)) : 0.0;//BdyVars::s
543 nudg_coeff[BdyVars::ubar ] = (m2nudg > 0.0) ? amrex::Real(1.0) / (m2nudg * amrex::Real(86400.0)) : 0.0;//BdyVars::ubar
544 nudg_coeff[BdyVars::vbar ] = (m2nudg > 0.0) ? amrex::Real(1.0) / (m2nudg * amrex::Real(86400.0)) : 0.0;//BdyVars::vbar
545 nudg_coeff[BdyVars::zeta ] = ( znudg > 0.0) ? amrex::Real(1.0) / ( znudg * amrex::Real(86400.0)) : 0.0;//BdyVars::zeta
546
547 pp.queryAdd("do_m3_clim_nudg", do_m3_clim_nudg);
548 pp.queryAdd("do_m2_clim_nudg", do_m2_clim_nudg);
549 pp.queryAdd("do_temp_clim_nudg", do_temp_clim_nudg);
550 pp.queryAdd("do_salt_clim_nudg", do_salt_clim_nudg);
551
553 do_any_clim_nudg = true;
554 }
555#ifndef REMORA_USE_NETCDF
556 if (do_any_clim_nudg) {
557 amrex::Abort("Climatology nudging requires building with NetCDF");
558 }
559#endif
560 }
561
562 void display()
563 {
564 amrex::Print() << "SOLVER CHOICE: " << std::endl;
565 amrex::Print() << "use_salt : " << use_salt << std::endl;
566 amrex::Print() << "use_coriolis : " << use_coriolis << std::endl;
567 amrex::Print() << "use_prestep : " << use_prestep << std::endl;
568 amrex::Print() << "use_uv3dmix : " << use_uv3dmix << std::endl;
569 amrex::Print() << "use_barotropic : " << use_barotropic << std::endl;
570 amrex::Print() << "flat_bathymetry : " << flat_bathymetry << std::endl;
571 amrex::Print() << "spatial_order : " << spatial_order << std::endl;
572
573 if (ic_type == IC_Type::analytic) {
574 amrex::Print() << "Using analytic initial onditions" << std::endl;
575 }
576 else if (ic_type == IC_Type::netcdf) {
577 amrex::Print() << "Using NetCDF initial conditions" << std::endl;
578 }
579
581 amrex::Print() << "Horizontal advection scheme for tracers: " << "Centered 4" << std::endl;
582 }
584 amrex::Print() << "Horizontal advection scheme for tracers: " << "Upstream 3" << std::endl;
585 }
586 else {
587 amrex::Error("Invalid horizontal advection scheme for tracers.");
588 }
589
591 amrex::Print() << "Horizontal advection scheme for momenta: " << "Centered 2" << std::endl;
592 }
594 amrex::Print() << "Horizontal advection scheme for momenta: " << "Upstream 3" << std::endl;
595 }
596 else {
597 amrex::Error("Invalid horizontal advection scheme for momenta.");
598 }
599
601 amrex::Print() << "Using two-way coupling " << std::endl;
602 } else if (coupling_type == CouplingType::one_way) {
603 amrex::Print() << "Using one-way coupling " << std::endl;
604 }
605
606 if (use_coriolis) {
608 amrex::Print() << "Using analytic coriolis forcing " << std::endl;
609 } else if (coriolis_type == Cor_Type::beta_plane) {
610 amrex::Print() << "Using beta plane coriolis forcing " << std::endl;
611 } else if (coriolis_type == Cor_Type::netcdf) {
612 amrex::Print() << "Using coriolis forcing loaded from file " << std::endl;
613 }
614 }
615 }
616
617 // Default prefix
618 std::string pp_prefix {"remora"};
619
620 bool flat_bathymetry = false;
621
622 bool use_salt = true;
623
624 // Specify what additional physics/forcing modules we use
625 bool use_coriolis = false;
626
627 // Specify whether terms are used for debugging purposes
628 bool use_prestep = true;
629 bool use_uv3dmix = true;
630 bool use_baroclinic = true;
631 bool use_barotropic = true;
632
634
635 bool bulk_fluxes = false;
636 bool atm2ocn_flux_mode = false;
637
638 bool output_forcing = false;
639 bool do_temp_flux = false;
640 bool do_salt_flux = false;
641 bool longwave_down = false;
642
643 // Control flags for loading atmospheric variables from NetCDF
644 bool Tair_from_netcdf = false;
645 bool qair_from_netcdf = false;
646 bool Pair_from_netcdf = false;
647 bool srflx_from_netcdf = false;
650 bool rain_from_netcdf = false;
651 bool cloud_from_netcdf = false;
653 bool qair_is_percent = false;
654 std::string longwave_netcdf_varname = "lwrad";
655
656
657 bool do_rivers = false;
658 bool do_rivers_temp = true;
659 bool do_rivers_salt = true;
660 bool do_rivers_scalar = false;
661 amrex::Vector<int> do_rivers_cons;
662
663 bool init_l1ad_T = false;
664
665 bool init_ana_T = false;
666
667 bool init_l0int_T = true;
668
671
672 // Coupling options are "OneWay" or "TwoWay"
674
675 // IC and BC Type: "analytic" or "netcdf"
677
678 // Coriolis forcing type
680
681 // Surface momentum flux type
683
684 // Surface wind speed type
686
687 // EOS type
689
690 // Bottom stress type
692
693 // Land/sea mask type
695
696 // Mixing type and parameters
702
703 // Type for grid scale (pm and pn)
705
706 // Stretching and depth parameters which may need to be read from inputs
707 amrex::Real theta_s = amrex::Real(3.0);
708 amrex::Real theta_b = amrex::Real(0.0);
709 amrex::Real tcline = amrex::Real(150.0);
710
711 // Linear drag coefficient [m/s]
712 amrex::Real rdrag = amrex::Real(3e-4);
713 // Quadratic drag coefficient [dimensionless]
714 amrex::Real rdrag2 = amrex::Real(3e-3);
715
716 // Momentum stress scales [m]
717 amrex::Real Zob = amrex::Real(2e-2);
718 amrex::Real Zos = amrex::Real(2e-2);
719
720 amrex::Real Cdb_max = amrex::Real(0.5);
721 amrex::Real Cdb_min = amrex::Real(1e-6);
722
723 // Linear equation of state parameters
724 amrex::Real R0 = amrex::Real(1028); // background density value (Kg/m3) used in Linear Equation of State
725 amrex::Real S0 = amrex::Real(35.0); // background salinity (nondimensional) constant
726 amrex::Real T0 = amrex::Real(5.0); // background potential temperature (Celsius) constant
727 amrex::Real Tcoef = amrex::Real(1.7e-4); // linear equation of state parameter (1/Celsius)
728 amrex::Real Scoef = amrex::Real(0.0); // linear equation of state parameter (nondimensional)
729 amrex::Real rho0 = amrex::Real(1025.0); // Mean density (Kg/m3) used when Boussinesq approx is inferred
730
731 // Coriolis forcing
732 amrex::Real coriolis_f0 = amrex::Real(0.0); // f-plane constant (1/s)
733 amrex::Real coriolis_beta = amrex::Real(0.0); // beta-plane constant (1/s/m)
734
735 // Air pressure
736 amrex::Real Pair = amrex::Real(1013.48);
737 // Air temperature
738 amrex::Real Tair = amrex::Real(23.567);
739 // Relative humidity (air)
740 amrex::Real Hair = amrex::Real(0.776);
741 // Cloud cover fraction (0=clear sky, 1=overcast)
742 amrex::Real cloud = amrex::Real(0.0);
743 // Precipitation rate (kg/m2/s)
744 amrex::Real rain = amrex::Real(0.0);
745 // Height (m) of atmospheric measurements for Bulk fluxes parametrization
746 amrex::Real blk_ZQ = amrex::Real(10.0); // air humidity
747 amrex::Real blk_ZT = amrex::Real(10.0); // air temperature
748 amrex::Real blk_ZW = amrex::Real(10.0); // winds
749
750 bool eminusp = false;
752
753 // Surface radiation flux
754 amrex::Real srflux = amrex::Real(0.0);
755
756 // Spatial discretization
758
759 // Horizontal mixing parameters
760 amrex::Real visc2 = amrex::Real(0.0);
761 amrex::Vector<amrex::Real> tnu2;
762
763 // GLS params
764 amrex::Real gls_p = amrex::Real(3.0);
765 amrex::Real gls_m = amrex::Real(1.5);
766 amrex::Real gls_n = amrex::Real(-1.0);
767 amrex::Real gls_Kmin = amrex::Real(7.6e-6);
768 amrex::Real gls_Pmin = amrex::Real(1.0e-12);
769
770 amrex::Real gls_cmu0 = amrex::Real(0.5477);
771 amrex::Real gls_c1 = amrex::Real(1.44);
772 amrex::Real gls_c2 = amrex::Real(1.92);
773 amrex::Real gls_c3m = amrex::Real(-0.4);
774 amrex::Real gls_c3p = amrex::Real(1.0);
775 amrex::Real gls_sigk = amrex::Real(1.0);
776 amrex::Real gls_sigp = amrex::Real(1.3);
777
778 // Turbulence closure
779 amrex::Real Akk_bak = amrex::Real(5.0e-6);
780 amrex::Real Akp_bak = amrex::Real(5.0e-6);
781 amrex::Real Akv_bak = amrex::Real(5.0e-6);
782 amrex::Real Akt_bak = amrex::Real(1.0e-6); // Note: this is a vector with one component per tracer in ROMS
783
784 // Params for stability functions.
785 amrex::Real gls_Gh0;
786 amrex::Real gls_Ghcri;
787 amrex::Real gls_Ghmin = amrex::Real(-0.28);
788 amrex::Real gls_E2 = amrex::Real(1.33);
789 // Params only for Canuto stability
790 amrex::Real gls_L1;
791 amrex::Real gls_L2;
792 amrex::Real gls_L3;
793 amrex::Real gls_L4;
794 amrex::Real gls_L5;
795 amrex::Real gls_L6;
796 amrex::Real gls_L7;
797 amrex::Real gls_L8;
798
799 // Params for some GLS and also Mellor-Yamada
800 amrex::Real my_A1 = amrex::Real(0.92);
801 amrex::Real my_A2 = amrex::Real(0.74);
802 amrex::Real my_B1 = amrex::Real(16.6);
803 amrex::Real my_B2 = amrex::Real(10.1);
804 amrex::Real my_C1 = amrex::Real(0.08);
805 amrex::Real my_C2 = amrex::Real(0.7);
806 amrex::Real my_C3 = amrex::Real(0.2);
807 amrex::Real my_E1 = amrex::Real(1.8);
808 amrex::Real my_E2 = amrex::Real(1.33);
809 amrex::Real my_Gh0 = amrex::Real(0.0233);
810 amrex::Real my_Sq = amrex::Real(0.2);
811 amrex::Real my_dtfac = amrex::Real(0.05);
812 amrex::Real my_lmax = amrex::Real(0.53);
813 amrex::Real my_qmin = amrex::Real(1.0E-8);
814
815 // Nudging time scales in 1/s
816 amrex::Vector<amrex::Real> nudg_coeff;
817
818 // Factor between passive (outflow) and active (inflow) open boundary
819 // conditions.
820 amrex::Real obcfac = amrex::Real(0.0);
821
822 // Whether to do climatoogy nudging
823 bool do_m2_clim_nudg = false;
824 bool do_m3_clim_nudg = false;
825 bool do_temp_clim_nudg = false;
826 bool do_salt_clim_nudg = false;
827 bool do_any_clim_nudg = false;
828
830};
831
832#endif
BottomStressType
bottom stress formulation
GridScaleType
initialization for pm and pn
HarmonicMixingType
harmonic mixing; which surfaces to calculate along
SMFluxType
surface momentum flux
AdvectionScheme
Horizontal advection schemes.
PlotfileType
plotfile format
HorizMixingType
horizontal viscosity/diffusion type
Coord
Coordinates.
MaskType
masks
ScaledToGridAMRScaling
How to scale scaled_to_grid coefficients on AMR levels.
Cor_Type
Coriolis factor.
WindType
surface wind
GLS_StabilityType
stability function for GLS
CouplingType
Type of coupling between levels in AMR.
VertMixingType
vertical mixing type
IC_Type
Type of initial condition type. Analytic reads from prob.cpp. Netcdf is from file.
EOSType
equation of state
#define Temp_comp
#define Tracer_comp
#define Salt_comp
GLS_StabilityType gls_stability_type
HorizMixingType horiz_mixing_type
amrex::Real Cdb_min
amrex::Real Akv_bak
amrex::Real blk_ZT
amrex::Real cloud
amrex::Real coriolis_beta
amrex::Real gls_sigp
amrex::Vector< amrex::Real > nudg_coeff
amrex::Real my_E2
amrex::Real rdrag2
amrex::Real gls_m
amrex::Real my_lmax
amrex::Real my_Gh0
amrex::Real my_B2
amrex::Real my_A1
amrex::Vector< amrex::Real > tnu2
amrex::Real gls_sigk
amrex::Real gls_L3
amrex::Real coriolis_f0
std::string longwave_netcdf_varname
AdvectionScheme uv_Hadv_scheme
amrex::Vector< int > do_rivers_cons
amrex::Real Tcoef
amrex::Real gls_cmu0
ScaledToGridAMRScaling scaled_to_grid_amr_scaling
std::string pp_prefix
amrex::Real gls_L6
amrex::Real gls_L2
AdvectionScheme tracer_Hadv_scheme
amrex::Real Akk_bak
amrex::Real gls_L1
amrex::Real blk_ZW
amrex::Real my_E1
amrex::Real my_C3
amrex::Real gls_n
amrex::Real theta_b
amrex::Real theta_s
amrex::Real Akt_bak
amrex::Real visc2
void init_params(int ncons)
read in and initialize parameters
amrex::Real tcline
amrex::Real gls_c3m
BottomStressType bottom_stress_type
amrex::Real my_A2
amrex::Real gls_Gh0
amrex::Real gls_Ghmin
amrex::Real my_C1
amrex::Real gls_c1
amrex::Real gls_L5
amrex::Real gls_L8
amrex::Real my_dtfac
amrex::Real srflux
SMFluxType smflux_type
amrex::Real my_C2
amrex::Real gls_Kmin
amrex::Real rdrag
VertMixingType vert_mixing_type
amrex::Real gls_c3p
amrex::Real gls_p
amrex::Real gls_L4
amrex::Real my_B1
amrex::Real blk_ZQ
amrex::Real gls_L7
amrex::Real Cdb_max
GridScaleType grid_scale_type
amrex::Real my_qmin
amrex::Real gls_Ghcri
amrex::Real obcfac
amrex::Real gls_Pmin
amrex::Real gls_c2
amrex::Real Scoef
HarmonicMixingType harmonic_mixing_type
amrex::Real Akp_bak
amrex::Real my_Sq
CouplingType coupling_type
amrex::Real gls_E2