REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_IndexDefines.H
Go to the documentation of this file.
1#ifndef REMORA_INDEX_DEFINES_H_
2#define REMORA_INDEX_DEFINES_H_
3
4#include <AMReX_REAL.H>
5#include <AMReX_Arena.H>
6#include <AMReX_Extension.H>
7#include <AMReX_GpuQualifiers.H>
8
9// Cell-centered state variables
10#define Temp_comp 0
11#define Salt_comp 1
12#define Tracer_comp 2
13
14// Number of active tracers, i.e. the ones that feed back on the density field:
15// temperature and salinity. ROMS carries vertical mixing coefficients for these two
16// alone, so Tracer_comp doubles as the count of them.
17#define NAT Tracer_comp
18
19/**
20 * The vertical diffusivity component that cons component icomp is mixed with.
21 *
22 * Akt is stored for the active tracers only, and every passive tracer -- dye and biology
23 * alike -- mixes with the salinity coefficient. This is ROMS's ltrc=MIN(itrc,NAT) in
24 * pre_step3d and step3d_t, and it is why vec_Akt has NAT components rather than ncons.
25 * Horizontal diffusivity is a separate story: tnu2 really is per tracer.
26 */
28int akt_comp (int icomp) noexcept { return (icomp < NAT) ? icomp : Salt_comp; }
29
30#define NGROW 2
31
32/**
33 * \brief Boundary fill types
34 */
35namespace BCVars {
36 static constexpr int cons_bc = 0;
37 static constexpr int Temp_bc_comp = 0;
38 static constexpr int Salt_bc_comp = 1;
39 static constexpr int Scalar_bc_comp = 2;
40
41 inline int xvel_bc (int ncons) noexcept { return ncons; }
42 inline int yvel_bc (int ncons) noexcept { return ncons + 1; }
43 inline int zvel_bc (int ncons) noexcept { return ncons + 2; }
44 inline int ubar_bc (int ncons) noexcept { return ncons + 3; }
45 inline int vbar_bc (int ncons) noexcept { return ncons + 4; }
46 inline int zeta_bc (int ncons) noexcept { return ncons + 5; }
47 inline int tke_bc (int ncons) noexcept { return ncons + 6; }
48 inline int foextrap_periodic_bc (int ncons) noexcept { return ncons + 7; }
49 inline int foextrap_bc (int ncons) noexcept { return ncons + 8; }
50 inline int u2d_simple_bc (int ncons) noexcept { return ncons + 9; }
51 inline int v2d_simple_bc (int ncons) noexcept { return ncons + 10; }
52 inline int NumTypes (int ncons) noexcept { return ncons + AMREX_SPACEDIM + 8; }
53}
54
55/**
56 * \brief These are only for the variables read in from netcdf boundary condition files
57 *
58 * The cell-centered tracers occupy a contiguous block of slots starting at t, laid
59 * out in the same order as the components of the cons MultiFab. So slot t is temp,
60 * slot t+1 is salt, and slot t+n is cons component n for every additional scalar
61 * (passive tracers, biology tracers). Use cons(icomp) rather than hardcoding this,
62 * and note that the logic in fill_from_bdyfiles relies on the block being contiguous
63 * and in component order.
64 *
65 * Like BCVars, everything above the tracer block is a function of ncons rather than a
66 * compile-time constant. With ncons == 2 these reduce to the historical fixed values
67 * (ubar 4, vbar 5, zeta 6, NumTypes 7).
68 */
69namespace BdyVars {
70 static constexpr int null = -1;
71 static constexpr int u = 0;
72 static constexpr int v = 1;
73 static constexpr int t = 2; ///< cons component Temp_comp
74 static constexpr int s = 3; ///< cons component Salt_comp
75
76 inline int cons (int icomp) noexcept { return t + icomp; }
77 inline int ubar (int ncons) noexcept { return t + ncons; }
78 inline int vbar (int ncons) noexcept { return t + ncons + 1; }
79 inline int zeta (int ncons) noexcept { return t + ncons + 2; }
80 inline int NumTypes (int ncons) noexcept { return t + ncons + 3; }
81}
82
83/**
84 * \brief Index constants for driver_atmos_state_from_driver and the
85 * matching atmospheric forcing MultiFab vector passed to
86 * REMORA::ApplyAtmosphericStates.
87 *
88 * Order mirrors AtmosToOceanIndex (state lanes 0-8) from
89 * ERFRemoraCouplingContract.H; Pair uses REMORA's internal naming
90 * convention rather than the contract's Patm.
91 */
92namespace AtmosState {
93 enum {
94 Uwind = 0, ///< 10-m zonal wind [m/s]
95 Vwind, ///< 10-m meridional wind [m/s]
96 Pair, ///< atmospheric pressure [Pa from driver, mb in REMORA]
97 Qair, ///< specific humidity [kg/kg]
98 Tair, ///< air temperature [K from driver, degC in REMORA]
99 Cloud, ///< cloud fraction [0-1]
100 Rain, ///< precipitation rate [kg/m^2/s]
101 SWrad, ///< downward shortwave radiation [W/m^2]
102 LWrad, ///< downward longwave radiation [W/m^2]
104 };
105}
106
107/**
108 * \brief Index constants for the driver ATM->OCN flux-passing active view.
109 *
110 * Order mirrors AtmosToOceanActiveIndices(FluxPassing) from
111 * ERFRemoraCouplingContract.H:
112 * tau_x, tau_y, SHflux, LHflux, SWrad, LWrad, rain, evap.
113 */
114namespace AtmosFluxes {
115 enum {
116 TauX = 0, ///< surface zonal stress lane
117 TauY, ///< surface meridional stress lane
118 SHflux, ///< sensible heat flux lane
119 LHflux, ///< latent heat flux lane
120 SWrad, ///< shortwave radiation lane
121 LWrad, ///< longwave flux lane
122 Rain, ///< precipitation rate lane
123 Evap, ///< evaporation rate lane
125 };
126}
127
128/**
129 * \brief Source type for bulk-flux atmospheric forcing variables.
130 *
131 * computed is used for diagnostics/parameterizations that are evaluated by
132 * REMORA rather than prescribed as an input field, e.g. Berliand longwave or
133 * bulk evaporation minus precipitation.
134 */
135enum class BulkForcingType {
136 constant,
137 analytic,
138 netcdf,
140};
141
142/**
143 * \brief Index constants for SolverChoice::bulk_flux_type.
144 */
145namespace BulkFlux {
146 enum {
147 Uwind = 0, ///< 10-m zonal wind [m/s]
148 Vwind, ///< 10-m meridional wind [m/s]
149 Pair, ///< atmospheric pressure [mb]
150 Qair, ///< specific humidity or relative humidity [kg/kg or fraction]
151 Tair, ///< air temperature [degC]
152 Cloud, ///< cloud fraction [0-1]
153 Rain, ///< precipitation rate [kg/m^2/s]
154 SWrad, ///< downward shortwave radiation [W/m^2]
155 LWrad, ///< longwave radiation [W/m^2]
156 EminusP, ///< evaporation minus precipitation [m/s]
158 };
159}
160
165
166/**
167 * NOTE: the first of these must match up with the BCType enum
168 * in amrex/Src/Base/AMReX_BC_TYPES.H. We had extras at
169 * the end to use locally
170 */
185#endif
@ orlanski_rad_nudge
#define NAT
BulkForcingType
Source type for bulk-flux atmospheric forcing variables.
#define Salt_comp
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int akt_comp(int icomp) noexcept
mf_h setVal(geomdata.ProbHi(2))
Index constants for the driver ATM->OCN flux-passing active view.
@ LWrad
longwave flux lane
@ LHflux
latent heat flux lane
@ Rain
precipitation rate lane
@ Evap
evaporation rate lane
@ SHflux
sensible heat flux lane
@ TauX
surface zonal stress lane
@ TauY
surface meridional stress lane
@ SWrad
shortwave radiation lane
Index constants for driver_atmos_state_from_driver and the matching atmospheric forcing MultiFab vect...
@ Pair
atmospheric pressure [Pa from driver, mb in REMORA]
@ Vwind
10-m meridional wind [m/s]
@ Qair
specific humidity [kg/kg]
@ SWrad
downward shortwave radiation [W/m^2]
@ LWrad
downward longwave radiation [W/m^2]
@ Uwind
10-m zonal wind [m/s]
@ Rain
precipitation rate [kg/m^2/s]
@ Cloud
cloud fraction [0-1]
@ Tair
air temperature [K from driver, degC in REMORA]
Boundary fill types.
int NumTypes(int ncons) noexcept
static constexpr int cons_bc
int xvel_bc(int ncons) noexcept
static constexpr int Salt_bc_comp
int zvel_bc(int ncons) noexcept
static constexpr int Temp_bc_comp
int yvel_bc(int ncons) noexcept
int vbar_bc(int ncons) noexcept
int foextrap_bc(int ncons) noexcept
int v2d_simple_bc(int ncons) noexcept
int u2d_simple_bc(int ncons) noexcept
int zeta_bc(int ncons) noexcept
int ubar_bc(int ncons) noexcept
int tke_bc(int ncons) noexcept
static constexpr int Scalar_bc_comp
int foextrap_periodic_bc(int ncons) noexcept
These are only for the variables read in from netcdf boundary condition files.
static constexpr int t
cons component Temp_comp
static constexpr int u
int NumTypes(int ncons) noexcept
static constexpr int v
int vbar(int ncons) noexcept
int cons(int icomp) noexcept
static constexpr int s
cons component Salt_comp
static constexpr int null
int zeta(int ncons) noexcept
int ubar(int ncons) noexcept
Index constants for SolverChoice::bulk_flux_type.
@ 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]