ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_SlowRhsPre.cpp File Reference
#include "AMReX_MultiFab.H"
#include "AMReX_iMultiFab.H"
#include "AMReX_ArrayLim.H"
#include "AMReX_BCRec.H"
#include "AMReX_GpuContainers.H"
#include "AMReX_GpuPrint.H"
#include "ERF_TI_slow_headers.H"
#include "ERF_EOS.H"
#include "ERF_Utils.H"
#include "ERF_Diffusion.H"
#include "ERF_EBAdvection.H"
#include "ERF_EB.H"
#include "ERF_SurfaceLayer.H"
Include dependency graph for ERF_SlowRhsPre.cpp:

Functions

void erf_slow_rhs_pre (int level, int finest_level, int nrk, Real dt, Vector< MultiFab > &S_rhs, Vector< MultiFab > &S_old, Vector< MultiFab > &S_data, const MultiFab &S_prim, const MultiFab &qt, MultiFab &avg_xmom, MultiFab &avg_ymom, MultiFab &avg_zmom, const MultiFab &xvel, const MultiFab &yvel, const MultiFab &zvel, std::unique_ptr< MultiFab > &z_t_mf, const MultiFab &cc_src, const MultiFab &xmom_src, const MultiFab &ymom_src, const MultiFab &zmom_src, const MultiFab &buoyancy, const MultiFab *zmom_crse_rhs, Vector< std::unique_ptr< MultiFab >> &Tau_lev, Vector< std::unique_ptr< MultiFab >> &Tau_corr_lev, Vector< Vector< std::unique_ptr< MultiFab >>> &Tau_EB, MultiFab *SmnSmn, MultiFab *eddyDiffs, MultiFab *Hfx1, MultiFab *Hfx2, MultiFab *Hfx3, MultiFab *Q1fx1, MultiFab *Q1fx2, MultiFab *Q1fx3, MultiFab *Q2fx3, MultiFab *Diss, MultiFab *Hfx3_EB, const Geometry geom, const SolverChoice &solverChoice, std::unique_ptr< SurfaceLayer > &SurfLayer, const Gpu::DeviceVector< BCRec > &domain_bcs_type_d, const Vector< BCRec > &domain_bcs_type_h, const MultiFab &z_phys_nd, const MultiFab &z_phys_cc, const MultiFab &ax, const MultiFab &ay, const MultiFab &az, const MultiFab &detJ, Gpu::DeviceVector< Real > &stretched_dz_d, Vector< MultiFab > &gradp, Vector< std::unique_ptr< MultiFab >> &mapfac, const eb_ &ebfact, YAFluxRegister *fr_as_crse, YAFluxRegister *fr_as_fine)
 

Function Documentation

◆ erf_slow_rhs_pre()

void erf_slow_rhs_pre ( int  level,
int  finest_level,
int  nrk,
Real  dt,
Vector< MultiFab > &  S_rhs,
Vector< MultiFab > &  S_old,
Vector< MultiFab > &  S_data,
const MultiFab &  S_prim,
const MultiFab &  qt,
MultiFab &  avg_xmom,
MultiFab &  avg_ymom,
MultiFab &  avg_zmom,
const MultiFab &  xvel,
const MultiFab &  yvel,
const MultiFab &  zvel,
std::unique_ptr< MultiFab > &  z_t_mf,
const MultiFab &  cc_src,
const MultiFab &  xmom_src,
const MultiFab &  ymom_src,
const MultiFab &  zmom_src,
const MultiFab &  buoyancy,
const MultiFab *  zmom_crse_rhs,
Vector< std::unique_ptr< MultiFab >> &  Tau_lev,
Vector< std::unique_ptr< MultiFab >> &  Tau_corr_lev,
Vector< Vector< std::unique_ptr< MultiFab >>> &  Tau_EB,
MultiFab *  SmnSmn,
MultiFab *  eddyDiffs,
MultiFab *  Hfx1,
MultiFab *  Hfx2,
MultiFab *  Hfx3,
MultiFab *  Q1fx1,
MultiFab *  Q1fx2,
MultiFab *  Q1fx3,
MultiFab *  Q2fx3,
MultiFab *  Diss,
MultiFab *  Hfx3_EB,
const Geometry  geom,
const SolverChoice solverChoice,
std::unique_ptr< SurfaceLayer > &  SurfLayer,
const Gpu::DeviceVector< BCRec > &  domain_bcs_type_d,
const Vector< BCRec > &  domain_bcs_type_h,
const MultiFab &  z_phys_nd,
const MultiFab &  z_phys_cc,
const MultiFab &  ax,
const MultiFab &  ay,
const MultiFab &  az,
const MultiFab &  detJ,
Gpu::DeviceVector< Real > &  stretched_dz_d,
Vector< MultiFab > &  gradp,
Vector< std::unique_ptr< MultiFab >> &  mapfac,
const eb_ ebfact,
YAFluxRegister *  fr_as_crse,
YAFluxRegister *  fr_as_fine 
)

Function for computing the slow RHS for the evolution equations for the density, potential temperature and momentum.

