1#ifndef _REMORA_DATA_STRUCT_H_
2#define _REMORA_DATA_STRUCT_H_
8#include <AMReX_ParmParse.H>
9#include <AMReX_Print.H>
113 if (
type ==
"constant" ||
type ==
"const") {
115 }
else if (
type ==
"custom") {
116 amrex::Warning((
param_name +
" uses 'custom'; use 'analytic' instead.").
c_str());
118 }
else if (
type ==
"analytic" ||
type ==
"analytical") {
120 }
else if (
type ==
"netcdf" ||
type ==
"file" ||
type ==
"nc") {
122 }
else if (
type ==
"computed") {
124 amrex::Abort((
param_name +
" does not accept 'computed'; only remora.lwrad_type and remora.eminusp_type do.").
c_str());
133 void init_params (
int ncons,
int nscalar,
const amrex::Vector<std::string>& cons_names)
145 amrex::Error(
"Advection scheme unknown.");
155 amrex::Error(
"UV advection scheme unknown.");
159 pp.queryAdd(
"Zos",
Zos);
160 pp.queryAdd(
"Zob",
Zob);
219 amrex::Abort(
"Dont know this eos_type");
221 pp.queryAdd(
"R0",
R0);
222 pp.queryAdd(
"S0",
S0);
223 pp.queryAdd(
"T0",
T0);
224 pp.queryAdd(
"rho0",
rho0);
237 amrex::Abort(
"remora.time_ref = " + std::to_string(
time_ref) +
238 " names no calendar. Use a yyyymmdd.dd date, or 0, -1, or -2.");
312 "remora." + std::string(
input.name),
313 input.allow_computed);
339 "remora." + std::string(
input.name),
340 input.allow_computed);
378 amrex::Warning(
"remora.longwave_netcdf_varname is set but remora.lwrad_type is not netcdf; the value will be ignored.");
382 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)");
385 amrex::Abort(
"Evaporation minus precipitation (E-P) requires bulk flux parametrizations (remora.bulk_fluxes=true)");
392 amrex::Abort(
"remora.longwave_is_net=true requires remora.lwrad_type to be constant, analytic, or netcdf");
396 amrex::Abort(
"remora.longwave_down=true requires remora.lwrad_type to be constant, analytic, or netcdf");
404 amrex::Print() <<
"[REMORA] Active E-P source: NetCDF EminusP (remora.eminusp_type=netcdf).\n";
406 amrex::Print() <<
"[REMORA] Active E-P source: analytic EminusP (remora.eminusp_type=analytic).\n";
408 amrex::Print() <<
"[REMORA] Active E-P source: constant EminusP (remora.eminusp_type=constant).\n";
410 amrex::Print() <<
"[REMORA] Active E-P source: bulk evap-rain diagnostic.\n";
437 amrex::Warning(
"Initialization of grid scale from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
442 amrex::Error(
"Don't know this grid_scale_type");
450 amrex::Warning(
"remora.ic_bc_type is now called remora.ic_type, and will eventually be deprecated");
454 amrex::Warning(
"Problem initialization from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
461 amrex::Warning(
"Problem initialization from NetCDF (remora.ic_type) is now called 'netcdf'. 'real' will be deprecated");
464 amrex::Error(
"Don't know this ic_type");
467#ifndef REMORA_USE_NETCDF
473 amrex::Abort(
"remora.ic_type = netcdf requires a NetCDF build. Rebuild with "
474 "USE_PNETCDF=TRUE (GNUmake) or -DREMORA_ENABLE_PNETCDF=ON (CMake)");
488 amrex::Abort(
"Dont know this coupling_type");
496 amrex::Warning(
"Coriolis initialization from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
506 amrex::Warning(
"Coriolis initialization from NetCDF is now called 'netcdf'. 'real' will be deprecated");
509 amrex::Abort(
"Don't know this coriolis_type");
516 amrex::Warning(
"Surface momentum flux initialization from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
523 amrex::Abort(
"Don't know this smflux_type");
529 amrex::Warning(
"Surface wind initialization from prob.cpp is now called 'analytic'. 'custom' will be deprecated");
536 amrex::Abort(
"Don't know this smflux_type");
555 amrex::Abort(
"Cannot specify both wind and surface momentum flux");
571 amrex::Abort(
"Don't know this mask_type");
586 amrex::Abort(
"Don't know this mask_consistency");
598 amrex::Abort(
"Don't know this bottom_stress_type");
614 amrex::Abort(
"Don't know this horizontal mixing type");
630 amrex::Abort(
"Don't know this scaled_to_grid_amr_scaling option");
663 const std::string
key =
"Akt_bak_" + cons_names[
icomp];
664 if (
pp.contains(
key.c_str())) {
665 amrex::Abort(
"remora." +
key +
" has no effect: vertical diffusivity is carried"
666 " for temperature and salinity only, and every passive tracer mixes"
667 " with the salinity value. Set remora.Akt_bak_salt instead, or"
668 " remora.tnu2_" + cons_names[
icomp] +
" if you meant the horizontal"
681 amrex::Abort(
"Don't know this harmonic_mixing_type");
705 amrex::Abort(
"Don't know this GLS stability type");
708 amrex::Abort(
"Don't know this vertical mixing type");
728 gls_L1 = amrex::Real(0.107);
729 gls_L2 = amrex::Real(0.0032);
730 gls_L3 = amrex::Real(0.0864);
731 gls_L4 = amrex::Real(0.12);
732 gls_L5 = amrex::Real(11.9);
733 gls_L6 = amrex::Real(0.4);
735 gls_L8 = amrex::Real(0.48);
739 gls_L1 = amrex::Real(0.127);
740 gls_L2 = amrex::Real(0.00336);
741 gls_L3 = amrex::Real(0.0906);
742 gls_L4 = amrex::Real(0.101);
743 gls_L5 = amrex::Real(11.2);
744 gls_L6 = amrex::Real(0.4);
746 gls_L8 = amrex::Real(0.318);
800 amrex::Abort(
"Climatology nudging requires remora.ic_type = netcdf");
802#ifndef REMORA_USE_NETCDF
804 amrex::Abort(
"Climatology nudging requires building with NetCDF");
811 amrex::Print() <<
"SOLVER CHOICE: " << std::endl;
812 amrex::Print() <<
"use_salt : " <<
use_salt << std::endl;
813 amrex::Print() <<
"use_coriolis : " <<
use_coriolis << std::endl;
814 amrex::Print() <<
"use_prestep : " <<
use_prestep << std::endl;
815 amrex::Print() <<
"use_uv3dmix : " <<
use_uv3dmix << std::endl;
816 amrex::Print() <<
"spatial_order : " <<
spatial_order << std::endl;
819 amrex::Print() <<
"Using analytic initial onditions" << std::endl;
822 amrex::Print() <<
"Using NetCDF initial conditions" << std::endl;
826 amrex::Print() <<
"Horizontal advection scheme for tracers: " <<
"Centered 4" << std::endl;
829 amrex::Print() <<
"Horizontal advection scheme for tracers: " <<
"Upstream 3" << std::endl;
832 amrex::Error(
"Invalid horizontal advection scheme for tracers.");
836 amrex::Print() <<
"Horizontal advection scheme for momenta: " <<
"Centered 2" << std::endl;
839 amrex::Print() <<
"Horizontal advection scheme for momenta: " <<
"Upstream 3" << std::endl;
842 amrex::Error(
"Invalid horizontal advection scheme for momenta.");
846 amrex::Print() <<
"Using two-way coupling " << std::endl;
848 amrex::Print() <<
"Using one-way coupling " << std::endl;
853 amrex::Print() <<
"Using analytic coriolis forcing " << std::endl;
855 amrex::Print() <<
"Using beta plane coriolis forcing " << std::endl;
857 amrex::Print() <<
"Using coriolis forcing loaded from file " << std::endl;
976 amrex::Real
Zob = amrex::Real(2
e-2);
977 amrex::Real
Zos = amrex::Real(2
e-2);
983 amrex::Real
R0 = amrex::Real(1028);
984 amrex::Real
S0 = amrex::Real(35.0);
985 amrex::Real
T0 = amrex::Real(5.0);
986 amrex::Real
Tcoef = amrex::Real(1.7e-4);
988 amrex::Real
rho0 = amrex::Real(1025.0);
989 amrex::Real
g = amrex::Real(9.80665);
1003 amrex::Real
Pair = amrex::Real(1013.48);
1005 amrex::Real
Tair = amrex::Real(23.567);
1007 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
MaskConsistency
what to do when a level's mask disagrees with the level above it
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(double time_ref) noexcept
Whether time_ref names a calendar this header implements.
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
bool do_check_mask_consistency
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
MaskConsistency mask_consistency
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