1#ifndef _REMORA_DATA_STRUCT_H_
2#define _REMORA_DATA_STRUCT_H_
8#include <AMReX_ParmParse.H>
9#include <AMReX_Print.H>
108 if (
type ==
"constant" ||
type ==
"const") {
110 }
else if (
type ==
"custom") {
111 amrex::Warning((
param_name +
" uses 'custom'; use 'analytic' instead.").
c_str());
113 }
else if (
type ==
"analytic" ||
type ==
"analytical") {
115 }
else if (
type ==
"netcdf" ||
type ==
"file" ||
type ==
"nc") {
117 }
else if (
type ==
"computed") {
119 amrex::Abort((
param_name +
" does not accept 'computed'; only remora.lwrad_type and remora.eminusp_type do.").
c_str());
128 void init_params (
int ncons,
int nscalar,
const amrex::Vector<std::string>& cons_names)
140 amrex::Error(
"Advection scheme unknown.");
150 amrex::Error(
"UV advection scheme unknown.");
154 pp.queryAdd(
"Zos",
Zos);
155 pp.queryAdd(
"Zob",
Zob);
214 amrex::Abort(
"Dont know this eos_type");
216 pp.queryAdd(
"R0",
R0);
217 pp.queryAdd(
"S0",
S0);
218 pp.queryAdd(
"T0",
T0);
219 pp.queryAdd(
"rho0",
rho0);
228 amrex::Abort(
"remora.time_ref = " + std::to_string(
time_ref) +
229 " names no calendar. Use a yyyymmdd.dd date, or 0, -1, or -2.");
234 amrex::Abort(
"remora.time_ref = " + std::to_string(
time_ref) +
235 " is a yyyymmdd.dd date, which needs eight exact digits and so"
236 " cannot be represented in a single-precision build. Build in"
237 " double precision, or use time_ref = 0, -1, or -2.");
311 "remora." + std::string(
input.name),
312 input.allow_computed);
338 "remora." + std::string(
input.name),
339 input.allow_computed);
377 amrex::Warning(
"remora.longwave_netcdf_varname is set but remora.lwrad_type is not netcdf; the value will be ignored.");
381 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)");
384 amrex::Abort(
"Evaporation minus precipitation (E-P) requires bulk flux parametrizations (remora.bulk_fluxes=true)");
391 amrex::Abort(
"remora.longwave_is_net=true requires remora.lwrad_type to be constant, analytic, or netcdf");
395 amrex::Abort(
"remora.longwave_down=true requires remora.lwrad_type to be constant, analytic, or netcdf");
403 amrex::Print() <<
"[REMORA] Active E-P source: NetCDF EminusP (remora.eminusp_type=netcdf).\n";
405 amrex::Print() <<
"[REMORA] Active E-P source: analytic EminusP (remora.eminusp_type=analytic).\n";
407 amrex::Print() <<
"[REMORA] Active E-P source: constant EminusP (remora.eminusp_type=constant).\n";
409 amrex::Print() <<
"[REMORA] Active E-P source: bulk evap-rain diagnostic.\n";
436 amrex::Warning(
"Initialization of grid scale from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
441 amrex::Error(
"Don't know this grid_scale_type");
449 amrex::Warning(
"remora.ic_bc_type is now called remora.ic_type, and will eventually be deprecated");
453 amrex::Warning(
"Problem initialization from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
460 amrex::Warning(
"Problem initialization from NetCDF (remora.ic_type) is now called 'netcdf'. 'real' will be deprecated");
463 amrex::Error(
"Don't know this ic_type");
466#ifndef REMORA_USE_NETCDF
472 amrex::Abort(
"remora.ic_type = netcdf requires a NetCDF build. Rebuild with "
473 "USE_PNETCDF=TRUE (GNUmake) or -DREMORA_ENABLE_PNETCDF=ON (CMake)");
487 amrex::Abort(
"Dont know this coupling_type");
495 amrex::Warning(
"Coriolis initialization from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
505 amrex::Warning(
"Coriolis initialization from NetCDF is now called 'netcdf'. 'real' will be deprecated");
508 amrex::Abort(
"Don't know this coriolis_type");
515 amrex::Warning(
"Surface momentum flux initialization from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
522 amrex::Abort(
"Don't know this smflux_type");
528 amrex::Warning(
"Surface wind initialization from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
535 amrex::Abort(
"Don't know this smflux_type");
554 amrex::Abort(
"Cannot specify both wind and surface momentum flux");
570 amrex::Abort(
"Don't know this mask_type");
582 amrex::Abort(
"Don't know this bottom_stress_type");
598 amrex::Abort(
"Don't know this horizontal mixing type");
614 amrex::Abort(
"Don't know this scaled_to_grid_amr_scaling option");
647 const std::string
key =
"Akt_bak_" + cons_names[
icomp];
648 if (
pp.contains(
key.c_str())) {
649 amrex::Abort(
"remora." +
key +
" has no effect: vertical diffusivity is carried"
650 " for temperature and salinity only, and every passive tracer mixes"
651 " with the salinity value. Set remora.Akt_bak_salt instead, or"
652 " remora.tnu2_" + cons_names[
icomp] +
" if you meant the horizontal"
665 amrex::Abort(
"Don't know this harmonic_mixing_type");
689 amrex::Abort(
"Don't know this GLS stability type");
692 amrex::Abort(
"Don't know this vertical mixing type");
712 gls_L1 = amrex::Real(0.107);
713 gls_L2 = amrex::Real(0.0032);
714 gls_L3 = amrex::Real(0.0864);
715 gls_L4 = amrex::Real(0.12);
716 gls_L5 = amrex::Real(11.9);
717 gls_L6 = amrex::Real(0.4);
719 gls_L8 = amrex::Real(0.48);
723 gls_L1 = amrex::Real(0.127);
724 gls_L2 = amrex::Real(0.00336);
725 gls_L3 = amrex::Real(0.0906);
726 gls_L4 = amrex::Real(0.101);
727 gls_L5 = amrex::Real(11.2);
728 gls_L6 = amrex::Real(0.4);
730 gls_L8 = amrex::Real(0.318);
784 amrex::Abort(
"Climatology nudging requires remora.ic_type = netcdf");
786#ifndef REMORA_USE_NETCDF
788 amrex::Abort(
"Climatology nudging requires building with NetCDF");
795 amrex::Print() <<
"SOLVER CHOICE: " << std::endl;
796 amrex::Print() <<
"use_salt : " <<
use_salt << std::endl;
797 amrex::Print() <<
"use_coriolis : " <<
use_coriolis << std::endl;
798 amrex::Print() <<
"use_prestep : " <<
use_prestep << std::endl;
799 amrex::Print() <<
"use_uv3dmix : " <<
use_uv3dmix << std::endl;
800 amrex::Print() <<
"spatial_order : " <<
spatial_order << std::endl;
803 amrex::Print() <<
"Using analytic initial onditions" << std::endl;
806 amrex::Print() <<
"Using NetCDF initial conditions" << std::endl;
810 amrex::Print() <<
"Horizontal advection scheme for tracers: " <<
"Centered 4" << std::endl;
813 amrex::Print() <<
"Horizontal advection scheme for tracers: " <<
"Upstream 3" << std::endl;
816 amrex::Error(
"Invalid horizontal advection scheme for tracers.");
820 amrex::Print() <<
"Horizontal advection scheme for momenta: " <<
"Centered 2" << std::endl;
823 amrex::Print() <<
"Horizontal advection scheme for momenta: " <<
"Upstream 3" << std::endl;
826 amrex::Error(
"Invalid horizontal advection scheme for momenta.");
830 amrex::Print() <<
"Using two-way coupling " << std::endl;
832 amrex::Print() <<
"Using one-way coupling " << std::endl;
837 amrex::Print() <<
"Using analytic coriolis forcing " << std::endl;
839 amrex::Print() <<
"Using beta plane coriolis forcing " << std::endl;
841 amrex::Print() <<
"Using coriolis forcing loaded from file " << std::endl;
956 amrex::Real
Zob = amrex::Real(2
e-2);
957 amrex::Real
Zos = amrex::Real(2
e-2);
963 amrex::Real
R0 = amrex::Real(1028);
964 amrex::Real
S0 = amrex::Real(35.0);
965 amrex::Real
T0 = amrex::Real(5.0);
966 amrex::Real
Tcoef = amrex::Real(1.7e-4);
968 amrex::Real
rho0 = amrex::Real(1025.0);
980 amrex::Real
Pair = amrex::Real(1013.48);
982 amrex::Real
Tair = amrex::Real(23.567);
984 amrex::Real
Hair = amrex::Real(0.776);
constexpr amrex::Real one
constexpr amrex::Real zero
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
ScaledToGridAMRScaling
How to scale scaled_to_grid coefficients on AMR levels.
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.
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool remora_time_ref_is_valid(amrex::Real time_ref) noexcept
Whether time_ref names a calendar this header implements.
AMREX_FORCE_INLINE bool remora_time_ref_is_representable(amrex::Real time_ref) noexcept
Whether time_ref survives a round trip through amrex::Real.
BulkForcingType
Source type for bulk-flux atmospheric forcing variables.
mf_h setVal(geomdata.ProbHi(2))
int NumTypes(int ncons) noexcept
int vbar(int ncons) noexcept
int cons(int icomp) noexcept
int zeta(int ncons) noexcept
int ubar(int ncons) noexcept
@ Vwind
10-m meridional wind [m/s]
@ Pair
atmospheric pressure [mb]
@ Uwind
10-m zonal wind [m/s]
@ LWrad
longwave radiation [W/m^2]
@ Tair
air temperature [degC]
@ Qair
specific humidity or relative humidity [kg/kg or fraction]
@ Cloud
cloud fraction [0-1]
@ SWrad
downward shortwave radiation [W/m^2]
@ Rain
precipitation rate [kg/m^2/s]
@ EminusP
evaporation minus precipitation [m/s]
amrex::Vector< amrex::Real > Akt_bak
GLS_StabilityType gls_stability_type
HorizMixingType horiz_mixing_type
amrex::Real coriolis_beta
bool use_curvilinear_grid
amrex::Vector< amrex::Real > nudg_coeff
std::array< bool, BulkFlux::NumTypes > bulk_flux_type_specified
amrex::Vector< amrex::Real > tnu2
std::string longwave_netcdf_varname
AdvectionScheme uv_Hadv_scheme
amrex::Vector< int > do_rivers_cons
ScaledToGridAMRScaling scaled_to_grid_amr_scaling
AdvectionScheme tracer_Hadv_scheme
static BulkForcingType parse_bulk_forcing_type(const std::string &type_string, const std::string ¶m_name, bool allow_computed)
bool boundary_from_netcdf
bool do_any_cons_clim_nudg
BottomStressType bottom_stress_type
void init_params(int ncons, int nscalar, const amrex::Vector< std::string > &cons_names)
read in and initialize parameters
std::array< bool, BulkFlux::NumTypes > bulk_flux_value_specified
VertMixingType vert_mixing_type
std::array< BulkForcingType, BulkFlux::NumTypes > bulk_flux_type
GridScaleType grid_scale_type
amrex::Vector< int > do_cons_clim_nudg
HarmonicMixingType harmonic_mixing_type
CouplingType coupling_type