Parameters
[in]levellevel of resolution
[in]finest_levelfinest level of resolution
[in]nrkwhich RK stage
[in]dtslow time step
[out]S_rhsRHS computed here
[in]S_oldold-time solution – used only for anelastic
[in]S_datacurrent solution
[in]S_primprimitive variables (i.e. conserved variables divided by density)
[in,out]avg_xmom
[in,out]avg_ymom
[in,out]avg_zmom
[in]xvelx-component of velocity
[in]yvely-component of velocity
[in]zvelz-component of velocity
[in]z_t_mf rate of change of grid height – only relevant for moving terrain
[in]cc_srcsource terms for conserved variables
[in]xmom_srcsource terms for x-momentum
[in]ymom_srcsource terms for y-momentum
[in]zmom_srcsource terms for z-momentum
[in]buoyancybuoyancy source term for z-momentum
[in]zmom_crse_rhsupdate term from coarser level for z-momentum; non-zero on c/f boundary only
[in]Tau_levcomponents of stress tensor
[in]SmnSmnstrain rate magnitude
[in]eddyDiffsdiffusion coefficients for LES turbulence models
[in]Hfx3heat flux in z-dir
[in]Dissdissipation of turbulent kinetic energy
[in]geomContainer for geometric information
[in]solverChoiceContainer for solver parameters
[in]SurfLayerPointer to SurfaceLayer class for Monin-Obukhov Similarity Theory boundary condition
[in]domain_bcs_type_ddevice vector for domain boundary conditions
[in]domain_bcs_type_hhost vector for domain boundary conditions
[in]z_phys_ndheight coordinate at nodes
[in]axarea fractions on x-faces
[in]ayarea fractions on y-faces
[in]azarea fractions on z-faces
[in]detJJacobian of the metric transformation (= 1 if use_terrain_fitted_coords is false)
[in]gradppressure gradient
[in]mapfacmap factors
[in]ebfactEB factories for cell- and face-centered variables
[in,out]fr_as_crseYAFluxRegister at level l at level l / l+1 interface
[in,out]fr_as_fineYAFluxRegister at level l at level l-1 / l interface
117 {
118  BL_PROFILE_REGION("erf_slow_rhs_pre()");
119 
120  const BCRec* bc_ptr_d = domain_bcs_type_d.data();
121  const BCRec* bc_ptr_h = domain_bcs_type_h.data();
122 
123  DiffChoice dc = solverChoice.diffChoice;
124  TurbChoice tc = solverChoice.turbChoice[level];
125 
126  const MultiFab* t_mean_mf = nullptr;
127  if (SurfLayer) { t_mean_mf = SurfLayer->get_mac_avg(level,2); }
128 
129  const Box& domain = geom.Domain();
130  int klo = domain.smallEnd(2);
131  int khi = domain.bigEnd(2);
132 
133  const AdvType l_horiz_adv_type = solverChoice.advChoice.dycore_horiz_adv_type;
134  const AdvType l_vert_adv_type = solverChoice.advChoice.dycore_vert_adv_type;
135  const Real l_horiz_upw_frac = solverChoice.advChoice.dycore_horiz_upw_frac;
136  const Real l_vert_upw_frac = solverChoice.advChoice.dycore_vert_upw_frac;
137  const bool l_use_stretched_dz = (solverChoice.mesh_type == MeshType::StretchedDz);
138  const bool l_use_terrain_fitted_coords = (solverChoice.mesh_type == MeshType::VariableDz);
139  const bool l_moving_terrain = (solverChoice.terrain_type == TerrainType::MovingFittedMesh);
140  if (l_moving_terrain) AMREX_ALWAYS_ASSERT (l_use_stretched_dz || l_use_terrain_fitted_coords);
141 
142  const bool l_use_diff = ( (dc.molec_diff_type != MolecDiffType::None) ||
143  (tc.les_type != LESType::None) ||
144  (tc.rans_type != RANSType::None) ||
145  (tc.pbl_type != PBLType::None) );
146  const bool l_use_turb = tc.use_kturb;
147  const bool l_need_SmnSmn = tc.use_keqn;
148 
149  const Real l_vert_implicit_fac = (solverChoice.implicit_thermal_diffusion) ?
150  solverChoice.vert_implicit_fac[level][nrk] : zero;
151 
152  const bool l_use_moisture = (solverChoice.moisture_type != MoistureType::None);
153  const bool l_use_SurfLayer = (SurfLayer != nullptr);
154  bool l_apply_surface_layer_fluxes_in_diffusion = l_use_SurfLayer;
155  const bool l_rotate = (solverChoice.use_rotate_surface_flux);
156 
157  const bool l_anelastic = (solverChoice.anelastic[level] == 1);
158  const bool l_fixed_rho = (solverChoice.fixed_density[level] == 1);
159 
160  const bool l_reflux = ( (solverChoice.coupling_type == CouplingType::TwoWay) && (finest_level > 0) &&
161  ( (l_anelastic && nrk == 1) || (!l_anelastic && nrk == 2) ) );
162 
163  const bool l_use_eb = (solverChoice.terrain_type == TerrainType::EB);
164 
165  const GpuArray<Real, AMREX_SPACEDIM> dxInv = geom.InvCellSizeArray();
166  const Real* dx = geom.CellSize();
167 
168  // *****************************************************************************
169  // Combine external forcing terms
170  // *****************************************************************************
171  const Array<Real,AMREX_SPACEDIM> grav{zero, zero, -solverChoice.gravity};
172  const GpuArray<Real,AMREX_SPACEDIM> grav_gpu{grav[0], grav[1], grav[2]};
173 
174  // **************************************************************************************
175  // If doing advection with EB we need the extra values for tangential interpolation
176  // **************************************************************************************
177  if (l_use_eb) {
178  S_data[IntVars::xmom].FillBoundary(geom.periodicity());
179  S_data[IntVars::ymom].FillBoundary(geom.periodicity());
180  S_data[IntVars::zmom].FillBoundary(geom.periodicity());
181  }
182 
183  // *****************************************************************************
184  // Pre-computed quantities
185  // *****************************************************************************
186  int nvars = S_data[IntVars::cons].nComp();
187  const BoxArray& ba = S_data[IntVars::cons].boxArray();
188  const DistributionMapping& dm = S_data[IntVars::cons].DistributionMap();
189 
190  int nGhost = (l_use_eb) ? 2 : 1;
191  MultiFab Omega(convert(ba,IntVect(0,0,1)), dm, 1, nGhost);
192 
193  std::unique_ptr<MultiFab> expr;
194  std::unique_ptr<MultiFab> dflux_x;
195  std::unique_ptr<MultiFab> dflux_y;
196  std::unique_ptr<MultiFab> dflux_z;
197 
198  if (l_use_diff) {
199 #ifdef ERF_USE_EAMXX_SHOC
200  if (tc.uses_eamxx_shoc()) {
201  AMREX_ALWAYS_ASSERT(eamxx_shoc_lev != nullptr);
202  // SHOC either supplies host-applied vertical SGS coefficients or
203  // clears them so the host does not re-apply SHOC transport.
204  eamxx_shoc_lev->set_eddy_diffs();
205  }
206 #endif
207 #ifdef ERF_USE_NATIVE_SHOC
208  if (tc.uses_native_shoc()) {
209  AMREX_ALWAYS_ASSERT(native_shoc_lev != nullptr);
210  // Native SHOC always owns the scalar fluxes in state_update mode.
211  // When it also owns momentum stresses, we skip the generic
212  // SurfaceLayer call entirely so the host does not re-apply them.
213  native_shoc_lev->set_eddy_diffs();
214  }
215 #endif
216 
217  erf_make_tau_terms(level,nrk,domain_bcs_type_h,z_phys_nd,
218  S_data,xvel,yvel,zvel,
219  Tau_lev,Tau_corr_lev,
220  SmnSmn,eddyDiffs,geom,solverChoice,SurfLayer,
221  stretched_dz_d, detJ,mapfac, ax, ay, az, ebfact);
222 
223  IntVect ng(0,0,1);
224  dflux_x = std::make_unique<MultiFab>(convert(ba,IntVect(1,0,0)), dm, nvars, ng);
225  dflux_y = std::make_unique<MultiFab>(convert(ba,IntVect(0,1,0)), dm, nvars, ng);
226  dflux_z = std::make_unique<MultiFab>(convert(ba,IntVect(0,0,1)), dm, nvars, 0);
227 
228  bool surface_layer_handled = false;
229 #ifdef ERF_USE_EAMXX_SHOC
230  if (tc.uses_eamxx_shoc()) {
231  AMREX_ALWAYS_ASSERT(eamxx_shoc_lev != nullptr);
232  // EAMxx SHOC owns the overlapping lower-boundary fluxes here, so
233  // do not fall through to the generic SurfaceLayer path.
234  eamxx_shoc_lev->set_diff_stresses();
235  surface_layer_handled = true;
236  }
237 #endif
238 #ifdef ERF_USE_NATIVE_SHOC
239  if (tc.uses_native_shoc()) {
240  AMREX_ALWAYS_ASSERT(native_shoc_lev != nullptr);
241  if (native_shoc_lev->owns_scalar_surface_fluxes()) {
242  l_apply_surface_layer_fluxes_in_diffusion = false;
243  }
244  if (!native_shoc_lev->needs_host_surface_momentum_stresses()) {
245  surface_layer_handled = true;
246  }
247  }
248 #endif
249  if (!surface_layer_handled && l_use_SurfLayer) {
250  Vector<const MultiFab*> mfs = {&S_data[IntVars::cons], &xvel, &yvel, &zvel};
251  if (!l_use_eb) {
252  SurfLayer->impose_SurfaceLayer_bcs(level, mfs, Tau_lev,
253  Hfx1, Hfx2, Hfx3,
254  Q1fx1, Q1fx2, Q1fx3,
255  &z_phys_nd);
256 
257  //if (l_vert_implicit_fac > 0 && solverChoice.implicit_momentum_diffusion) {
258  // copy_surface_tau_for_implicit(Tau_lev, Tau_corr_lev);
259  //}
260  } else {
261  SurfLayer->impose_SurfaceLayer_bcs_EB(level, mfs, Tau_EB,
262  Hfx1, Hfx2, Hfx3_EB,
263  Q1fx1, Q1fx2, Q1fx3);
264  }
265  }
266  if (tc.uses_native_shoc() && native_shoc_lev && native_shoc_lev->owns_scalar_surface_fluxes()) {
267  // SHOC-owned scalar fluxes must not be reused by the host
268  // diffusion source, even if the host SurfaceLayer path was also
269  // evaluated for momentum stress ownership.
270  native_shoc_lev->set_diff_stresses();
271  }
272  } // l_use_diff
273 
274  // This is just cautionary to deal with grid boundaries that aren't domain boundaries
275  S_rhs[IntVars::zmom].setVal(0);
276 
277  // *****************************************************************************
278  // Define updates and fluxes in the current RK stage
279  // *****************************************************************************
280  // Cell-centered masks for EB (used for flux interpolation)
281  bool already_on_centroids = false;
282  Vector<iMultiFab> physbnd_mask;
283  physbnd_mask.resize(IntVars::NumTypes);
284  if (l_use_eb) {
285  physbnd_mask[IntVars::cons].define(S_data[IntVars::cons].boxArray(), S_data[IntVars::cons].DistributionMap(), 1, 1);
286  physbnd_mask[IntVars::cons].BuildMask(geom.Domain(), geom.periodicity(), 1, 1, 0, 1);
287  // physbnd_mask[IntVars::cons].FillBoundary(geom.periodicity());
288  for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
289  physbnd_mask[1+dir].define(S_data[1+dir].boxArray(), S_data[1+dir].DistributionMap(), 1, 1);
290  physbnd_mask[1+dir].BuildMask(geom.Domain(), geom.periodicity(), 1, 1, 0, 1);
291  // physbnd_mask[1+dir].FillBoundary(geom.periodicity());
292  }
293  }
294 
295 #ifdef _OPENMP
296 #pragma omp parallel if (Gpu::notInLaunchRegion())
297 #endif
298  {
299  BL_PROFILE("slow_rhs_making_omega");
300  for ( MFIter mfi(S_data[IntVars::cons],TileNoZ()); mfi.isValid(); ++mfi)
301  {
302  Box bx = mfi.tilebox();
303 
304  IntVect nGrowVect = (l_use_eb)
305  ? IntVect(AMREX_D_DECL(2, 2, 2)) : IntVect(AMREX_D_DECL(1, 1, 1));
306  Box gbxo = surroundingNodes(bx,2); gbxo.grow(nGrowVect);
307 
308  const Array4<const Real>& rho_u = S_data[IntVars::xmom].array(mfi);
309  const Array4<const Real>& rho_v = S_data[IntVars::ymom].array(mfi);
310  const Array4<const Real>& rho_w = S_data[IntVars::zmom].array(mfi);
311  const Array4< Real>& omega_arr = Omega.array(mfi);
312 
313  //
314  // Now create Omega with momentum (not velocity) with z_t subtracted if moving terrain
315  // ONLY if not doing anelastic + terrain -- in that case Omega will be defined coming
316  // out of the projection
317  //
318  if (!l_use_terrain_fitted_coords) {
319  ParallelFor(gbxo, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
320  omega_arr(i,j,k) = rho_w(i,j,k);
321  });
322 
323  } else {
324 
325  Box gbxo_lo = gbxo; gbxo_lo.setBig(2,domain.smallEnd(2));
326  int lo_z_face = domain.smallEnd(2);
327  if (gbxo_lo.smallEnd(2) <= lo_z_face) {
328  ParallelFor(gbxo_lo, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
329  omega_arr(i,j,k) = zero;
330  });
331  }
332  Box gbxo_hi = gbxo; gbxo_hi.setSmall(2,gbxo.bigEnd(2));
333  int hi_z_face = domain.bigEnd(2)+1;
334  if (gbxo_hi.bigEnd(2) >= hi_z_face) {
335  ParallelFor(gbxo_hi, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
336  omega_arr(i,j,k) = rho_w(i,j,k);
337  });
338  }
339 
340  const Array4<const Real>& z_nd = z_phys_nd.const_array(mfi);
341  const Array4<const Real>& mf_ux = mapfac[MapFacType::u_x]->const_array(mfi);
342  const Array4<const Real>& mf_vy = mapfac[MapFacType::v_y]->const_array(mfi);
343 
344  if (z_t_mf) { // Note we never do anelastic with moving terrain
345  Box gbxo_mid = gbxo; gbxo_mid.setSmall(2,1); gbxo_mid.setBig(2,gbxo.bigEnd(2)-1);
346  Array4<const Real> z_t = z_t_mf->array(mfi);
347  const Array4<const Real>& cell_data = S_data[IntVars::cons].array(mfi);
348  ParallelFor(gbxo_mid, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
349  // We define rho on the z-face the same way as in MomentumToVelocity/VelocityToMomentum
350  Real rho_at_face = myhalf * (cell_data(i,j,k,Rho_comp) + cell_data(i,j,k-1,Rho_comp));
351  omega_arr(i,j,k) = OmegaFromW(i,j,k,rho_w(i,j,k),
352  rho_u,rho_v,mf_ux,mf_vy,z_nd,dxInv) -
353  rho_at_face * z_t(i,j,k);
354  });
355  } else {
356  Box gbxo_mid = gbxo;
357  if (gbxo_mid.smallEnd(2) <= domain.smallEnd(2)) {
358  gbxo_mid.setSmall(2,1);
359  }
360  if (gbxo_mid.bigEnd(2) >= domain.bigEnd(2)+1) {
361  gbxo_mid.setBig(2,gbxo.bigEnd(2)-1);
362  }
363  ParallelFor(gbxo_mid, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
364  omega_arr(i,j,k) = OmegaFromW(i,j,k,rho_w(i,j,k),
365  rho_u,rho_v,mf_ux,mf_vy,z_nd,dxInv);
366  });
367  }
368  }
369  } // mfi
370  } // OMP
371 
372  // We need extra values of Omega in the vertical if grids are decomposed vertically
373  Omega.FillBoundary(geom.periodicity());
374 
375 #ifdef _OPENMP
376 #pragma omp parallel if (Gpu::notInLaunchRegion())
377 #endif
378  {
379  for ( MFIter mfi(S_data[IntVars::cons],TileNoZ()); mfi.isValid(); ++mfi)
380  {
381  Box bx = mfi.tilebox();
382  Box tbx = mfi.nodaltilebox(0);
383  Box tby = mfi.nodaltilebox(1);
384  Box tbz = mfi.nodaltilebox(2);
385 
386  // Boxes for momentum fluxes
387  Vector<Box> tbx_grown(AMREX_SPACEDIM);
388  Vector<Box> tby_grown(AMREX_SPACEDIM);
389  Vector<Box> tbz_grown(AMREX_SPACEDIM);
390  if (l_use_eb) {
391  for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
392  tbx_grown[dir] = tbx;
393  tby_grown[dir] = tby;
394  tbz_grown[dir] = tbz;
395  IntVect iv(1, 1, 1);
396  iv[dir] = 0;
397  tbx_grown[dir] = (tbx_grown[dir].growHi(dir,1)).grow(iv);
398  tby_grown[dir] = (tby_grown[dir].growHi(dir,1)).grow(iv);
399  tbz_grown[dir] = (tbz_grown[dir].growHi(dir,1)).grow(iv);
400  }
401  }
402 
403  // We don't compute a source term for z-momentum on the bottom or top domain boundary
404  if (tbz.smallEnd(2) == domain.smallEnd(2)) {
405  tbz.growLo(2,-1);
406  }
407  if (tbz.bigEnd(2) == domain.bigEnd(2)+1) {
408  tbz.growHi(2,-1);
409  }
410 
411  const Array4<const Real> & cell_data = S_data[IntVars::cons].array(mfi);
412  const Array4<const Real> & cell_prim = S_prim.array(mfi);
413  const Array4<Real> & cell_rhs = S_rhs[IntVars::cons].array(mfi);
414 
415  const Array4<const Real> & cell_old = S_old[IntVars::cons].array(mfi);
416 
417  const Array4<Real const>& xmom_src_arr = xmom_src.const_array(mfi);
418  const Array4<Real const>& ymom_src_arr = ymom_src.const_array(mfi);
419  const Array4<Real const>& zmom_src_arr = zmom_src.const_array(mfi);
420  const Array4<Real const>& buoyancy_arr = buoyancy.const_array(mfi);
421 
422  const Array4<Real const>& gpx_arr = gradp[GpVars::gpx].const_array(mfi);
423  const Array4<Real const>& gpy_arr = gradp[GpVars::gpy].const_array(mfi);
424  const Array4<Real const>& gpz_arr = gradp[GpVars::gpz].const_array(mfi);
425 
426  const Array4<Real const>& qt_arr = qt.const_array(mfi);
427 
428  const Array4<Real>& rho_u_old = S_old[IntVars::xmom].array(mfi);
429  const Array4<Real>& rho_v_old = S_old[IntVars::ymom].array(mfi);
430 
431  if (l_anelastic) {
432  // When anelastic we must reset these to 0 each RK step
433  avg_xmom[mfi].template setVal<RunOn::Device>(0,tbx);
434  avg_ymom[mfi].template setVal<RunOn::Device>(0,tby);
435  avg_zmom[mfi].template setVal<RunOn::Device>(0,tbz);
436  }
437 
438  Array4<Real> avg_xmom_arr = avg_xmom.array(mfi);
439  Array4<Real> avg_ymom_arr = avg_ymom.array(mfi);
440  Array4<Real> avg_zmom_arr = avg_zmom.array(mfi);
441 
442  const Array4<const Real> & u = xvel.array(mfi);
443  const Array4<const Real> & v = yvel.array(mfi);
444  const Array4<const Real> & w = zvel.array(mfi);
445 
446  const Array4<const Real>& rho_u = S_data[IntVars::xmom].array(mfi);
447  const Array4<const Real>& rho_v = S_data[IntVars::ymom].array(mfi);
448 
449  // Map factors
450  const Array4<const Real>& mf_mx = mapfac[MapFacType::m_x]->const_array(mfi);
451  const Array4<const Real>& mf_ux = mapfac[MapFacType::u_x]->const_array(mfi);
452  const Array4<const Real>& mf_vx = mapfac[MapFacType::v_x]->const_array(mfi);
453  const Array4<const Real>& mf_my = mapfac[MapFacType::m_y]->const_array(mfi);
454  const Array4<const Real>& mf_uy = mapfac[MapFacType::u_y]->const_array(mfi);
455  const Array4<const Real>& mf_vy = mapfac[MapFacType::v_y]->const_array(mfi);
456 
457  const Array4< Real>& omega_arr = Omega.array(mfi);
458 
459  Array4<const Real> z_t;
460  if (z_t_mf) {
461  z_t = z_t_mf->array(mfi);
462  } else {
463  z_t = Array4<const Real>{};
464  }
465 
466  const Array4<Real>& rho_u_rhs = S_rhs[IntVars::xmom].array(mfi);
467  const Array4<Real>& rho_v_rhs = S_rhs[IntVars::ymom].array(mfi);
468  const Array4<Real>& rho_w_rhs = S_rhs[IntVars::zmom].array(mfi);
469 
470  const Array4<Real const>& mu_turb = l_use_turb ? eddyDiffs->const_array(mfi) : Array4<const Real>{};
471 
472  // Terrain metrics
473  const Array4<const Real>& z_nd = z_phys_nd.const_array(mfi);
474  const Array4<const Real>& z_cc = z_phys_cc.const_array(mfi);
475 
476  // *****************************************************************************
477  // Define flux arrays for use in advection
478  // *****************************************************************************
479  std::array<FArrayBox,AMREX_SPACEDIM> flux;
480  std::array<FArrayBox,AMREX_SPACEDIM> flux_u;
481  std::array<FArrayBox,AMREX_SPACEDIM> flux_v;
482  std::array<FArrayBox,AMREX_SPACEDIM> flux_w;
483 
484  for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
485  if (!l_use_eb) {
486  flux[dir].resize(surroundingNodes(bx,dir),2,The_Async_Arena());
487  } else {
488  flux[dir].resize(surroundingNodes(bx,dir).grow(1),2,The_Async_Arena());
489  }
490  flux[dir].setVal<RunOn::Device>(0);
491  }
492  const GpuArray<const Array4<Real>, AMREX_SPACEDIM>
493  flx_arr{{AMREX_D_DECL(flux[0].array(), flux[1].array(), flux[2].array())}};
494 
495  // Define flux arrays for momentum variables (used only for EB now)
496  GpuArray<Array4<Real>, AMREX_SPACEDIM> flx_u_arr{};
497  GpuArray<Array4<Real>, AMREX_SPACEDIM> flx_v_arr{};
498  GpuArray<Array4<Real>, AMREX_SPACEDIM> flx_w_arr{};
499 
500  if (l_use_eb) {
501  for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
502  flux_u[dir].resize(tbx_grown[dir],1,The_Async_Arena());
503  flux_v[dir].resize(tby_grown[dir],1,The_Async_Arena());
504  flux_w[dir].resize(tbz_grown[dir],1,The_Async_Arena());
505  flux_u[dir].setVal<RunOn::Device>(0);
506  flux_v[dir].setVal<RunOn::Device>(0);
507  flux_w[dir].setVal<RunOn::Device>(0);
508  flx_u_arr[dir] = flux_u[dir].array();
509  flx_v_arr[dir] = flux_v[dir].array();
510  flx_w_arr[dir] = flux_w[dir].array();
511  }
512  }
513 
514  // *****************************************************************************
515  // Diffusive terms (pre-computed above)
516  // *****************************************************************************
517  // No terrain diffusion
518  Array4<Real> tau11,tau22,tau33;
519  Array4<Real> tau12,tau13,tau23;
520  if (Tau_lev[TauType::tau11]) {
521  tau11 = Tau_lev[TauType::tau11]->array(mfi); tau22 = Tau_lev[TauType::tau22]->array(mfi);
522  tau33 = Tau_lev[TauType::tau33]->array(mfi); tau12 = Tau_lev[TauType::tau12]->array(mfi);
523  tau13 = Tau_lev[TauType::tau13]->array(mfi); tau23 = Tau_lev[TauType::tau23]->array(mfi);
524  } else {
525  tau11 = Array4<Real>{}; tau22 = Array4<Real>{}; tau33 = Array4<Real>{};
526  tau12 = Array4<Real>{}; tau13 = Array4<Real>{}; tau23 = Array4<Real>{};
527  }
528  // Terrain diffusion
529  Array4<Real> tau21,tau31,tau32;
530  if (Tau_lev[TauType::tau21]) {
531  tau21 = Tau_lev[TauType::tau21]->array(mfi);
532  tau31 = Tau_lev[TauType::tau31]->array(mfi);
533  tau32 = Tau_lev[TauType::tau32]->array(mfi);
534  } else {
535  tau21 = Array4<Real>{}; tau31 = Array4<Real>{}; tau32 = Array4<Real>{};
536  }
537 
538  // EB surface layer fluxes
539  Array4<Real> u_tau_eb13, u_tau_eb23;
540  Array4<Real> v_tau_eb13, v_tau_eb23;
541  Array4<Real> w_tau_eb13, w_tau_eb23;
542  if (l_use_eb) {
543  EBChoice ebChoice = solverChoice.ebChoice;
545  u_tau_eb13 = Tau_EB[EBTauType::tau_eb13][EBGridType::xface]->array(mfi);
546  u_tau_eb23 = Tau_EB[EBTauType::tau_eb23][EBGridType::xface]->array(mfi);
547  v_tau_eb13 = Tau_EB[EBTauType::tau_eb13][EBGridType::yface]->array(mfi);
548  v_tau_eb23 = Tau_EB[EBTauType::tau_eb23][EBGridType::yface]->array(mfi);
549  w_tau_eb13 = Tau_EB[EBTauType::tau_eb13][EBGridType::zface]->array(mfi);
550  w_tau_eb23 = Tau_EB[EBTauType::tau_eb23][EBGridType::zface]->array(mfi);
551  }
552  }
553 
554  // Strain magnitude
555  Array4<Real> SmnSmn_a;
556  if (l_need_SmnSmn) {
557  SmnSmn_a = SmnSmn->array(mfi);
558  } else {
559  SmnSmn_a = Array4<Real>{};
560  }
561 
562  // *****************************************************************************
563  // Define updates in the RHS of continuity and potential temperature equations
564  // *****************************************************************************
565  bool l_eb_terrain_cc = false; // EB terrain on cell-centered grid
566  Array4<const int> mask_arr{};
567  Array4<const EBCellFlag> cfg_arr{};
568  Array4<const Real> ax_arr{};
569  Array4<const Real> ay_arr{};
570  Array4<const Real> az_arr{};
571  Array4<const Real> fcx_arr{};
572  Array4<const Real> fcy_arr{};
573  Array4<const Real> fcz_arr{};
574  Array4<const Real> detJ_arr{};
575  Array4<const Real> barea_arr{};
576  Array4<const Real> bcent_arr{};
577 
578  if (l_use_eb)
579  {
580  EBCellFlagFab const& cfg = (ebfact.get_const_factory())->getMultiEBCellFlagFab()[mfi];
581  cfg_arr = cfg.const_array();
582  if (cfg.getType(bx) == FabType::singlevalued) {
583  l_eb_terrain_cc = true;
584  ax_arr = (ebfact.get_const_factory())->getAreaFrac()[0]->const_array(mfi);
585  ay_arr = (ebfact.get_const_factory())->getAreaFrac()[1]->const_array(mfi);
586  az_arr = (ebfact.get_const_factory())->getAreaFrac()[2]->const_array(mfi);
587  fcx_arr = (ebfact.get_const_factory())->getFaceCent()[0]->const_array(mfi);
588  fcy_arr = (ebfact.get_const_factory())->getFaceCent()[1]->const_array(mfi);
589  fcz_arr = (ebfact.get_const_factory())->getFaceCent()[2]->const_array(mfi);
590  detJ_arr = (ebfact.get_const_factory())->getVolFrac().const_array(mfi);
591  mask_arr = physbnd_mask[IntVars::cons].const_array(mfi);
592  barea_arr = (ebfact.get_const_factory())->getBndryArea().const_array(mfi);
593  bcent_arr = (ebfact.get_const_factory())->getBndryCent().const_array(mfi);
594  } else {
595  ax_arr = ax.const_array(mfi);
596  ay_arr = ay.const_array(mfi);
597  az_arr = az.const_array(mfi);
598  detJ_arr = detJ.const_array(mfi);
599  }
600  } else {
601  ax_arr = ax.const_array(mfi);
602  ay_arr = ay.const_array(mfi);
603  az_arr = az.const_array(mfi);
604  detJ_arr = detJ.const_array(mfi);
605  }
606 
607  int icomp = RhoTheta_comp; int ncomp = 1;
608  if (!l_eb_terrain_cc){
609  AdvectionSrcForRho( bx, cell_rhs,
610  rho_u, rho_v, omega_arr, // these are being used to build the fluxes
611  avg_xmom_arr, avg_ymom_arr, avg_zmom_arr, // these are being defined from the fluxes
612  ax_arr, ay_arr, az_arr, detJ_arr,
613  dxInv, mf_mx, mf_my, mf_uy, mf_vx,
614  flx_arr, l_fixed_rho);
615  AdvectionSrcForScalars(bx, icomp, ncomp,
616  avg_xmom_arr, avg_ymom_arr, avg_zmom_arr,
617  cell_prim, cell_rhs,
618  detJ_arr, dxInv, mf_mx, mf_my,
619  l_horiz_adv_type, l_vert_adv_type,
620  l_horiz_upw_frac, l_vert_upw_frac,
621  flx_arr, domain, bc_ptr_h);
622  } else {
623  EBAdvectionSrcForRho(bx, cell_rhs,
624  rho_u, rho_v, omega_arr,
625  avg_xmom_arr, avg_ymom_arr, avg_zmom_arr,
626  mask_arr, cfg_arr,
627  ax_arr, ay_arr, az_arr,
628  fcx_arr, fcy_arr, fcz_arr, detJ_arr,
629  dxInv, mf_mx, mf_my, mf_uy, mf_vx,
630  flx_arr, l_fixed_rho,
631  already_on_centroids);
632  EBAdvectionSrcForScalars(bx, icomp, ncomp,
633  avg_xmom_arr, avg_ymom_arr, avg_zmom_arr,
634  cell_prim, cell_rhs,
635  mask_arr, cfg_arr, ax_arr, ay_arr, az_arr,
636  fcx_arr, fcy_arr, fcz_arr,
637  detJ_arr, dxInv, mf_mx, mf_my,
638  l_horiz_adv_type, l_vert_adv_type,
639  l_horiz_upw_frac, l_vert_upw_frac,
640  flx_arr, domain, bc_ptr_h,
641  already_on_centroids);
642  }
643 
644  if (l_use_diff) {
645  Array4<Real> diffflux_x = dflux_x->array(mfi);
646  Array4<Real> diffflux_y = dflux_y->array(mfi);
647  Array4<Real> diffflux_z = dflux_z->array(mfi);
648 
649  Array4<Real> hfx_x = Hfx1->array(mfi);
650  Array4<Real> hfx_y = Hfx2->array(mfi);
651  Array4<Real> hfx_z = Hfx3->array(mfi);
652  Array4<Real> hfx_EB{};
653  if (l_use_eb) {
654  hfx_EB = Hfx3_EB->array(mfi);
655  }
656 
657  Array4<Real> q1fx_x = (Q1fx1) ? Q1fx1->array(mfi) : Array4<Real>{};
658  Array4<Real> q1fx_y = (Q1fx2) ? Q1fx2->array(mfi) : Array4<Real>{};
659  Array4<Real> q1fx_z = (Q1fx3) ? Q1fx3->array(mfi) : Array4<Real>{};
660 
661  Array4<Real> q2fx_z = (Q2fx3) ? Q2fx3->array(mfi) : Array4<Real>{};
662  Array4<Real> diss = Diss->array(mfi);
663 
664  const Array4<const Real> tm_arr = t_mean_mf ? t_mean_mf->const_array(mfi) : Array4<const Real>{};
665 
666  // NOTE: No diffusion for continuity, so n starts at one
667  int n_start = RhoTheta_comp;
668  int n_comp = 1;
669 
670  // For l_vert_implicit_fac > 0, we scale the rho*theta contribution
671  // by (1 - implicit_fac) and add in the implicit contribution with
672  // ERF_Implicit.H
673  if (l_use_stretched_dz) {
674  DiffusionSrcForState_S(bx, domain, n_start, n_comp, u, v,
675  cell_data, cell_prim, cell_rhs,
676  diffflux_x, diffflux_y, diffflux_z,
677  stretched_dz_d, dxInv, SmnSmn_a,
678  mf_mx, mf_ux, mf_vx,
679  mf_my, mf_uy, mf_vy,
680  hfx_z, q1fx_z, q2fx_z, diss,
681  mu_turb, solverChoice, level,
682  tm_arr, grav_gpu, bc_ptr_d, l_apply_surface_layer_fluxes_in_diffusion, l_vert_implicit_fac);
683  } else if (l_use_terrain_fitted_coords) {
684  DiffusionSrcForState_T(bx, domain, n_start, n_comp, l_rotate, u, v,
685  cell_data, cell_prim, cell_rhs,
686  diffflux_x, diffflux_y, diffflux_z,
687  z_nd, z_cc, ax_arr, ay_arr, az_arr, detJ_arr,
688  dxInv, SmnSmn_a,
689  mf_mx, mf_ux, mf_vx,
690  mf_my, mf_uy, mf_vy,
691  hfx_x, hfx_y, hfx_z, q1fx_x, q1fx_y, q1fx_z, q2fx_z, diss,
692  mu_turb, solverChoice, level,
693  tm_arr, grav_gpu, bc_ptr_d, l_apply_surface_layer_fluxes_in_diffusion, l_vert_implicit_fac);
694  } else if (l_use_eb) {
695  DiffusionSrcForState_EB(bx, domain, n_start, n_comp, u, v,
696  cell_data, cell_prim, cell_rhs,
697  diffflux_x, diffflux_y, diffflux_z,
698  cfg_arr, ax_arr, ay_arr, az_arr, detJ_arr,
699  barea_arr, bcent_arr,
700  dx, dxInv,
701  hfx_z, q1fx_z, q2fx_z, hfx_EB,
702  mu_turb, solverChoice, level,
703  bc_ptr_d, l_apply_surface_layer_fluxes_in_diffusion);
704  } else {
705  DiffusionSrcForState_N(bx, domain, n_start, n_comp, u, v,
706  cell_data, cell_prim, cell_rhs,
707  diffflux_x, diffflux_y, diffflux_z,
708  dxInv, SmnSmn_a,
709  mf_mx, mf_ux, mf_vx,
710  mf_my, mf_uy, mf_vy,
711  hfx_z, q1fx_z, q2fx_z, diss,
712  mu_turb, solverChoice, level,
713  tm_arr, grav_gpu, bc_ptr_d, l_apply_surface_layer_fluxes_in_diffusion, l_vert_implicit_fac);
714  }
715  }
716 
717  const Array4<Real const>& source_arr = cc_src.const_array(mfi);
718  ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
719  {
720  cell_rhs(i,j,k,Rho_comp) += source_arr(i,j,k,Rho_comp);
721  cell_rhs(i,j,k,RhoTheta_comp) += source_arr(i,j,k,RhoTheta_comp);
722  });
723 
724  // If anelastic and in second RK stage, take average of old-time and new-time source
725  if ( l_anelastic && (nrk == 1) )
726  {
727  ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
728  {
729  cell_rhs(i,j,k, Rho_comp) *= myhalf;
730  cell_rhs(i,j,k,RhoTheta_comp) *= myhalf;
731 
732  cell_rhs(i,j,k, Rho_comp) += myhalf / dt * (cell_data(i,j,k, Rho_comp) - cell_old(i,j,k, Rho_comp));
733  cell_rhs(i,j,k,RhoTheta_comp) += myhalf / dt * (cell_data(i,j,k,RhoTheta_comp) - cell_old(i,j,k,RhoTheta_comp));
734  });
735  }
736 
737  // *****************************************************************************
738  // Define updates in the RHS of {x, y, z}-momentum equations
739  // *****************************************************************************
740  int lo_z_face = domain.smallEnd(2);
741  int hi_z_face = domain.bigEnd(2)+1;
742 
743  AdvectionSrcForMom(mfi, bx, tbx, tby, tbz, tbx_grown, tby_grown, tbz_grown,
744  rho_u_rhs, rho_v_rhs, rho_w_rhs,
745  cell_data, u, v, w,
746  rho_u, rho_v, omega_arr,
747  z_nd, ax_arr, ay_arr, az_arr,
748  detJ_arr, stretched_dz_d,
749  dxInv, mf_mx, mf_ux, mf_vx, mf_my, mf_uy, mf_vy,
750  l_horiz_adv_type, l_vert_adv_type,
751  l_horiz_upw_frac, l_vert_upw_frac,
752  solverChoice.mesh_type, solverChoice.terrain_type,
753  ebfact, flx_u_arr, flx_v_arr, flx_w_arr,
754  physbnd_mask, already_on_centroids,
755  lo_z_face, hi_z_face, domain, bc_ptr_h);
756 
757  if (l_use_diff) {
758  // Note: tau** were calculated with calls to
759  // ComputeStress[Cons|Var]Visc_[N|S|T] in which ConsVisc ("constant
760  // viscosity") means that there is no contribution from a
761  // turbulence model. However, whether this field truly is constant
762  // depends on whether MolecDiffType is Constant or ConstantAlpha.
763  if (!l_use_eb) {
764  DiffusionSrcForMom(tbx, tby, tbz,
765  rho_u_rhs, rho_v_rhs, rho_w_rhs,
766  tau11, tau22, tau33,
768  detJ_arr, stretched_dz_d, dxInv,
769  mf_mx, mf_ux, mf_vx,
770  mf_my, mf_uy, mf_vy,
771  l_use_stretched_dz,
772  l_use_terrain_fitted_coords);
773  } else {
774  DiffusionSrcForMom_EB(mfi, domain, tbx, tby, tbz,
775  rho_u_rhs, rho_v_rhs, rho_w_rhs,
776  u, v, w,
777  tau11, tau22, tau33,
778  tau12, tau13, tau23,
779  u_tau_eb13, u_tau_eb23, v_tau_eb13, v_tau_eb23, w_tau_eb13, w_tau_eb23,
780  dx, dxInv,
781  mf_mx, mf_ux, mf_vx,
782  mf_my, mf_uy, mf_vy,
783  solverChoice, ebfact, bc_ptr_d);
784  }
785  }
786 
787  auto abl_pressure_grad = solverChoice.abl_pressure_grad;
788 
789  ParallelFor(tbx, tby,
790  [=] AMREX_GPU_DEVICE (int i, int j, int k)
791  { // x-momentum equation
792 
793  // Note that gradp arrays now carry the map factor in them
794 
795  Real q = (l_use_moisture) ? myhalf * (qt_arr(i,j,k) + qt_arr(i-1,j,k)) : zero;
796 
797  rho_u_rhs(i, j, k) += (-gpx_arr(i,j,k) - abl_pressure_grad[0]) / (one + q) + xmom_src_arr(i,j,k);
798 
799  if (l_moving_terrain) {
800  Real h_zeta = Compute_h_zeta_AtIface(i, j, k, dxInv, z_nd);
801  rho_u_rhs(i, j, k) *= h_zeta;
802  }
803 
804  if ( l_anelastic && (nrk == 1) ) {
805  rho_u_rhs(i,j,k) *= myhalf;
806  rho_u_rhs(i,j,k) += myhalf / dt * (rho_u(i,j,k) - rho_u_old(i,j,k));
807  }
808  },
809  [=] AMREX_GPU_DEVICE (int i, int j, int k)
810  { // y-momentum equation
811 
812  // Note that gradp arrays now carry the map factor in them
813 
814  Real q = (l_use_moisture) ? myhalf * (qt_arr(i,j,k) + qt_arr(i,j-1,k)) : zero;
815 
816  rho_v_rhs(i, j, k) += (-gpy_arr(i,j,k) - abl_pressure_grad[1]) / (one + q) + ymom_src_arr(i,j,k);
817 
818  if (l_moving_terrain) {
819  Real h_zeta = Compute_h_zeta_AtJface(i, j, k, dxInv, z_nd);
820  rho_v_rhs(i, j, k) *= h_zeta;
821  }
822 
823  if ( l_anelastic && (nrk == 1) ) {
824  rho_v_rhs(i,j,k) *= myhalf;
825  rho_v_rhs(i,j,k) += myhalf / dt * (rho_v(i,j,k) - rho_v_old(i,j,k));
826  }
827  });
828 
829  // *****************************************************************************
830  // Zero out source terms for x- and y- momenta if at walls or inflow
831  // We need to do this -- even though we call the boundary conditions later --
832  // because the slow source is used to update the state in the fast interpolater.
833  // *****************************************************************************
834  if (bx.smallEnd(0) == domain.smallEnd(0)) {
835  Box lo_x_dom_face(bx); lo_x_dom_face.setBig(0,bx.smallEnd(0));
836  if (bc_ptr_h[BCVars::xvel_bc].lo(0) == ERFBCType::ext_dir) {
837  ParallelFor(lo_x_dom_face, [=] AMREX_GPU_DEVICE (int i, int j, int k) {
838  rho_u_rhs(i,j,k) = zero;
839  });
840  } else if (bc_ptr_h[BCVars::xvel_bc].lo(0) == ERFBCType::ext_dir_upwind) {
841  ParallelFor(lo_x_dom_face, [=] AMREX_GPU_DEVICE (int i, int j, int k) {
842  if (u(i,j,k) >= zero) {
843  rho_u_rhs(i,j,k) = zero;
844  }
845  });
846  }
847  }
848  if (bx.bigEnd(0) == domain.bigEnd(0)) {
849  Box hi_x_dom_face(bx); hi_x_dom_face.setSmall(0,bx.bigEnd(0)+1); hi_x_dom_face.setBig(0,bx.bigEnd(0)+1);
850  if (bc_ptr_h[BCVars::xvel_bc].hi(0) == ERFBCType::ext_dir) {
851  ParallelFor(hi_x_dom_face, [=] AMREX_GPU_DEVICE (int i, int j, int k) {
852  rho_u_rhs(i,j,k) = zero;
853  });
854  } else if (bc_ptr_h[BCVars::xvel_bc].hi(0) == ERFBCType::ext_dir_upwind) {
855  ParallelFor(hi_x_dom_face, [=] AMREX_GPU_DEVICE (int i, int j, int k) {
856  if (u(i,j,k) <= zero) {
857  rho_u_rhs(i,j,k) = zero;
858  }
859  });
860  }
861  }
862  if (bx.smallEnd(1) == domain.smallEnd(1)) {
863  Box lo_y_dom_face(bx); lo_y_dom_face.setBig(1,bx.smallEnd(1));
864  if (bc_ptr_h[BCVars::yvel_bc].lo(1) == ERFBCType::ext_dir) {
865  ParallelFor(lo_y_dom_face, [=] AMREX_GPU_DEVICE (int i, int j, int k) {
866  rho_v_rhs(i,j,k) = zero;
867  });
868  } else if (bc_ptr_h[BCVars::yvel_bc].lo(1) == ERFBCType::ext_dir_upwind) {
869  ParallelFor(lo_y_dom_face, [=] AMREX_GPU_DEVICE (int i, int j, int k) {
870  if (v(i,j,k) >= zero) {
871  rho_v_rhs(i,j,k) = zero;
872  }
873  });
874  }
875  }
876  if (bx.bigEnd(1) == domain.bigEnd(1)) {
877  Box hi_y_dom_face(bx); hi_y_dom_face.setSmall(1,bx.bigEnd(1)+1); hi_y_dom_face.setBig(1,bx.bigEnd(1)+1);
878  if (bc_ptr_h[BCVars::yvel_bc].hi(1) == ERFBCType::ext_dir) {
879  ParallelFor(hi_y_dom_face, [=] AMREX_GPU_DEVICE (int i, int j, int k) {
880  rho_v_rhs(i,j,k) = zero;
881  });
882  } else if (bc_ptr_h[BCVars::yvel_bc].hi(1) == ERFBCType::ext_dir_upwind) {
883  ParallelFor(hi_y_dom_face, [=] AMREX_GPU_DEVICE (int i, int j, int k) {
884  if (v(i,j,k) <= zero) {
885  rho_v_rhs(i,j,k) = zero;
886  }
887  });
888  }
889  }
890 
891  ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k)
892  { // z-momentum equation
893 
894  Real gpz = gpz_arr(i,j,k);
895 
896  Real q = (l_use_moisture) ? myhalf * (qt_arr(i,j,k) + qt_arr(i,j,k-1)) : zero;
897 
898  rho_w_rhs(i, j, k) += (-gpz - abl_pressure_grad[2] + buoyancy_arr(i,j,k)) / (one + q) + zmom_src_arr(i,j,k);
899 
900  if (l_moving_terrain) {
901  rho_w_rhs(i, j, k) *= myhalf * (detJ_arr(i,j,k) + detJ_arr(i,j,k-1));
902  }
903  });
904 
905  auto const lo = lbound(bx);
906  auto const hi = ubound(bx);
907 
908  // Note: the logic below assumes no tiling in z!
909  if (level > 0) {
910 
911  const Array4<const Real>& rho_w_rhs_crse = zmom_crse_rhs->const_array(mfi);
912 
913  Box b2d = bx; b2d.setRange(2,0);
914 
915  if (lo.z > klo) {
916  ParallelFor(b2d, [=] AMREX_GPU_DEVICE (int i, int j, int ) // bottom of box but not of domain
917  {
918  rho_w_rhs(i,j,lo.z) = rho_w_rhs_crse(i,j,lo.z);
919  });
920  }
921 
922  if (hi.z < khi+1) {
923  ParallelFor(b2d, [=] AMREX_GPU_DEVICE (int i, int j, int ) // top of box but not of domain
924  {
925  rho_w_rhs(i,j,hi.z+1) = rho_w_rhs_crse(i,j,hi.z+1);
926  });
927  }
928  }
929 
930  {
931  BL_PROFILE("slow_rhs_pre_fluxreg");
932  // We only add to the flux registers in the final RK step
933  // NOTE: for now we are only refluxing density not (rho theta) since the latter seems to introduce
934  // a problem at top and bottom boundaries
935  if (l_reflux) {
936  int strt_comp_reflux = (l_fixed_rho) ? 1 : 0;
937  int num_comp_reflux = 1;
938  if (level < finest_level) {
939  fr_as_crse->CrseAdd(mfi,
940  {{AMREX_D_DECL(&(flux[0]), &(flux[1]), &(flux[2]))}},
941  dx, dt, strt_comp_reflux, strt_comp_reflux, num_comp_reflux, RunOn::Device);
942  }
943  if (level > 0) {
944  fr_as_fine->FineAdd(mfi,
945  {{AMREX_D_DECL(&(flux[0]), &(flux[1]), &(flux[2]))}},
946  dx, dt, strt_comp_reflux, strt_comp_reflux, num_comp_reflux, RunOn::Device);
947  }
948 
949  } // two-way coupling
950  } // end profile
951  } // mfi
952  } // OMP
953 }
void AdvectionSrcForRho(const amrex::Box &bx, const amrex::Array4< amrex::Real > &src, const amrex::Array4< const amrex::Real > &rho_u, const amrex::Array4< const amrex::Real > &rho_v, const amrex::Array4< const amrex::Real > &omega, const amrex::Array4< amrex::Real > &avg_xmom, const amrex::Array4< amrex::Real > &avg_ymom, const amrex::Array4< amrex::Real > &avg_zmom, const amrex::Array4< const amrex::Real > &ax_arr, const amrex::Array4< const amrex::Real > &ay_arr, const amrex::Array4< const amrex::Real > &az_arr, const amrex::Array4< const amrex::Real > &detJ, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &mf_mx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy, const amrex::Array4< const amrex::Real > &mf_vx, const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_arr, const bool fixed_rho)
void AdvectionSrcForScalars(const amrex::Box &bx, const int icomp, const int ncomp, const amrex::Array4< const amrex::Real > &avg_xmom, const amrex::Array4< const amrex::Real > &avg_ymom, const amrex::Array4< const amrex::Real > &avg_zmom, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< amrex::Real > &src, const amrex::Array4< const amrex::Real > &vf_arr, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &mf_mx, const amrex::Array4< const amrex::Real > &mf_my, const AdvType horiz_adv_type, const AdvType vert_adv_type, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac, const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_arr, const amrex::Box &domain, const amrex::BCRec *bc_ptr_h)
void AdvectionSrcForMom(const amrex::MFIter &mfi, const amrex::Box &bx, const amrex::Box &bxx, const amrex::Box &bxy, const amrex::Box &bxz, const amrex::Vector< amrex::Box > &bxx_grown, const amrex::Vector< amrex::Box > &bxy_grown, const amrex::Vector< amrex::Box > &bxz_grown, const amrex::Array4< amrex::Real > &rho_u_rhs, const amrex::Array4< amrex::Real > &rho_v_rhs, const amrex::Array4< amrex::Real > &rho_w_rhs, const amrex::Array4< const amrex::Real > &rho, const amrex::Array4< const amrex::Real > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &w, const amrex::Array4< const amrex::Real > &rho_u, const amrex::Array4< const amrex::Real > &rho_v, const amrex::Array4< const amrex::Real > &Omega, const amrex::Array4< const amrex::Real > &z_nd, const amrex::Array4< const amrex::Real > &ax, const amrex::Array4< const amrex::Real > &ay, const amrex::Array4< const amrex::Real > &az, const amrex::Array4< const amrex::Real > &detJ, amrex::Gpu::DeviceVector< amrex::Real > &stretched_dz_d, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &mf_mx, const amrex::Array4< const amrex::Real > &mf_ux, const amrex::Array4< const amrex::Real > &mf_vx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy, const amrex::Array4< const amrex::Real > &mf_vy, const AdvType horiz_adv_type, const AdvType vert_adv_type, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac, MeshType &mesh_type, TerrainType &terrain_type, const eb_ &ebfact, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_u_arr, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_v_arr, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_w_arr, const amrex::Vector< amrex::iMultiFab > &physbnd_mask, const bool already_on_centroids, const int lo_z_face, const int hi_z_face, const amrex::Box &domain, const amrex::BCRec *bc_ptr_h)
constexpr amrex::Real one
Definition: ERF_Constants.H:9
constexpr amrex::Real zero
Definition: ERF_Constants.H:8
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:13
@ tau12
Definition: ERF_DataStruct.H:32
@ tau23
Definition: ERF_DataStruct.H:32
@ tau33
Definition: ERF_DataStruct.H:32
@ tau22
Definition: ERF_DataStruct.H:32
@ tau11
Definition: ERF_DataStruct.H:32
@ tau32
Definition: ERF_DataStruct.H:32
@ tau31
Definition: ERF_DataStruct.H:32
@ tau21
Definition: ERF_DataStruct.H:32
@ tau13
Definition: ERF_DataStruct.H:32
@ nvars
Definition: ERF_DataStruct.H:98
@ v_x
Definition: ERF_DataStruct.H:24
@ u_y
Definition: ERF_DataStruct.H:25
@ v_y
Definition: ERF_DataStruct.H:25
@ m_y
Definition: ERF_DataStruct.H:25
@ u_x
Definition: ERF_DataStruct.H:24
@ m_x
Definition: ERF_DataStruct.H:24
void DiffusionSrcForMom(const amrex::Box &bxx, const amrex::Box &bxy, const amrex::Box &bxz, const amrex::Array4< amrex::Real > &rho_u_rhs, const amrex::Array4< amrex::Real > &rho_v_rhs, const amrex::Array4< amrex::Real > &rho_w_rhs, const amrex::Array4< const amrex::Real > &tau11, const amrex::Array4< const amrex::Real > &tau22, const amrex::Array4< const amrex::Real > &tau33, const amrex::Array4< const amrex::Real > &tau12, const amrex::Array4< const amrex::Real > &tau21, const amrex::Array4< const amrex::Real > &tau13, const amrex::Array4< const amrex::Real > &tau31, const amrex::Array4< const amrex::Real > &tau23, const amrex::Array4< const amrex::Real > &tau32, const amrex::Array4< const amrex::Real > &detJ_arr, const amrex::Gpu::DeviceVector< amrex::Real > &stretched_dz_d, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv, const amrex::Array4< const amrex::Real > &mf_mx, const amrex::Array4< const amrex::Real > &mf_ux, const amrex::Array4< const amrex::Real > &mf_vx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy, const amrex::Array4< const amrex::Real > &mf_vy, const bool use_stretched_dz, const bool use_variable_dz)
void DiffusionSrcForState_S(const amrex::Box &bx, const amrex::Box &domain, int start_comp, int num_comp, const amrex::Array4< const amrex::Real > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &cell_data, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< amrex::Real > &cell_rhs, const amrex::Array4< amrex::Real > &xflux, const amrex::Array4< amrex::Real > &yflux, const amrex::Array4< amrex::Real > &zflux, const amrex::Gpu::DeviceVector< amrex::Real > &stretched_dz_d, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv, const amrex::Array4< const amrex::Real > &SmnSmn_a, const amrex::Array4< const amrex::Real > &mf_mx, const amrex::Array4< const amrex::Real > &mf_ux, const amrex::Array4< const amrex::Real > &mf_vx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy, const amrex::Array4< const amrex::Real > &mf_vy, amrex::Array4< amrex::Real > &hfx_z, amrex::Array4< amrex::Real > &qfx1_z, amrex::Array4< amrex::Real > &qfx2_z, amrex::Array4< amrex::Real > &diss, const amrex::Array4< const amrex::Real > &mu_turb, const SolverChoice &solverChoice, const int level, const amrex::Array4< const amrex::Real > &tm_arr, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > grav_gpu, const amrex::BCRec *bc_ptr, const bool use_SurfLayer, const amrex::Real implicit_fac)
void DiffusionSrcForState_T(const amrex::Box &bx, const amrex::Box &domain, int start_comp, int num_comp, const bool &rotate, const amrex::Array4< const amrex::Real > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &cell_data, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< amrex::Real > &cell_rhs, const amrex::Array4< amrex::Real > &xflux, const amrex::Array4< amrex::Real > &yflux, const amrex::Array4< amrex::Real > &zflux, const amrex::Array4< const amrex::Real > &z_nd, const amrex::Array4< const amrex::Real > &z_cc, const amrex::Array4< const amrex::Real > &ax, const amrex::Array4< const amrex::Real > &ay, const amrex::Array4< const amrex::Real > &az, const amrex::Array4< const amrex::Real > &detJ, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv, const amrex::Array4< const amrex::Real > &SmnSmn_a, const amrex::Array4< const amrex::Real > &mf_mx, const amrex::Array4< const amrex::Real > &mf_ux, const amrex::Array4< const amrex::Real > &mf_vx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy, const amrex::Array4< const amrex::Real > &mf_vy, amrex::Array4< amrex::Real > &hfx_x, amrex::Array4< amrex::Real > &hfx_y, amrex::Array4< amrex::Real > &hfx_z, amrex::Array4< amrex::Real > &qfx1_x, amrex::Array4< amrex::Real > &qfx1_y, amrex::Array4< amrex::Real > &qfx1_z, amrex::Array4< amrex::Real > &qfx2_z, amrex::Array4< amrex::Real > &diss, const amrex::Array4< const amrex::Real > &mu_turb, const SolverChoice &solverChoice, const int level, const amrex::Array4< const amrex::Real > &tm_arr, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > grav_gpu, const amrex::BCRec *bc_ptr, const bool use_SurfLayer, const amrex::Real implicit_fac)
void DiffusionSrcForState_N(const amrex::Box &bx, const amrex::Box &domain, int start_comp, int num_comp, const amrex::Array4< const amrex::Real > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &cell_data, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< amrex::Real > &cell_rhs, const amrex::Array4< amrex::Real > &xflux, const amrex::Array4< amrex::Real > &yflux, const amrex::Array4< amrex::Real > &zflux, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &SmnSmn_a, const amrex::Array4< const amrex::Real > &mf_mx, const amrex::Array4< const amrex::Real > &mf_ux, const amrex::Array4< const amrex::Real > &mf_vx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy, const amrex::Array4< const amrex::Real > &mf_vy, amrex::Array4< amrex::Real > &hfx_z, amrex::Array4< amrex::Real > &qfx1_z, amrex::Array4< amrex::Real > &qfx2_z, amrex::Array4< amrex::Real > &diss, const amrex::Array4< const amrex::Real > &mu_turb, const SolverChoice &solverChoice, const int level, const amrex::Array4< const amrex::Real > &tm_arr, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > grav_gpu, const amrex::BCRec *bc_ptr, const bool use_SurfLayer, const amrex::Real implicit_fac)
void DiffusionSrcForState_EB(const amrex::Box &bx, const amrex::Box &domain, int start_comp, int num_comp, const amrex::Array4< const amrex::Real > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &cell_data, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< amrex::Real > &cell_rhs, const amrex::Array4< amrex::Real > &xflux, const amrex::Array4< amrex::Real > &yflux, const amrex::Array4< amrex::Real > &zflux, const amrex::Array4< const amrex::EBCellFlag > &cfg_arr, const amrex::Array4< const amrex::Real > &ax_arr, const amrex::Array4< const amrex::Real > &ay_arr, const amrex::Array4< const amrex::Real > &az_arr, const amrex::Array4< const amrex::Real > &detJ, const amrex::Array4< const amrex::Real > &barea_arr, const amrex::Array4< const amrex::Real > &bcent_arr, const amrex::Real *dx_arr, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, amrex::Array4< amrex::Real > &hfx_z, amrex::Array4< amrex::Real > &qfx1_z, amrex::Array4< amrex::Real > &qfx2_z, amrex::Array4< amrex::Real > &hfx_EB, const amrex::Array4< const amrex::Real > &mu_turb, const SolverChoice &solverChoice, const int level, const amrex::BCRec *bc_ptr, const bool use_SurfLayer)
void DiffusionSrcForMom_EB(const amrex::MFIter &mfi, [[maybe_unused]] const amrex::Box &domain, const amrex::Box &bxx, const amrex::Box &bxy, const amrex::Box &bxz, const amrex::Array4< amrex::Real > &rho_u_rhs, const amrex::Array4< amrex::Real > &rho_v_rhs, const amrex::Array4< amrex::Real > &rho_w_rhs, const amrex::Array4< const amrex::Real > &u_arr, const amrex::Array4< const amrex::Real > &v_arr, const amrex::Array4< const amrex::Real > &w_arr, const amrex::Array4< const amrex::Real > &tau11, const amrex::Array4< const amrex::Real > &tau22, const amrex::Array4< const amrex::Real > &tau33, const amrex::Array4< const amrex::Real > &tau12, const amrex::Array4< const amrex::Real > &tau13, const amrex::Array4< const amrex::Real > &tau23, const amrex::Array4< const amrex::Real > &u_tau_eb13, const amrex::Array4< const amrex::Real > &u_tau_eb23, const amrex::Array4< const amrex::Real > &v_tau_eb13, const amrex::Array4< const amrex::Real > &v_tau_eb23, const amrex::Array4< const amrex::Real > &w_tau_eb13, const amrex::Array4< const amrex::Real > &w_tau_eb23, const amrex::Real *dx_arr, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv, const amrex::Array4< const amrex::Real > &mf_mx, const amrex::Array4< const amrex::Real > &mf_ux, const amrex::Array4< const amrex::Real > &mf_vx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy, const amrex::Array4< const amrex::Real > &mf_vy, const SolverChoice &solverChoice, const eb_ &ebfact, [[maybe_unused]] const amrex::BCRec *bc_ptr)
void EBAdvectionSrcForScalars(const amrex::Box &bx, const int icomp, const int ncomp, const amrex::Array4< const amrex::Real > &avg_xmom, const amrex::Array4< const amrex::Real > &avg_ymom, const amrex::Array4< const amrex::Real > &avg_zmom, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< amrex::Real > &src, const amrex::Array4< const int > &mask_arr, const amrex::Array4< const amrex::EBCellFlag > &cfg_arr, const amrex::Array4< const amrex::Real > &ax_arr, const amrex::Array4< const amrex::Real > &ay_arr, const amrex::Array4< const amrex::Real > &az_arr, const amrex::Array4< const amrex::Real > &fcx_arr, const amrex::Array4< const amrex::Real > &fcy_arr, const amrex::Array4< const amrex::Real > &fcz_arr, const amrex::Array4< const amrex::Real > &vf_arr, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &mf_mx, const amrex::Array4< const amrex::Real > &mf_my, const AdvType horiz_adv_type, const AdvType vert_adv_type, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac, const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_arr, const amrex::Box &domain, const amrex::BCRec *bc_ptr_h, bool already_on_centroids)
void EBAdvectionSrcForRho(const amrex::Box &bx, const amrex::Array4< amrex::Real > &src, const amrex::Array4< const amrex::Real > &rho_u, const amrex::Array4< const amrex::Real > &rho_v, const amrex::Array4< const amrex::Real > &omega, const amrex::Array4< amrex::Real > &avg_xmom, const amrex::Array4< amrex::Real > &avg_ymom, const amrex::Array4< amrex::Real > &avg_zmom, const amrex::Array4< const int > &mask_arr, const amrex::Array4< const amrex::EBCellFlag > &cfg_arr, const amrex::Array4< const amrex::Real > &ax_arr, const amrex::Array4< const amrex::Real > &ay_arr, const amrex::Array4< const amrex::Real > &az_arr, const amrex::Array4< const amrex::Real > &fcx_arr, const amrex::Array4< const amrex::Real > &fcy_arr, const amrex::Array4< const amrex::Real > &fcz_arr, const amrex::Array4< const amrex::Real > &detJ, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &mf_mx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy, const amrex::Array4< const amrex::Real > &mf_vx, const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_arr, const bool fixed_rho, bool already_on_centroids)
@ tau_eb23
Definition: ERF_EBStruct.H:16
@ tau_eb13
Definition: ERF_EBStruct.H:16
@ yface
Definition: ERF_EBStruct.H:20
@ zface
Definition: ERF_EBStruct.H:20
@ xface
Definition: ERF_EBStruct.H:20
const Real l_vert_implicit_fac
Definition: ERF_ImplicitPost.H:6
#define Rho_comp
Definition: ERF_IndexDefines.H:36
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
AdvType
Definition: ERF_IndexDefines.H:255
amrex::GpuArray< Real, AMREX_SPACEDIM > dxInv
Definition: ERF_InitCustomPertVels_ParticleTests.H:17
const Real dx
Definition: ERF_InitCustomPert_ABL.H:23
const int khi
Definition: ERF_InitCustomPert_Bubble.H:21
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
void erf_make_tau_terms(int level, int nrk, const Vector< BCRec > &domain_bcs_type_h, const MultiFab &z_phys_nd, Vector< MultiFab > &S_data, const MultiFab &xvel, const MultiFab &yvel, const MultiFab &zvel, Vector< std::unique_ptr< MultiFab >> &Tau_lev, Vector< std::unique_ptr< MultiFab >> &Tau_corr_lev, MultiFab *SmnSmn, MultiFab *eddyDiffs, const Geometry geom, const SolverChoice &solverChoice, std::unique_ptr< SurfaceLayer > &, Gpu::DeviceVector< Real > &stretched_dz_d, const MultiFab &detJ, Vector< std::unique_ptr< MultiFab >> &mapfac, const MultiFab &ax, const MultiFab &ay, const MultiFab &az, const eb_ &ebfact)
Definition: ERF_MakeTauTerms.cpp:12
ParallelFor(grown_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real OmegaFromW(int &i, int &j, int &k, amrex::Real w, const amrex::Array4< const amrex::Real > &u_arr, const amrex::Array4< const amrex::Real > &v_arr, const amrex::Array4< const amrex::Real > &mf_u, const amrex::Array4< const amrex::Real > &mf_v, const amrex::Array4< const amrex::Real > &z_nd, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv)
Definition: ERF_TerrainMetrics.H:414
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_zeta_AtIface(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:104
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_zeta_AtJface(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:144
AMREX_FORCE_INLINE amrex::IntVect TileNoZ()
Definition: ERF_TileNoZ.H:11
const std::unique_ptr< amrex::EBFArrayBoxFactory > & get_const_factory() const noexcept
Definition: ERF_EB.H:46
@ yvel_bc
Definition: ERF_IndexDefines.H:103
@ xvel_bc
Definition: ERF_IndexDefines.H:102
@ ext_dir
Definition: ERF_IndexDefines.H:243
@ ext_dir_upwind
Definition: ERF_IndexDefines.H:251
@ gpz
Definition: ERF_IndexDefines.H:186
@ gpy
Definition: ERF_IndexDefines.H:185
@ gpx
Definition: ERF_IndexDefines.H:184
@ NumTypes
Definition: ERF_IndexDefines.H:196
@ ymom
Definition: ERF_IndexDefines.H:194
@ cons
Definition: ERF_IndexDefines.H:192
@ zmom
Definition: ERF_IndexDefines.H:195
@ xmom
Definition: ERF_IndexDefines.H:193
@ qt
Definition: ERF_Kessler.H:28
@ ng
Definition: ERF_Morrison.H:48
@ xvel
Definition: ERF_IndexDefines.H:175
@ zvel
Definition: ERF_IndexDefines.H:177
@ yvel
Definition: ERF_IndexDefines.H:176
@ q
Definition: ERF_WSM6.H:169
AdvType dycore_vert_adv_type
Definition: ERF_AdvStruct.H:420
amrex::Real dycore_vert_upw_frac
Definition: ERF_AdvStruct.H:430
AdvType dycore_horiz_adv_type
Definition: ERF_AdvStruct.H:419
amrex::Real dycore_horiz_upw_frac
Definition: ERF_AdvStruct.H:429
Definition: ERF_DiffStruct.H:19
MolecDiffType molec_diff_type
Definition: ERF_DiffStruct.H:84
Definition: ERF_EBStruct.H:27
EBBoundaryType eb_boundary_type
Definition: ERF_EBStruct.H:59
static MeshType mesh_type
Definition: ERF_DataStruct.H:1211
DiffChoice diffChoice
Definition: ERF_DataStruct.H:1220
amrex::Real gravity
Definition: ERF_DataStruct.H:1299
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > abl_pressure_grad
Definition: ERF_DataStruct.H:1396
bool implicit_thermal_diffusion
Definition: ERF_DataStruct.H:1249
amrex::Vector< TurbChoice > turbChoice
Definition: ERF_DataStruct.H:1223
amrex::Vector< int > anelastic
Definition: ERF_DataStruct.H:1229
AdvChoice advChoice
Definition: ERF_DataStruct.H:1219
MoistureType moisture_type
Definition: ERF_DataStruct.H:1389
static TerrainType terrain_type
Definition: ERF_DataStruct.H:1202
amrex::Vector< int > fixed_density
Definition: ERF_DataStruct.H:1230
amrex::Vector< amrex::Vector< amrex::Real > > vert_implicit_fac
Definition: ERF_DataStruct.H:1246
bool use_rotate_surface_flux
Definition: ERF_DataStruct.H:1329
EBChoice ebChoice
Definition: ERF_DataStruct.H:1224
CouplingType coupling_type
Definition: ERF_DataStruct.H:1388
Definition: ERF_TurbStruct.H:82
PBLType pbl_type
Definition: ERF_TurbStruct.H:478
bool use_keqn
Definition: ERF_TurbStruct.H:514
RANSType rans_type
Definition: ERF_TurbStruct.H:473
bool uses_eamxx_shoc() const noexcept
Definition: ERF_TurbStruct.H:480
bool uses_native_shoc() const noexcept
Definition: ERF_TurbStruct.H:485
LESType les_type
Definition: ERF_TurbStruct.H:431
bool use_kturb
Definition: ERF_TurbStruct.H:513
Here is the call graph for this function: