ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_InitCustomPert_ABL.H
Go to the documentation of this file.
1 
2  ParmParse pp_prob("prob");
3 
5  int fix_random_seed = 0;
6  long random_seed = -1;
7  {
8  ParmParse pp_erf("erf");
9  pp_erf.query("deterministic_ic_pert", deterministic_ic_pert);
10  pp_erf.query("fix_random_seed", fix_random_seed);
11  pp_erf.query("random_seed", random_seed);
12  }
13  const std::uint64_t ic_pert_seed = fix_random_seed
14  ? std::uint64_t(1024)
15  : ((random_seed >= 0) ? static_cast<std::uint64_t>(random_seed) : std::uint64_t(0));
16  constexpr int temperature_hash_comp = 0;
17 
18  Real rho_0 = amrex::Real(0); pp_prob.query("rho_0", rho_0);
19  Real T_0 = amrex::Real(0); pp_prob.query("T_0", T_0);
20  Real A_0 = amrex::Real(1); pp_prob.query("A_0", A_0);
21  Real KE_0 = amrex::Real(0.1); pp_prob.query("KE_0", KE_0);
22  Real rhoKE_0 = -1; pp_prob.query("rhoKE_0", rhoKE_0);
23 
24  Real KE_decay_height = -1; pp_prob.query("KE_decay_height", KE_decay_height);
25  Real KE_decay_order = 1; pp_prob.query("KE_decay_order", KE_decay_order);
26 
27  // random initial perturbations (legacy code)
28  Real T_0_Pert_Mag = amrex::Real(0); pp_prob.query("T_0_Pert_Mag", T_0_Pert_Mag);
29  bool pert_rhotheta = true; pp_prob.query("pert_rhotheta", pert_rhotheta);
30 
31  // divergence-free initial perturbations
32  Real pert_deltaU = amrex::Real(0); pp_prob.query("pert_deltaU", pert_deltaU);
33  Real pert_deltaV = amrex::Real(0); pp_prob.query("pert_deltaV", pert_deltaV);
34  Real pert_ref_height = amrex::Real(100.0); pp_prob.query("pert_ref_height", pert_ref_height);
35 
36  // sinusoidal perturbations for regression tests. pert_periods_T defaults to
37  // 5 to match pert_periods_U/V in ERF_InitCustomPertVels_ABL.H: a zero period
38  // would make cos(cval*(x-xc)) identically one, i.e. a uniform warm bias
39  // rather than a zero-mean perturbation.
40  Real pert_deltaT = amrex::Real(0); pp_prob.query("pert_deltaT", pert_deltaT);
41 
42  // Optional warm bubble, made as WRF's idealized fire initialization makes it
43  // (module_initialize_fire.F: delt_perturbation, x/y/zrad_perturbation, hght_perturbation):
44  // theta += bubble_dT cos^2(pi r / 2) for r = |((x-x_c)/x_r, (y-y_c)/y_r, (z-z_c)/z_r)| <= 1,
45  // with z the cell-center height z_cc (the same height the other perturbations here use).
46  // bubble_dT = 0 (the default) adds no bubble.
47  Real bubble_dT = amrex::Real(0);
48  const bool bubble_dT_given = pp_prob.query("bubble_dT", bubble_dT);
49  Real bubble_x_c = amrex::Real(0); pp_prob.query("bubble_x_c", bubble_x_c);
50  Real bubble_y_c = amrex::Real(0); pp_prob.query("bubble_y_c", bubble_y_c);
51  Real bubble_z_c = amrex::Real(0); pp_prob.query("bubble_z_c", bubble_z_c);
52  Real bubble_x_r = amrex::Real(0); pp_prob.query("bubble_x_r", bubble_x_r);
53  Real bubble_y_r = amrex::Real(0); pp_prob.query("bubble_y_r", bubble_y_r);
54  Real bubble_z_r = amrex::Real(0); pp_prob.query("bubble_z_r", bubble_z_r);
55  const bool add_bubble = (bubble_dT != amrex::Real(0));
56  // Report once per level: the tile holding the level's lowest domain corner prints it.
57  // A refined level whose grids do not cover that corner gets the bubble without the line
58  // (this block sees only its own tile, not the level's BoxArray).
59  const bool bubble_reporter = bx.contains(geomdata.Domain().smallEnd());
60  if (add_bubble) {
62  std::isfinite(bubble_x_c) && std::isfinite(bubble_y_c) && std::isfinite(bubble_z_c),
63  "prob.bubble_dT and prob.bubble_x_c, bubble_y_c, bubble_z_c must be finite numbers");
65  std::isfinite(bubble_x_r) && std::isfinite(bubble_y_r) && std::isfinite(bubble_z_r),
66  "prob.bubble_dT needs positive, finite prob.bubble_x_r, bubble_y_r and bubble_z_r");
67  if (bubble_reporter) {
68  amrex::AllPrint() << "Level " << lev << ": adding a warm bubble prob.bubble_dT = " << bubble_dT
69  << " K at (" << bubble_x_c << ", " << bubble_y_c << ", " << bubble_z_c
70  << ") m with radii (" << bubble_x_r << ", " << bubble_y_r << ", "
71  << bubble_z_r << ") m, "
72  << (sc.fixed_density[lev] ? "at the fixed density" : "at constant pressure")
73  << std::endl;
74  }
75  } else {
76  // The bubble keys mean nothing without bubble_dT: stop if it was never set, warn if
77  // it was set to zero (the bubble switched off on purpose).
78  const bool bubble_keys_given =
79  pp_prob.contains("bubble_x_c") || pp_prob.contains("bubble_y_c") ||
80  pp_prob.contains("bubble_z_c") || pp_prob.contains("bubble_x_r") ||
81  pp_prob.contains("bubble_y_r") || pp_prob.contains("bubble_z_r");
82  if (bubble_keys_given) {
83  if (!bubble_dT_given) {
84  amrex::Abort("prob.bubble_x_c/y_c/z_c/x_r/y_r/z_r are set but prob.bubble_dT is not: "
85  "set prob.bubble_dT (the bubble's theta excess in K) or remove them");
86  } else if (bubble_reporter) {
87  amrex::AllPrint() << "WARNING: prob.bubble_dT = 0, so the prob.bubble_* centre and "
88  << "radii are not used" << std::endl;
89  }
90  }
91  }
92  // Under a fixed-in-time density (anelastic) only rho*theta is perturbed, so the bubble
93  // is a theta excess at that density. Otherwise (compressible or pseudo-incompressible, which
94  // evolve the density) it is made at constant pressure, as WRF makes it (theta raised,
95  // density recomputed from the unchanged pressure).
96  const bool bubble_fixed_density = (sc.fixed_density[lev] != 0);
97  Real pert_periods_T = amrex::Real(5.0); pp_prob.query("pert_periods_T", pert_periods_T);
98 
99  // Capture by value for GPU
100  const Real dx = geomdata.CellSize(0);
101  const Real dy = geomdata.CellSize(1);
102  const Real prob_lo_x = geomdata.ProbLo(0);
103  const Real prob_lo_y = geomdata.ProbLo(1);
104  const Real prob_lo_z = phys_zlo(geomdata, lev); // physical, not the computational, bottom
105  const Real prob_hi_x = geomdata.ProbHi(0);
106  const Real prob_hi_y = geomdata.ProbHi(1);
107  const Real prob_hi_z = phys_zhi(geomdata, lev); // physical, not the computational, top
108 
109  // Define a point (xc,yc,zc) at the center of the domain
110  const Real xc = myhalf * (prob_lo_x + prob_hi_x);
111  const Real yc = myhalf * (prob_lo_y + prob_hi_y);
112  const Real zc = myhalf * (prob_lo_z + prob_hi_z);
113 
114  // Sinusoidal perturbation wavenumber and amplitude factor. These mirror
115  // the divergence-free velocity perturbations in ERF_InitCustomPertVels_ABL.H
116  // so that tfac*damp*z peaks at pert_deltaT when z = pert_ref_height.
117  // pert_ref_height <= 0 is used elsewhere in this file to mean "no
118  // perturbations", so guard the division: an infinite tfac would meet a zero
119  // damp inside the kernel and yield NaN under amrex.fpe_trap_invalid.
120  const bool add_sinusoidal_T = (pert_deltaT != amrex::Real(0)) &&
121  (pert_ref_height > amrex::Real(0));
122  const Real cval = pert_periods_T * two * PI / (prob_hi_x - prob_lo_x);
123  const Real tfac = add_sinusoidal_T
124  ? pert_deltaT * std::exp(myhalf) / pert_ref_height
125  : amrex::Real(0);
126 
127  const bool use_moisture = (sc.moisture_type != MoistureType::None);
128  const Real rdOcp = sc.rdOcp;
129 
130  if (KE_decay_height > 0 &&
131  state_pert.nComp() > RhoKE_comp) {
132  amrex::Print() << "Initial KE profile (order " << KE_decay_order
133  << ") will extend up to " << KE_decay_height
134  << std::endl;
135  }
136 
137 #ifndef AMREX_USE_GPU
138  if (pert_ref_height > 0) {
139  if (T_0_Pert_Mag != amrex::Real(0)) {
140  if (pert_rhotheta) {
141  amrex::Print() << "Adding random rho*theta perturbations" << std::endl;
142  } else {
143  amrex::Print() << "Adding random theta perturbations" << std::endl;
144  }
145  }
146  if (add_sinusoidal_T) {
147  amrex::Print() << "Adding sinusoidal temperature perturbations "
148  << pert_deltaT << " over " << pert_periods_T
149  << " periods" << std::endl;
150  }
151  }
152  // The sinusoidal temperature perturbation is carried entirely by the density
153  // perturbation, which ERF_InitCustomPertState.cpp drops when the level uses a
154  // fixed-in-time density (implied by a non-FullyCompressible erf.compressibility_type). Say so rather than fail
155  // silently, since the companion velocity perturbations still apply.
156  if (add_sinusoidal_T && sc.fixed_density[lev]) {
157  amrex::Print() << "WARNING: prob.pert_deltaT has no effect at level " << lev
158  << " because fixed_density is set there" << std::endl;
159  }
160 #endif
161 
162  ParallelForRNG(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept
163  {
164  const Real x = prob_lo_x + (i + myhalf) * dx;
165  const Real y = prob_lo_y + (j + myhalf) * dy;
166  const Real z = z_cc(i,j,k);
167  const Real z_agl = z - erf_prob_heights::z_ground_cc(i,j,z_sfc_nd); // height above the ground
168 
169  const Real r = std::sqrt((x-xc)*(x-xc) + (y-yc)*(y-yc) + (z-zc)*(z-zc));
170 
171  // Add temperature perturbations
172  if ((z_agl <= pert_ref_height) && (T_0_Pert_Mag != amrex::Real(0))) {
173  Real rand_double;
174  if (deterministic_ic_pert) {
175  rand_double = erf_hash_rng::hash_uniform(
176  i, j, k, temperature_hash_comp, lev, ic_pert_seed);
177  } else {
178  rand_double = amrex::Random(engine); // Between zero and one
179  }
180  state_pert(i, j, k, RhoTheta_comp) = (rand_double*amrex::Real(2) - amrex::Real(1))*T_0_Pert_Mag;
181  if (!pert_rhotheta) {
182  // we're perturbing theta, not rho*theta
183  state_pert(i, j, k, RhoTheta_comp) *= r_hse(i,j,k);
184  }
185  }
186 
187  // Warm bubble (added to any random perturbation above)
188  if (add_bubble) {
189  const Real rx = (x - bubble_x_c) / bubble_x_r;
190  const Real ry = (y - bubble_y_c) / bubble_y_r;
191  const Real rz = (z - bubble_z_c) / bubble_z_r;
192  const Real rr = std::sqrt(rx*rx + ry*ry + rz*rz);
193  if (rr <= amrex::Real(1)) {
194  const Real cb = std::cos(myhalf * PI * rr);
195  const Real dtheta = bubble_dT * cb * cb;
196  const Real rho = state(i,j,k,Rho_comp);
197  const Real rhotheta = state(i,j,k,RhoTheta_comp);
198  if (bubble_fixed_density) {
199  state_pert(i, j, k, RhoTheta_comp) += rho * dtheta;
200  } else {
201  // The pressure is a function of rho*theta and qv only, so keeping both
202  // keeps the pressure: the density drops to rho*theta / (theta + dtheta).
203  const Real rho_new = rhotheta / (rhotheta / rho + dtheta);
204  state_pert(i, j, k, Rho_comp) += rho_new - rho;
205  if (use_moisture) {
206  // keep qv = RhoQ1/rho, and so the pressure, as the density changes
207  state_pert(i, j, k, RhoQ1_comp) += (rho_new - rho) * state(i,j,k,RhoQ1_comp) / rho;
208  }
209  }
210  }
211  }
212 
213  // Sinusoidal temperature perturbation for regression tests. Unlike the
214  // random branch above, this is a pure function of position, so the initial
215  // state does not depend on the box decomposition, the MPI rank count, or
216  // the OpenMP tile size -- which is what a bitwise gold-file comparison
217  // requires.
218  //
219  // The perturbation is isobaric: T is perturbed at fixed pressure, so it is
220  // carried by the density perturbation while rho*theta stays unchanged.
221  // Because P = P(rho*theta, qv), holding P fixed also requires qv to be
222  // unchanged, so RhoQ1 has to be rescaled to track the new density --
223  // otherwise qv = RhoQ1/rho drifts and drags the pressure along with it.
224  //
225  // ERF_InitCustomPert_SDMCongestus3D.H does the same. Leaving RhoTheta_comp
226  // alone keeps any random perturbation written by the T_0_Pert_Mag branch
227  // above -- but setting both knobs does perturb rho*theta, and the result is
228  // then no longer isobaric.
229  if (add_sinusoidal_T) {
230  const Real zl = z_agl / pert_ref_height;
231  const Real damp = std::exp(-myhalf * zl * zl);
232 
233  const Real rho = state(i,j,k,Rho_comp);
234  const Real rhotheta = state(i,j,k,RhoTheta_comp);
235  const Real qv = (use_moisture) ? state(i,j,k,RhoQ1_comp) / rho : amrex::Real(0);
236 
237  const Real Told = getTgivenRandRTh(rho,rhotheta,qv);
238  const Real P = getPgivenRTh(rhotheta,qv);
239 
240  const Real Tnew = Told + tfac * damp * z_agl * std::cos(cval * (x - xc));
241  const Real theta_new = getThgivenTandP(Tnew,P,rdOcp);
242  const Real rho_new = getRhogivenThetaPress(theta_new,P,rdOcp,qv);
243 
244  state_pert(i, j, k, Rho_comp) += rho_new - rho;
245  if (use_moisture) {
246  // Keep qv, and therefore P, fixed as the density changes.
247  state_pert(i, j, k, RhoQ1_comp) += (rho_new - rho) * qv;
248  }
249  }
250 
251  // Set scalar = A_0*exp(-10r^2), where r is distance from center of domain
252  state_pert(i, j, k, RhoScalar_comp) = A_0 * std::exp(-amrex::Real(10.)*r*r);
253 
254  // Set an initial value for SGS KE
255  //
256  // KE_decay_height is a depth of turbulence above the ground, so the profile
257  // is a function of height above the terrain surface, not of absolute z. Over
258  // terrain higher than KE_decay_height the latter would clamp the decay factor
259  // to its floor at the ground -- exactly backwards. On a flat mesh this is the
260  // height above geometry.prob_lo[2]. Under EB, z_cc is already measured
261  // from the EB surface, so the ground is at zero there (see z_sfc_nd). Matches
262  // the surface height used by SurfaceLayer::init_tke_from_ustar.
263  if (state_pert.nComp() > RhoKE_comp) {
264  // Deardorff
265  if (rhoKE_0 > 0) {
266  state_pert(i, j, k, RhoKE_comp) = rhoKE_0;
267  } else {
268  state_pert(i, j, k, RhoKE_comp) = r_hse(i,j,k) * KE_0;
269  }
270  if (KE_decay_height > 0) {
271  // scale initial SGS kinetic energy with height
272  state_pert(i, j, k, RhoKE_comp) *= amrex::max(
273  std::pow(1 - amrex::min(z_agl/KE_decay_height,amrex::Real(1)), KE_decay_order),
274  amrex::Real(1e-12));
275  }
276  }
277  });
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getRhogivenThetaPress(const amrex::Real th, const amrex::Real p, const amrex::Real rdOcp, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:96
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getTgivenRandRTh(const amrex::Real rho, const amrex::Real rhotheta, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:46
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getThgivenTandP(const amrex::Real T, const amrex::Real P, const amrex::Real rdOcp)
Definition: ERF_EOS.H:18
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getPgivenRTh(const amrex::Real rhotheta, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:81
#define RhoScalar_comp
Definition: ERF_IndexDefines.H:65
#define Rho_comp
Definition: ERF_IndexDefines.H:61
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:62
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:78
#define RhoKE_comp
Definition: ERF_IndexDefines.H:63
Real bubble_x_c
Definition: ERF_InitCustomPert_ABL.H:49
const bool bubble_dT_given
Definition: ERF_InitCustomPert_ABL.H:48
const Real prob_lo_z
Definition: ERF_InitCustomPert_ABL.H:104
const Real prob_lo_y
Definition: ERF_InitCustomPert_ABL.H:103
Real bubble_z_c
Definition: ERF_InitCustomPert_ABL.H:51
Real bubble_y_r
Definition: ERF_InitCustomPert_ABL.H:53
int deterministic_ic_pert
Definition: ERF_InitCustomPert_ABL.H:4
Real bubble_x_r
Definition: ERF_InitCustomPert_ABL.H:52
Real T_0_Pert_Mag
Definition: ERF_InitCustomPert_ABL.H:28
const bool add_sinusoidal_T
Definition: ERF_InitCustomPert_ABL.H:120
Real pert_ref_height
Definition: ERF_InitCustomPert_ABL.H:34
const bool use_moisture
Definition: ERF_InitCustomPert_ABL.H:127
Real KE_0
Definition: ERF_InitCustomPert_ABL.H:21
const Real dy
Definition: ERF_InitCustomPert_ABL.H:101
Real rho_0
Definition: ERF_InitCustomPert_ABL.H:18
const Real zc
Definition: ERF_InitCustomPert_ABL.H:112
const Real rdOcp
Definition: ERF_InitCustomPert_ABL.H:128
Real bubble_z_r
Definition: ERF_InitCustomPert_ABL.H:54
Real rhoKE_0
Definition: ERF_InitCustomPert_ABL.H:22
const Real yc
Definition: ERF_InitCustomPert_ABL.H:111
ParmParse pp_prob("prob")
const bool bubble_reporter
Definition: ERF_InitCustomPert_ABL.H:59
Real bubble_dT
Definition: ERF_InitCustomPert_ABL.H:47
const Real prob_lo_x
Definition: ERF_InitCustomPert_ABL.H:102
const bool bubble_fixed_density
Definition: ERF_InitCustomPert_ABL.H:96
constexpr int temperature_hash_comp
Definition: ERF_InitCustomPert_ABL.H:16
long random_seed
Definition: ERF_InitCustomPert_ABL.H:6
Real T_0
Definition: ERF_InitCustomPert_ABL.H:19
Real pert_deltaV
Definition: ERF_InitCustomPert_ABL.H:33
const Real prob_hi_y
Definition: ERF_InitCustomPert_ABL.H:106
const std::uint64_t ic_pert_seed
Definition: ERF_InitCustomPert_ABL.H:13
const Real tfac
Definition: ERF_InitCustomPert_ABL.H:123
const Real prob_hi_x
Definition: ERF_InitCustomPert_ABL.H:105
const Real cval
Definition: ERF_InitCustomPert_ABL.H:122
Real KE_decay_order
Definition: ERF_InitCustomPert_ABL.H:25
Real pert_deltaU
Definition: ERF_InitCustomPert_ABL.H:32
const Real prob_hi_z
Definition: ERF_InitCustomPert_ABL.H:107
Real KE_decay_height
Definition: ERF_InitCustomPert_ABL.H:24
const bool add_bubble
Definition: ERF_InitCustomPert_ABL.H:55
bool pert_rhotheta
Definition: ERF_InitCustomPert_ABL.H:29
Real pert_periods_T
Definition: ERF_InitCustomPert_ABL.H:97
int fix_random_seed
Definition: ERF_InitCustomPert_ABL.H:5
Real A_0
Definition: ERF_InitCustomPert_ABL.H:20
Real bubble_y_c
Definition: ERF_InitCustomPert_ABL.H:50
const Real xc
Definition: ERF_InitCustomPert_ABL.H:110
Real pert_deltaT
Definition: ERF_InitCustomPert_ABL.H:40
ParallelForRNG(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine &engine) noexcept { const Real x=prob_lo_x+(i+myhalf) *dx;const Real y=prob_lo_y+(j+myhalf) *dy;const Real z=z_cc(i, j, k);const Real z_agl=z - erf_prob_heights::z_ground_cc(i, j, z_sfc_nd);const Real r=std::sqrt((x-xc) *(x-xc)+(y-yc) *(y-yc)+(z-zc) *(z-zc));if((z_agl<=pert_ref_height) &&(T_0_Pert_Mag !=amrex::Real(0))) { Real rand_double;if(deterministic_ic_pert) { rand_double=erf_hash_rng::hash_uniform(i, j, k, temperature_hash_comp, lev, ic_pert_seed);} else { rand_double=amrex::Random(engine);} state_pert(i, j, k, RhoTheta_comp)=(rand_double *amrex::Real(2) - amrex::Real(1)) *T_0_Pert_Mag;if(!pert_rhotheta) { state_pert(i, j, k, RhoTheta_comp) *=r_hse(i, j, k);} } if(add_bubble) { const Real rx=(x - bubble_x_c)/bubble_x_r;const Real ry=(y - bubble_y_c)/bubble_y_r;const Real rz=(z - bubble_z_c)/bubble_z_r;const Real rr=std::sqrt(rx *rx+ry *ry+rz *rz);if(rr<=amrex::Real(1)) { const Real cb=std::cos(myhalf *PI *rr);const Real dtheta=bubble_dT *cb *cb;const Real rho=state(i, j, k, Rho_comp);const Real rhotheta=state(i, j, k, RhoTheta_comp);if(bubble_fixed_density) { state_pert(i, j, k, RhoTheta_comp)+=rho *dtheta;} else { const Real rho_new=rhotheta/(rhotheta/rho+dtheta);state_pert(i, j, k, Rho_comp)+=rho_new - rho;if(use_moisture) { state_pert(i, j, k, RhoQ1_comp)+=(rho_new - rho) *state(i, j, k, RhoQ1_comp)/rho;} } } } if(add_sinusoidal_T) { const Real zl=z_agl/pert_ref_height;const Real damp=std::exp(-myhalf *zl *zl);const Real rho=state(i, j, k, Rho_comp);const Real rhotheta=state(i, j, k, RhoTheta_comp);const Real qv=(use_moisture) ? state(i, j, k, RhoQ1_comp)/rho :amrex::Real(0);const Real Told=getTgivenRandRTh(rho, rhotheta, qv);const Real P=getPgivenRTh(rhotheta, qv);const Real Tnew=Told+tfac *damp *z_agl *std::cos(cval *(x - xc));const Real theta_new=getThgivenTandP(Tnew, P, rdOcp);const Real rho_new=getRhogivenThetaPress(theta_new, P, rdOcp, qv);state_pert(i, j, k, Rho_comp)+=rho_new - rho;if(use_moisture) { state_pert(i, j, k, RhoQ1_comp)+=(rho_new - rho) *qv;} } state_pert(i, j, k, RhoScalar_comp)=A_0 *std::exp(-amrex::Real(10.) *r *r);if(state_pert.nComp() > RhoKE_comp) { if(rhoKE_0 > 0) { state_pert(i, j, k, RhoKE_comp)=rhoKE_0;} else { state_pert(i, j, k, RhoKE_comp)=r_hse(i, j, k) *KE_0;} if(KE_decay_height > 0) { state_pert(i, j, k, RhoKE_comp) *=amrex::max(std::pow(1 - amrex::min(z_agl/KE_decay_height, amrex::Real(1)), KE_decay_order), amrex::Real(1e-12));} } })
const Real dx
Definition: ERF_InitCustomPert_ABL.H:100
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(axis >=0 &&axis< AMREX_SPACEDIM, "prob.axis must be 0, 1 or 2")
constexpr amrex::Real two
Definition: ERF_NumericalConstants.H:38
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
constexpr amrex::Real PI
Definition: ERF_NumericalConstants.H:46
@ None
Definition: ERF_LSM_Types.H:6
@ P
Definition: ERF_IndexDefines.H:221
@ rho
Definition: ERF_Kessler.H:25
@ qv
Definition: ERF_Kessler.H:31
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real hash_uniform(int i, int j, int k, int comp, int lev, std::uint64_t seed) noexcept
Definition: ERF_HashRNG.H:68
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real z_ground_cc(int i, int j, amrex::Array4< amrex::Real const > const &z_sfc_nd) noexcept
Definition: ERF_ProbHeights.H:49
real(c_double), parameter cb
Definition: ERF_module_model_constants.F90:49
real(c_double), private rr
Definition: ERF_module_mp_morr_two_moment.F90:224