Function for computing the slow RHS for the evolution equations for the density, potential temperature and momentum.
129 BL_PROFILE_REGION(
"erf_slow_rhs_pre()");
131 const BCRec* bc_ptr_d = domain_bcs_type_d.data();
132 const BCRec* bc_ptr_h = domain_bcs_type_h.data();
137 const Box& domain = geom.Domain();
138 const bool use_physical_chamber_wall_flux =
139 cloud_chamber_config !=
nullptr && cloud_chamber_base_state !=
nullptr &&
142 use_physical_chamber_wall_flux ? cloud_chamber_config->
wall_boundary() :
144 int klo = domain.smallEnd(2);
145 int khi = domain.bigEnd(2);
151 const bool l_use_stretched_dz = (solverChoice.
mesh_type == MeshType::StretchedDz);
152 const bool l_use_terrain_fitted_coords = (solverChoice.
mesh_type == MeshType::VariableDz);
153 const bool l_moving_terrain = (solverChoice.
terrain_type == TerrainType::MovingFittedMesh);
154 if (l_moving_terrain)
AMREX_ALWAYS_ASSERT (l_use_stretched_dz || l_use_terrain_fitted_coords);
167 auto any_SurfLayer = [&SurfLayer_ = SurfLayer]() ->
bool {
168 for (
auto it = SurfLayer_.begin(); it != SurfLayer_.end(); it++)
170 if (*it !=
nullptr) {
return true; }
175 const bool l_use_SurfLayer = any_SurfLayer();
176 bool l_apply_surface_layer_fluxes_in_diffusion = l_use_SurfLayer;
179 const bool l_anelastic = (solverChoice.
anelastic[level] == 1);
180 const bool l_fixed_rho = (solverChoice.
fixed_density[level] == 1);
182 const bool l_anelastic_rk2 = (solverChoice.
anelastic_type[level] == AnelasticType::RK2);
184 const bool l_reflux =
IsRefluxStage(solverChoice, level, finest_level, nrk);
187 const bool l_use_eb = (solverChoice.
terrain_type == TerrainType::EB);
189 const GpuArray<Real, AMREX_SPACEDIM>
dxInv = geom.InvCellSizeArray();
190 const Real*
dx = geom.CellSize();
206 const DistributionMapping& dm = S_data[
IntVars::cons].DistributionMap();
208 int nGhost = (l_use_eb) ? 2 : 1;
209 MultiFab Omega(convert(ba,IntVect(0,0,1)), dm, 1, nGhost);
211 std::unique_ptr<MultiFab> expr;
212 std::unique_ptr<MultiFab> dflux_x;
213 std::unique_ptr<MultiFab> dflux_y;
214 std::unique_ptr<MultiFab> dflux_z;
217 #ifdef ERF_USE_EAMXX_SHOC
222 eamxx_shoc_lev->set_eddy_diffs();
229 l_apply_surface_layer_fluxes_in_diffusion =
false;
235 Tau_lev,Tau_corr_lev,
236 SmnSmn,eddyDiffs,geom,solverChoice,SurfLayer,
237 stretched_dz_d, detJ,mapfac, ax, ay, az, ebfact,
238 ib_wall_face13, ib_wall_face23);
241 dflux_x = std::make_unique<MultiFab>(convert(ba,IntVect(1,0,0)), dm,
nvars,
ng);
242 dflux_y = std::make_unique<MultiFab>(convert(ba,IntVect(0,1,0)), dm,
nvars,
ng);
243 dflux_z = std::make_unique<MultiFab>(convert(ba,IntVect(0,0,1)), dm,
nvars, 0);
247 if (use_physical_chamber_wall_flux) {
248 dflux_x->setVal(0.0);
249 dflux_y->setVal(0.0);
250 dflux_z->setVal(0.0);
253 bool surface_layer_handled =
false;
254 #ifdef ERF_USE_EAMXX_SHOC
259 eamxx_shoc_lev->set_diff_stresses();
260 surface_layer_handled =
true;
265 surface_layer_handled =
true;
267 if (!surface_layer_handled && l_use_SurfLayer) {
270 for (OrientationIter oit; oit; ++oit) {
271 Orientation ori = oit();
272 if (SurfLayer[ori]) {
273 SurfLayer[ori]->impose_SurfaceLayer_bcs(level, mfs, Tau_lev,
285 SurfLayer[Orientation(Direction::z,Orientation::low)]->impose_SurfaceLayer_bcs_EB(level, mfs, Tau_EB,
287 Q1fx1, Q1fx2, Q1fx3);
305 bool already_on_centroids =
false;
306 Vector<iMultiFab> physbnd_mask;
310 physbnd_mask[
IntVars::cons].BuildMask(geom.Domain(), geom.periodicity(), 1, 1, 0, 1);
312 for (
int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
313 physbnd_mask[1+dir].define(S_data[1+dir].boxArray(), S_data[1+dir].DistributionMap(), 1, 1);
314 physbnd_mask[1+dir].BuildMask(geom.Domain(), geom.periodicity(), 1, 1, 0, 1);
320 #pragma omp parallel if (Gpu::notInLaunchRegion())
323 BL_PROFILE(
"slow_rhs_making_omega");
326 IntVect nGrowVect = (l_use_eb)
327 ? IntVect(AMREX_D_DECL(2, 2, 2)) : IntVect(AMREX_D_DECL(1, 1, 1));
337 Box gbxo = mfi.grownnodaltilebox(2,nGrowVect);
339 const Array4<const Real>& rho_u = S_data[
IntVars::xmom].array(mfi);
340 const Array4<const Real>& rho_v = S_data[
IntVars::ymom].array(mfi);
341 const Array4<const Real>& rho_w = S_data[
IntVars::zmom].array(mfi);
342 const Array4< Real>& omega_arr = Omega.array(mfi);
349 if (!l_use_terrain_fitted_coords) {
350 ParallelFor(gbxo, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept {
351 omega_arr(i,j,k) = rho_w(i,j,k);
356 Box gbxo_lo = gbxo; gbxo_lo.setBig(2,domain.smallEnd(2));
357 int lo_z_face = domain.smallEnd(2);
358 if (gbxo_lo.smallEnd(2) <= lo_z_face) {
359 ParallelFor(gbxo_lo, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept {
360 omega_arr(i,j,k) =
zero;
365 Box gbxo_hi = gbxo; gbxo_hi.setSmall(2,gbxo.bigEnd(2));
366 int hi_z_face = domain.bigEnd(2)+1;
367 if (gbxo_hi.bigEnd(2) >= hi_z_face) {
368 ParallelFor(gbxo_hi, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept {
369 omega_arr(i,j,k) = rho_w(i,j,k);
373 const Array4<const Real>& z_nd = z_phys_nd.const_array(mfi);
374 const Array4<const Real>& mf_ux = mapfac[
MapFacType::u_x]->const_array(mfi);
375 const Array4<const Real>& mf_vy = mapfac[
MapFacType::v_y]->const_array(mfi);
379 if (gbxo_mid.smallEnd(2) <= domain.smallEnd(2)) { gbxo_mid.setSmall(2,1); }
380 if (gbxo_mid.bigEnd(2) >= domain.bigEnd(2)+1) { gbxo_mid.setBig(2,gbxo.bigEnd(2)-1); }
381 Array4<const Real> z_t = z_t_mf->array(mfi);
382 const Array4<const Real>& cell_data = S_data[
IntVars::cons].array(mfi);
383 ParallelFor(gbxo_mid, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept {
386 omega_arr(i,j,k) =
OmegaFromW(i,j,k,rho_w(i,j,k),
387 rho_u,rho_v,mf_ux,mf_vy,z_nd,
dxInv) -
388 rho_at_face * z_t(i,j,k);
392 if (gbxo_mid.smallEnd(2) <= domain.smallEnd(2)) {
393 gbxo_mid.setSmall(2,1);
395 if (gbxo_mid.bigEnd(2) >= domain.bigEnd(2)+1) {
396 gbxo_mid.setBig(2,gbxo.bigEnd(2)-1);
398 ParallelFor(gbxo_mid, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept {
399 omega_arr(i,j,k) =
OmegaFromW(i,j,k,rho_w(i,j,k),
400 rho_u,rho_v,mf_ux,mf_vy,z_nd,
dxInv);
408 Omega.FillBoundary(geom.periodicity());
411 #pragma omp parallel if (Gpu::notInLaunchRegion())
416 Box bx = mfi.tilebox();
417 Box tbx = mfi.nodaltilebox(0);
418 Box tby = mfi.nodaltilebox(1);
419 Box tbz = mfi.nodaltilebox(2);
422 Vector<Box> tbx_grown(AMREX_SPACEDIM);
423 Vector<Box> tby_grown(AMREX_SPACEDIM);
424 Vector<Box> tbz_grown(AMREX_SPACEDIM);
426 for (
int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
427 tbx_grown[dir] = tbx;
428 tby_grown[dir] = tby;
429 tbz_grown[dir] = tbz;
432 tbx_grown[dir] = (tbx_grown[dir].growHi(dir,1)).grow(iv);
433 tby_grown[dir] = (tby_grown[dir].growHi(dir,1)).grow(iv);
434 tbz_grown[dir] = (tbz_grown[dir].growHi(dir,1)).grow(iv);
441 const Array4<const Real> & cell_data = S_data[
IntVars::cons].array(mfi);
442 const Array4<const Real> & cell_prim = S_prim.array(mfi);
443 const Array4<Real> & cell_rhs = S_rhs[
IntVars::cons].array(mfi);
445 const Array4<const Real> & cell_old = S_old[
IntVars::cons].array(mfi);
447 const Array4<Real const>& xmom_src_arr = xmom_src.const_array(mfi);
448 const Array4<Real const>& ymom_src_arr = ymom_src.const_array(mfi);
449 const Array4<Real const>& zmom_src_arr = zmom_src.const_array(mfi);
450 const Array4<Real const>& buoyancy_arr = buoyancy.const_array(mfi);
452 const Array4<Real const>& gpx_arr = gradp[
GpVars::gpx].const_array(mfi);
453 const Array4<Real const>& gpy_arr = gradp[
GpVars::gpy].const_array(mfi);
454 const Array4<Real const>& gpz_arr = gradp[
GpVars::gpz].const_array(mfi);
456 const Array4<Real const>& qt_arr =
qt.const_array(mfi);
458 const Array4<Real>& rho_u_old = S_old[
IntVars::xmom].array(mfi);
459 const Array4<Real>& rho_v_old = S_old[
IntVars::ymom].array(mfi);
460 const Array4<Real>& rho_w_old = S_old[
IntVars::zmom].array(mfi);
464 avg_xmom[mfi].template setVal<RunOn::Device>(0,tbx);
465 avg_ymom[mfi].template setVal<RunOn::Device>(0,tby);
466 avg_zmom[mfi].template setVal<RunOn::Device>(0,tbz);
469 Array4<Real> avg_xmom_arr = avg_xmom.array(mfi);
470 Array4<Real> avg_ymom_arr = avg_ymom.array(mfi);
471 Array4<Real> avg_zmom_arr = avg_zmom.array(mfi);
473 const Array4<const Real> & u =
xvel.array(mfi);
474 const Array4<const Real> & v =
yvel.array(mfi);
475 const Array4<const Real> &
w =
zvel.array(mfi);
477 const Array4<const Real>& rho_u = S_data[
IntVars::xmom].array(mfi);
478 const Array4<const Real>& rho_v = S_data[
IntVars::ymom].array(mfi);
479 const Array4<const Real>& rho_w = S_data[
IntVars::zmom].array(mfi);
482 const Array4<const Real>& mf_mx = mapfac[
MapFacType::m_x]->const_array(mfi);
483 const Array4<const Real>& mf_ux = mapfac[
MapFacType::u_x]->const_array(mfi);
484 const Array4<const Real>& mf_vx = mapfac[
MapFacType::v_x]->const_array(mfi);
485 const Array4<const Real>& mf_my = mapfac[
MapFacType::m_y]->const_array(mfi);
486 const Array4<const Real>& mf_uy = mapfac[
MapFacType::u_y]->const_array(mfi);
487 const Array4<const Real>& mf_vy = mapfac[
MapFacType::v_y]->const_array(mfi);
489 const Array4< Real>& omega_arr = Omega.array(mfi);
491 const Array4<Real>& rho_u_rhs = S_rhs[
IntVars::xmom].array(mfi);
492 const Array4<Real>& rho_v_rhs = S_rhs[
IntVars::ymom].array(mfi);
493 const Array4<Real>& rho_w_rhs = S_rhs[
IntVars::zmom].array(mfi);
495 const Array4<Real const>& mu_turb = l_use_turb ? eddyDiffs->const_array(mfi) : Array4<const Real>{};
498 const Array4<const Real>& z_nd = z_phys_nd.const_array(mfi);
499 const Array4<const Real>& z_cc = z_phys_cc.const_array(mfi);
504 std::array<FArrayBox,AMREX_SPACEDIM> flux;
505 std::array<FArrayBox,AMREX_SPACEDIM> flux_u;
506 std::array<FArrayBox,AMREX_SPACEDIM> flux_v;
507 std::array<FArrayBox,AMREX_SPACEDIM> flux_w;
509 for (
int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
511 flux[dir].resize(surroundingNodes(bx,dir),2,The_Async_Arena());
513 flux[dir].resize(surroundingNodes(bx,dir).grow(1),2,The_Async_Arena());
515 flux[dir].setVal<RunOn::Device>(0);
517 const GpuArray<const Array4<Real>, AMREX_SPACEDIM>
518 flx_arr{{AMREX_D_DECL(flux[0].array(), flux[1].array(), flux[2].array())}};
524 (l_reflux && l_anelastic && !l_use_eb) ? &flx_arr :
nullptr;
527 GpuArray<Array4<Real>, AMREX_SPACEDIM> flx_u_arr{};
528 GpuArray<Array4<Real>, AMREX_SPACEDIM> flx_v_arr{};
529 GpuArray<Array4<Real>, AMREX_SPACEDIM> flx_w_arr{};
532 for (
int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
533 flux_u[dir].resize(tbx_grown[dir],1,The_Async_Arena());
534 flux_v[dir].resize(tby_grown[dir],1,The_Async_Arena());
535 flux_w[dir].resize(tbz_grown[dir],1,The_Async_Arena());
536 flux_u[dir].setVal<RunOn::Device>(0);
537 flux_v[dir].setVal<RunOn::Device>(0);
538 flux_w[dir].setVal<RunOn::Device>(0);
539 flx_u_arr[dir] = flux_u[dir].array();
540 flx_v_arr[dir] = flux_v[dir].array();
541 flx_w_arr[dir] = flux_w[dir].array();
556 tau11 = Array4<Real>{};
tau22 = Array4<Real>{};
tau33 = Array4<Real>{};
557 tau12 = Array4<Real>{};
tau13 = Array4<Real>{};
tau23 = Array4<Real>{};
566 Array4<Real> u_tau_eb13, u_tau_eb23;
567 Array4<Real> v_tau_eb13, v_tau_eb23;
568 Array4<Real> w_tau_eb13, w_tau_eb23;
584 bool l_eb_terrain_cc =
false;
585 Array4<const int> mask_arr{};
586 Array4<const EBCellFlag> cfg_arr{};
587 Array4<const Real> ax_arr{};
588 Array4<const Real> ay_arr{};
589 Array4<const Real> az_arr{};
590 Array4<const Real> fcx_arr{};
591 Array4<const Real> fcy_arr{};
592 Array4<const Real> fcz_arr{};
593 Array4<const Real> detJ_arr{};
594 Array4<const Real> barea_arr{};
595 Array4<const Real> bcent_arr{};
600 EBCellFlagFab
const& cfg = eb_cc_factory->getMultiEBCellFlagFab()[mfi];
601 cfg_arr = cfg.const_array();
602 if (cfg.getType(bx) == FabType::singlevalued) {
603 l_eb_terrain_cc =
true;
604 ax_arr = eb_cc_factory->getAreaFrac()[0]->const_array(mfi);
605 ay_arr = eb_cc_factory->getAreaFrac()[1]->const_array(mfi);
606 az_arr = eb_cc_factory->getAreaFrac()[2]->const_array(mfi);
607 fcx_arr = eb_cc_factory->getFaceCent()[0]->const_array(mfi);
608 fcy_arr = eb_cc_factory->getFaceCent()[1]->const_array(mfi);
609 fcz_arr = eb_cc_factory->getFaceCent()[2]->const_array(mfi);
610 detJ_arr = eb_cc_factory->getVolFrac().const_array(mfi);
612 barea_arr = eb_cc_factory->getBndryArea().const_array(mfi);
613 bcent_arr = eb_cc_factory->getBndryCent().const_array(mfi);
615 ax_arr = ax.const_array(mfi);
616 ay_arr = ay.const_array(mfi);
617 az_arr = az.const_array(mfi);
618 detJ_arr = detJ.const_array(mfi);
621 ax_arr = ax.const_array(mfi);
622 ay_arr = ay.const_array(mfi);
623 az_arr = az.const_array(mfi);
624 detJ_arr = detJ.const_array(mfi);
628 if (!l_eb_terrain_cc){
630 rho_u, rho_v, omega_arr,
631 avg_xmom_arr, avg_ymom_arr, avg_zmom_arr,
632 ax_arr, ay_arr, az_arr, detJ_arr,
633 dxInv, mf_mx, mf_my, mf_uy, mf_vx,
634 flx_arr, l_fixed_rho);
636 avg_xmom_arr, avg_ymom_arr, avg_zmom_arr,
638 detJ_arr,
dxInv, mf_mx, mf_my,
639 l_horiz_adv_type, l_vert_adv_type,
640 l_horiz_upw_frac, l_vert_upw_frac,
641 flx_arr, domain, bc_ptr_h);
644 rho_u, rho_v, omega_arr,
645 avg_xmom_arr, avg_ymom_arr, avg_zmom_arr,
647 ax_arr, ay_arr, az_arr,
648 fcx_arr, fcy_arr, fcz_arr, detJ_arr,
649 dxInv, mf_mx, mf_my, mf_uy, mf_vx,
650 flx_arr, l_fixed_rho,
651 already_on_centroids);
653 avg_xmom_arr, avg_ymom_arr, avg_zmom_arr,
655 mask_arr, cfg_arr, ax_arr, ay_arr, az_arr,
656 fcx_arr, fcy_arr, fcz_arr,
657 detJ_arr,
dxInv, mf_mx, mf_my,
658 l_horiz_adv_type, l_vert_adv_type,
659 l_horiz_upw_frac, l_vert_upw_frac,
660 flx_arr, domain, bc_ptr_h,
661 already_on_centroids);
665 Array4<Real> diffflux_x = dflux_x->array(mfi);
666 Array4<Real> diffflux_y = dflux_y->array(mfi);
667 Array4<Real> diffflux_z = dflux_z->array(mfi);
669 Array4<Real> hfx_x = Hfx1->array(mfi);
670 Array4<Real> hfx_y = Hfx2->array(mfi);
671 Array4<Real> hfx_z = Hfx3->array(mfi);
672 Array4<Real> hfx_EB{};
674 hfx_EB = Hfx3_EB->array(mfi);
677 Array4<Real> q1fx_x = (Q1fx1) ? Q1fx1->array(mfi) : Array4<Real>{};
678 Array4<Real> q1fx_y = (Q1fx2) ? Q1fx2->array(mfi) : Array4<Real>{};
679 Array4<Real> q1fx_z = (Q1fx3) ? Q1fx3->array(mfi) : Array4<Real>{};
681 Array4<Real> q2fx_z = (Q2fx3) ? Q2fx3->array(mfi) : Array4<Real>{};
690 if (l_use_stretched_dz) {
692 cell_data, cell_prim, cell_rhs,
693 diffflux_x, diffflux_y, diffflux_z,
694 stretched_dz_d,
dxInv,
697 hfx_x, hfx_y, hfx_z, q1fx_x, q1fx_y, q1fx_z, q2fx_z,
698 mu_turb, solverChoice, level,
701 }
else if (l_use_terrain_fitted_coords) {
703 cell_data, cell_prim, cell_rhs,
704 diffflux_x, diffflux_y, diffflux_z,
705 z_nd, z_cc, ax_arr, ay_arr, az_arr, detJ_arr,
709 hfx_x, hfx_y, hfx_z, q1fx_x, q1fx_y, q1fx_z, q2fx_z,
710 mu_turb, solverChoice, level,
711 bc_ptr_d, bc_ptr_h, l_apply_surface_layer_fluxes_in_diffusion, SurfLayer,
l_vert_implicit_fac,
713 }
else if (l_use_eb) {
715 cell_data, cell_prim, cell_rhs,
716 diffflux_x, diffflux_y, diffflux_z,
717 cfg_arr, ax_arr, ay_arr, az_arr, detJ_arr,
718 barea_arr, bcent_arr,
720 hfx_z, q1fx_z, q2fx_z, hfx_EB,
721 mu_turb, solverChoice, level,
722 bc_ptr_d, l_apply_surface_layer_fluxes_in_diffusion, SurfLayer);
725 cell_data, cell_prim, cell_rhs,
726 diffflux_x, diffflux_y, diffflux_z,
730 hfx_x, hfx_y, hfx_z, q1fx_x, q1fx_y, q1fx_z, q2fx_z,
731 mu_turb, solverChoice, level,
734 (ib_wall_face33) ? ib_wall_face33->const_array(mfi) : Array4<const Real>{},
735 (ib_wall_hfx) ? ib_wall_hfx->const_array(mfi) : Array4<const Real>{});
737 if (use_physical_chamber_wall_flux) {
740 cloud_chamber_base_state->const_array(mfi), u, v,
w, cell_rhs,
741 diffflux_x, diffflux_y, diffflux_z,
dxInv,
747 const Array4<Real const>& source_arr = cc_src.const_array(mfi);
748 ParallelFor(bx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
757 if ( l_anelastic && l_anelastic_rk2 && (nrk == 1) )
759 ParallelFor(bx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
772 int lo_z_face = domain.smallEnd(2);
773 int hi_z_face = domain.bigEnd(2)+1;
776 rho_u_rhs, rho_v_rhs, rho_w_rhs,
778 rho_u, rho_v, omega_arr,
779 z_nd, ax_arr, ay_arr, az_arr,
780 detJ_arr, stretched_dz_d,
781 dxInv, mf_mx, mf_ux, mf_vx, mf_my, mf_uy, mf_vy,
782 l_horiz_adv_type, l_vert_adv_type,
783 l_horiz_upw_frac, l_vert_upw_frac,
785 ebfact, flx_u_arr, flx_v_arr, flx_w_arr,
786 physbnd_mask, already_on_centroids,
787 lo_z_face, hi_z_face, domain, bc_ptr_h);
790 if (!l_use_eb && use_physical_chamber_wall_flux &&
793 bx, domain, cell_data,
794 cloud_chamber_base_state->const_array(mfi), u, v,
w,
806 rho_u_rhs, rho_v_rhs, rho_w_rhs,
809 detJ_arr, stretched_dz_d,
dxInv,
813 l_use_terrain_fitted_coords);
816 rho_u_rhs, rho_v_rhs, rho_w_rhs,
820 u_tau_eb13, u_tau_eb23, v_tau_eb13, v_tau_eb23, w_tau_eb13, w_tau_eb23,
824 solverChoice, ebfact, bc_ptr_d);
831 [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
836 Real q = (l_use_moisture) ?
myhalf * (qt_arr(i,j,k) + qt_arr(i-1,j,k)) :
zero;
838 rho_u_rhs(i, j, k) += (-gpx_arr(i,j,k) - abl_pressure_grad[0]) / (
one +
q) + xmom_src_arr(i,j,k);
840 if (l_moving_terrain) {
842 rho_u_rhs(i, j, k) *= h_zeta;
845 if ( l_anelastic && l_anelastic_rk2 && (nrk == 1) ) {
846 rho_u_rhs(i,j,k) *=
myhalf;
847 rho_u_rhs(i,j,k) += half_dt * (rho_u(i,j,k) - rho_u_old(i,j,k));
850 [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
855 Real q = (l_use_moisture) ?
myhalf * (qt_arr(i,j,k) + qt_arr(i,j-1,k)) :
zero;
857 rho_v_rhs(i, j, k) += (-gpy_arr(i,j,k) - abl_pressure_grad[1]) / (
one +
q) + ymom_src_arr(i,j,k);
859 if (l_moving_terrain) {
861 rho_v_rhs(i, j, k) *= h_zeta;
864 if ( l_anelastic && l_anelastic_rk2 && (nrk == 1) ) {
865 rho_v_rhs(i,j,k) *=
myhalf;
866 rho_v_rhs(i,j,k) += half_dt * (rho_v(i,j,k) - rho_v_old(i,j,k));
875 if (bx.smallEnd(0) == domain.smallEnd(0)) {
876 Box lo_x_dom_face(bx); lo_x_dom_face.setBig(0,bx.smallEnd(0));
878 ParallelFor(lo_x_dom_face, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
879 rho_u_rhs(i,j,k) =
zero;
882 ParallelFor(lo_x_dom_face, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
883 if (u(i,j,k) >=
zero) {
884 rho_u_rhs(i,j,k) =
zero;
889 if (bx.bigEnd(0) == domain.bigEnd(0)) {
890 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);
892 ParallelFor(hi_x_dom_face, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
893 rho_u_rhs(i,j,k) =
zero;
896 ParallelFor(hi_x_dom_face, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
897 if (u(i,j,k) <=
zero) {
898 rho_u_rhs(i,j,k) =
zero;
903 if (bx.smallEnd(1) == domain.smallEnd(1)) {
904 Box lo_y_dom_face(bx); lo_y_dom_face.setBig(1,bx.smallEnd(1));
906 ParallelFor(lo_y_dom_face, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
907 rho_v_rhs(i,j,k) =
zero;
910 ParallelFor(lo_y_dom_face, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
911 if (v(i,j,k) >=
zero) {
912 rho_v_rhs(i,j,k) =
zero;
917 if (bx.bigEnd(1) == domain.bigEnd(1)) {
918 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);
920 ParallelFor(hi_y_dom_face, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
921 rho_v_rhs(i,j,k) =
zero;
924 ParallelFor(hi_y_dom_face, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
925 if (v(i,j,k) <=
zero) {
926 rho_v_rhs(i,j,k) =
zero;
932 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
938 qt_arr, i, j, k, l_use_moisture,
gpz, abl_pressure_grad[2],
939 buoyancy_arr(i,j,k)) + zmom_src_arr(i,j,k);
941 if (l_moving_terrain) {
942 rho_w_rhs(i, j, k) *=
myhalf * (detJ_arr(i,j,k) + detJ_arr(i,j,k-1));
945 if ( l_anelastic && l_anelastic_rk2 && (nrk == 1) ) {
946 rho_w_rhs(i,j,k) *=
myhalf;
947 rho_w_rhs(i,j,k) += half_dt * (rho_w(i,j,k) - rho_w_old(i,j,k));
951 auto const lo = lbound(bx);
952 auto const hi = ubound(bx);
957 const Array4<const Real>& rho_w_rhs_crse = zmom_crse_rhs->const_array(mfi);
959 Box b2d = bx; b2d.setRange(2,0);
962 ParallelFor(b2d, [=] AMREX_GPU_DEVICE (
int i,
int j,
int )
964 rho_w_rhs(i,j,
lo.z) = rho_w_rhs_crse(i,j,
lo.z);
969 ParallelFor(b2d, [=] AMREX_GPU_DEVICE (
int i,
int j,
int )
971 rho_w_rhs(i,j,
hi.z+1) = rho_w_rhs_crse(i,j,
hi.z+1);
977 BL_PROFILE(
"slow_rhs_pre_fluxreg");
984 if (l_reflux && l_anelastic) {
986 int num_comp_reflux = 1;
987 if (level < finest_level) {
988 fr_as_crse->CrseAdd(mfi, {{AMREX_D_DECL(&(flux[0]), &(flux[1]), &(flux[2]))}},
989 dx, l_reflux_dt, strt_comp_reflux, strt_comp_reflux,
990 num_comp_reflux, RunOn::Device);
993 fr_as_fine->FineAdd(mfi, {{AMREX_D_DECL(&(flux[0]), &(flux[1]), &(flux[2]))}},
994 dx, l_reflux_dt, strt_comp_reflux, strt_comp_reflux,
995 num_comp_reflux, RunOn::Device);
1002 if (cloud_budget && l_use_diff) {
1003 bool use_trapezoidal = (!l_anelastic || l_anelastic_rk2);
1005 static_cast<Real>(dt), *dflux_x, *dflux_y,
1006 *dflux_z, geom, 0, use_trapezoidal);
void AdvectionSrcForMom(const amrex::MFIter &mfi, 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)
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)
amrex::Box ShrinkZmomBoxAtDomainEnds(amrex::Box b, const amrex::Box &domain)
Definition: ERF_Advection.H:203
@ tau12
Definition: ERF_DataStruct.H:49
@ tau23
Definition: ERF_DataStruct.H:49
@ tau33
Definition: ERF_DataStruct.H:49
@ tau22
Definition: ERF_DataStruct.H:49
@ tau11
Definition: ERF_DataStruct.H:49
@ tau32
Definition: ERF_DataStruct.H:49
@ tau31
Definition: ERF_DataStruct.H:49
@ tau21
Definition: ERF_DataStruct.H:49
@ tau13
Definition: ERF_DataStruct.H:49
@ nvars
Definition: ERF_DataStruct.H:207
@ v_x
Definition: ERF_DataStruct.H:38
@ u_y
Definition: ERF_DataStruct.H:39
@ v_y
Definition: ERF_DataStruct.H:39
@ m_y
Definition: ERF_DataStruct.H:39
@ u_x
Definition: ERF_DataStruct.H:38
@ m_x
Definition: ERF_DataStruct.H:38
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)
Add stress-divergence diffusion source terms to the momentum RHS.
void DiffusionSrcForState_S(const amrex::Box &bx, const amrex::Box &domain, int start_comp, int num_comp, 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 > &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, const amrex::Array4< const amrex::Real > &mu_turb, const SolverChoice &solverChoice, const int level, const amrex::BCRec *bc_ptr, const bool use_SurfLayer, const amrex::Vector< std::unique_ptr< SurfaceLayer >> &SurfLayer, const amrex::Real implicit_fac, const ScalarDiffusionRefluxViews *reflux_flx=nullptr)
Native adapter for regular scalar diffusion on a vertically stretched grid.
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, const amrex::Vector< std::unique_ptr< SurfaceLayer >> &SurfLayer)
Add state diffusion source terms for embedded-boundary cells.
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 > &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, const amrex::Array4< const amrex::Real > &mu_turb, const SolverChoice &solverChoice, const int level, const amrex::BCRec *bc_ptr, const bool use_SurfLayer, const amrex::Vector< std::unique_ptr< SurfaceLayer >> &SurfLayer, const amrex::Real implicit_fac, const ScalarDiffusionRefluxViews *reflux_flx=nullptr, const amrex::Array4< const amrex::Real > &wall_face33=amrex::Array4< const amrex::Real >{}, const amrex::Array4< const amrex::Real > &wall_hfx=amrex::Array4< const amrex::Real >{})
Add regular-grid state diffusion on a uniform grid without terrain.
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 > &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 > &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, const amrex::Array4< const amrex::Real > &mu_turb, const SolverChoice &solverChoice, const int level, const amrex::BCRec *bc_ptr, const amrex::BCRec *bc_ptr_h, const bool use_SurfLayer, const amrex::Vector< std::unique_ptr< SurfaceLayer >> &SurfLayer, const amrex::Real implicit_fac, const ScalarDiffusionRefluxViews *reflux_flx=nullptr)
Native adapter for regular scalar diffusion on terrain-following coordinates.
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)
Add embedded-boundary stress-divergence diffusion source terms to the momentum RHS.
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)
Compute EB advection tendency for scalars other than density.
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)
Compute EB advection tendency for density and potential temperature.
@ tau_eb23
Definition: ERF_EBStruct.H:22
@ tau_eb13
Definition: ERF_EBStruct.H:22
@ yface
Definition: ERF_EBStruct.H:29
@ zface
Definition: ERF_EBStruct.H:29
@ xface
Definition: ERF_EBStruct.H:29
const Real l_vert_implicit_fac
Definition: ERF_ImplicitPost.H:6
#define Rho_comp
Definition: ERF_IndexDefines.H:53
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:54
AdvType
Definition: ERF_IndexDefines.H:352
amrex::GpuArray< Real, AMREX_SPACEDIM > dxInv
Definition: ERF_InitCustomPertVels_ParticleTests.H:17
const Real dx
Definition: ERF_InitCustomPert_ABL.H:44
const int khi
Definition: ERF_InitCustomPert_Bubble.H:25
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
const int klo
Definition: ERF_InitCustomPert_KE.H:9
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, const amrex::Vector< 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, const MultiFab *ib_wall_face13, const MultiFab *ib_wall_face23)
Definition: ERF_MakeTauTerms.cpp:12
ParallelFor(fab_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);})
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
Real w
Definition: ERF_Plotfile2DInterpolator.cpp:23
amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM > ScalarDiffusionRefluxViews
Definition: ERF_ScalarDiffusion.H:1581
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real slow_rhs_pre_z_pressure_buoyancy(const amrex::Array4< const amrex::Real > &qt_arr, int i, int j, int k, bool use_moisture, amrex::Real gpz, amrex::Real abl_pressure_grad_z, amrex::Real buoyancy)
Definition: ERF_SlowRhsPreUtils.H:18
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:802
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:280
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:350
AMREX_FORCE_INLINE amrex::IntVect TileNoZ()
Definition: ERF_TileNoZ.H:11
void capture_stage(int scalar, int nrk, amrex::Real dt, const amrex::MultiFab &xflux, const amrex::MultiFab &yflux, const amrex::MultiFab &zflux, const amrex::Geometry &geom, int flux_comp=0, bool trapezoidal=true)
Definition: ERF_CloudChamberBudget.H:94
@ RhoTheta
Definition: ERF_CloudChamberBudget.H:33
void set_diff_stresses() const
Definition: ERF_ShocDriver.cpp:808
void set_eddy_diffs() const
Definition: ERF_ShocDriver.cpp:796
const std::unique_ptr< amrex::EBFArrayBoxFactory > & get_const_factory() const noexcept
Return the cell-centered EB factory.
Definition: ERF_EB.H:124
@ yvel_bc
Definition: ERF_IndexDefines.H:127
@ xvel_bc
Definition: ERF_IndexDefines.H:126
@ ext_dir
Definition: ERF_IndexDefines.H:340
@ ext_dir_upwind
Definition: ERF_IndexDefines.H:348
@ gpz
Definition: ERF_IndexDefines.H:266
@ gpy
Definition: ERF_IndexDefines.H:265
@ gpx
Definition: ERF_IndexDefines.H:264
@ NumTypes
Definition: ERF_IndexDefines.H:276
@ ymom
Definition: ERF_IndexDefines.H:274
@ cons
Definition: ERF_IndexDefines.H:272
@ zmom
Definition: ERF_IndexDefines.H:275
@ xmom
Definition: ERF_IndexDefines.H:273
@ None
Definition: ERF_LSM_Types.H:6
@ qt
Definition: ERF_Kessler.H:30
@ ng
Definition: ERF_Morrison.H:51
@ xvel
Definition: ERF_IndexDefines.H:255
@ zvel
Definition: ERF_IndexDefines.H:257
@ yvel
Definition: ERF_IndexDefines.H:256
@ q
Definition: ERF_WSM6.H:294
void apply(const amrex::Box &bx, const amrex::Box &domain, const int quantity, const int flux_comp, const amrex::Array4< const amrex::Real > &state, const amrex::Array4< const amrex::Real > &prim, const amrex::Array4< const amrex::Real > &base_state, const amrex::Array4< const amrex::Real > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &w, const amrex::Array4< amrex::Real > &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 > &dx_inv, const erf_wall_thermodynamics::Boundary &walls, const amrex::Real alpha_T, const amrex::Real alpha_C, const amrex::Real rdOcp, const bool cloudy=false)
Definition: ERF_CloudChamberWallFlux.H:1037
void apply(const Box &bx, const Box &domain, const Array4< const Real > &state, const Array4< const Real > &base_state, const Array4< const Real > &u, const Array4< const Real > &v, const Array4< const Real > &w, const Array4< Real > &tau12, const Array4< Real > &tau13, const Array4< Real > &tau23, const GpuArray< Real, AMREX_SPACEDIM > &dx_inv, const erf_wall_thermodynamics::Boundary &walls, const Real rdOcp, const bool cloudy)
Definition: ERF_CloudChamberWallStress.H:195
bool has_momentum_wall(const erf_wall_thermodynamics::Boundary &walls) noexcept
Definition: ERF_CloudChamberWallStress.H:245
amrex::GpuArray< FaceWall, 2 *AMREX_SPACEDIM > Boundary
Definition: ERF_WallThermodynamics.H:70
AdvType dycore_vert_adv_type
Vertical advection scheme for dynamical-core variables.
Definition: ERF_AdvStruct.H:444
AdvType dycore_horiz_adv_type
Horizontal advection scheme for dynamical-core variables.
Definition: ERF_AdvStruct.H:443
amrex::Real dycore_vert_upw_frac
Upwind blending fraction for vertical dynamical-core advection.
Definition: ERF_AdvStruct.H:454
amrex::Real dycore_horiz_upw_frac
Upwind blending fraction for horizontal dynamical-core advection.
Definition: ERF_AdvStruct.H:453
Definition: ERF_DiffStruct.H:24
MolecDiffType molec_diff_type
Selected molecular transport model.
Definition: ERF_DiffStruct.H:96
amrex::Real alpha_C
Kinematic scalar diffusivity [m2/s].
Definition: ERF_DiffStruct.H:100
amrex::Real alpha_T
Kinematic temperature diffusivity [m2/s].
Definition: ERF_DiffStruct.H:99
Definition: ERF_EBStruct.H:36
EBBoundaryType eb_boundary_type
Boundary condition model applied on embedded-boundary surfaces.
Definition: ERF_EBStruct.H:75
amrex::Vector< int > fixed_density
Per-level flag selecting fixed-density treatment; always 1 at an anelastic level.
Definition: ERF_DataStruct.H:2631
amrex::Vector< TurbChoice > turbChoice
Turbulence options for each AMR level.
Definition: ERF_DataStruct.H:2620
MoistureType moisture_type
Moisture or microphysics model.
Definition: ERF_DataStruct.H:2942
bool use_rotate_surface_flux
Whether MOST surface fluxes are rotated with terrain.
Definition: ERF_DataStruct.H:2784
EBChoice ebChoice
Embedded-boundary options.
Definition: ERF_DataStruct.H:2621
bool implicit_thermal_diffusion
Whether implicit vertical thermal diffusion is included.
Definition: ERF_DataStruct.H:2660
amrex::Real rdOcp
Ratio of dry-air gas constant to c_p.
Definition: ERF_DataStruct.H:2738
static MeshType mesh_type
Vertical mesh representation.
Definition: ERF_DataStruct.H:2604
AdvChoice advChoice
Advection-related options.
Definition: ERF_DataStruct.H:2616
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > abl_pressure_grad
Applied ABL pressure-gradient forcing vector.
Definition: ERF_DataStruct.H:2983
amrex::Vector< int > anelastic
Per-level flag selecting anelastic dynamics.
Definition: ERF_DataStruct.H:2629
amrex::Vector< AnelasticType > anelastic_type
Per-level two-stage scheme used by the anelastic integrator.
Definition: ERF_DataStruct.H:2630
amrex::Vector< amrex::Vector< amrex::Real > > vert_implicit_fac
Per-level, per-stage implicit vertical diffusion factors.
Definition: ERF_DataStruct.H:2657
static TerrainType terrain_type
Terrain or immersed-boundary representation.
Definition: ERF_DataStruct.H:2589
DiffChoice diffChoice
Diffusion-related options.
Definition: ERF_DataStruct.H:2617
Definition: ERF_TurbStruct.H:119
RANSType rans_type
Selected RANS closure.
Definition: ERF_TurbStruct.H:877
bool uses_eamxx_shoc() const noexcept
Query whether this level uses the EAMxx SHOC PBL scheme.
Definition: ERF_TurbStruct.H:915
bool uses_native_shoc() const noexcept
Query whether this level uses the native SHOC PBL scheme.
Definition: ERF_TurbStruct.H:924
LESType les_type
Selected LES closure.
Definition: ERF_TurbStruct.H:826
bool use_kturb
Whether any turbulence model is active.
Definition: ERF_TurbStruct.H:977
PBLType pbl_type
Selected PBL closure.
Definition: ERF_TurbStruct.H:909
erf_wall_thermodynamics::Boundary wall_boundary() const noexcept
Collect thermodynamic boundary conditions for all chamber walls.
Definition: ERF_CloudChamber.H:62
bool has_moisture
Definition: ERF_CloudChamber.H:43
bool physical_initialization
Definition: ERF_CloudChamber.H:44