Function for computing the slow RHS for the evolution equations for the density, potential temperature and momentum.
118 BL_PROFILE_REGION(
"erf_slow_rhs_pre()");
121 amrex::ignore_unused(ax,ay,az,detJ);
124 const BCRec* bc_ptr_d = domain_bcs_type_d.data();
125 const BCRec* bc_ptr_h = domain_bcs_type_h.data();
130 const MultiFab* t_mean_mf =
nullptr;
131 if (most) t_mean_mf = most->get_mac_avg(0,2);
135 int end_comp = start_comp + num_comp - 1;
141 const bool l_use_terrain = (solverChoice.
terrain_type != TerrainType::None);
142 const bool l_moving_terrain = (solverChoice.
terrain_type == TerrainType::Moving);
143 if (l_moving_terrain) AMREX_ALWAYS_ASSERT (l_use_terrain);
146 const bool l_reflux = (solverChoice.
coupling_type == CouplingType::TwoWay);
151 const bool l_use_turb = ( tc.
les_type == LESType::Smagorinsky ||
152 tc.
les_type == LESType::Deardorff ||
156 const bool l_use_moisture = (solverChoice.
moisture_type != MoistureType::None);
157 const bool l_use_most = (most !=
nullptr);
161 const bool l_anelastic = solverChoice.
anelastic[level];
164 const Box& domain = geom.Domain();
165 const int domlo_z = domain.smallEnd(2);
166 const int domhi_z = domain.bigEnd(2);
168 const GpuArray<Real, AMREX_SPACEDIM> dxInv = geom.InvCellSizeArray();
169 const Real* dx = geom.CellSize();
174 const Array<Real,AMREX_SPACEDIM> grav{0.0, 0.0, -solverChoice.
gravity};
175 const GpuArray<Real,AMREX_SPACEDIM> grav_gpu{grav[0], grav[1], grav[2]};
182 const DistributionMapping& dm = S_data[
IntVars::cons].DistributionMap();
184 MultiFab Omega(convert(ba,IntVect(0,0,1)), dm, 1, 1);
186 std::unique_ptr<MultiFab> expr;
187 std::unique_ptr<MultiFab> dflux_x;
188 std::unique_ptr<MultiFab> dflux_y;
189 std::unique_ptr<MultiFab> dflux_z;
194 Tau11,Tau22,Tau33,Tau12,Tau13,Tau21,Tau23,Tau31,Tau32,
195 SmnSmn,eddyDiffs,geom,solverChoice,most,
196 detJ,mapfac_m,mapfac_u,mapfac_v);
198 dflux_x = std::make_unique<MultiFab>(convert(ba,IntVect(1,0,0)), dm,
nvars, 0);
199 dflux_y = std::make_unique<MultiFab>(convert(ba,IntVect(0,1,0)), dm,
nvars, 0);
200 dflux_z = std::make_unique<MultiFab>(convert(ba,IntVect(0,0,1)), dm,
nvars, 0);
207 Vector<Real> max_scal(nvar, 1.0e34); Gpu::DeviceVector<Real> max_scal_d(nvar);
208 Vector<Real> min_scal(nvar,-1.0e34); Gpu::DeviceVector<Real> min_scal_d(nvar);
209 if (l_use_mono_adv) {
212 GpuTuple<Real,Real> mm = ParReduce(TypeList<ReduceOpMax,ReduceOpMin>{},
213 TypeList<Real, Real>{},
215 [=] AMREX_GPU_DEVICE (
int box_no,
int i,
int j,
int k) noexcept
216 -> GpuTuple<Real,Real>
218 return { ma_s_arr[box_no](i,j,k,ivar), ma_s_arr[box_no](i,j,k,ivar) };
220 max_scal[ivar] = get<0>(mm);
221 min_scal[ivar] = get<1>(mm);
224 Gpu::copy(Gpu::hostToDevice, max_scal.begin(), max_scal.end(), max_scal_d.begin());
225 Gpu::copy(Gpu::hostToDevice, min_scal.begin(), min_scal.end(), min_scal_d.begin());
226 Real* max_s_ptr = max_scal_d.data();
227 Real* min_s_ptr = min_scal_d.data();
236 #pragma omp parallel if (Gpu::notInLaunchRegion())
239 std::array<FArrayBox,AMREX_SPACEDIM> flux;
240 std::array<FArrayBox,AMREX_SPACEDIM> flux_tmp;
244 Box bx = mfi.tilebox();
245 Box tbx = mfi.nodaltilebox(0);
246 Box tby = mfi.nodaltilebox(1);
247 Box tbz = mfi.nodaltilebox(2);
250 if (tbz.smallEnd(2) == domain.smallEnd(2)) {
253 if (tbz.bigEnd(2) == domain.bigEnd(2)+1) {
257 const Array4<const Real> & cell_data = S_data[
IntVars::cons].array(mfi);
258 const Array4<const Real> & cell_prim = S_prim.array(mfi);
259 const Array4<Real> & cell_rhs = S_rhs[
IntVars::cons].array(mfi);
261 const Array4<const Real> & cell_old = S_old[
IntVars::cons].array(mfi);
263 const Array4<Real const>& xmom_src_arr = xmom_src.const_array(mfi);
264 const Array4<Real const>& ymom_src_arr = ymom_src.const_array(mfi);
265 const Array4<Real const>& zmom_src_arr = zmom_src.const_array(mfi);
267 const Array4<Real>& rho_u_old = S_old[
IntVars::xmom].array(mfi);
268 const Array4<Real>& rho_v_old = S_old[
IntVars::ymom].array(mfi);
272 S_scratch[
IntVars::xmom][mfi].template setVal<RunOn::Device>(0.0,tbx);
273 S_scratch[
IntVars::ymom][mfi].template setVal<RunOn::Device>(0.0,tby);
274 S_scratch[
IntVars::zmom][mfi].template setVal<RunOn::Device>(0.0,tbz);
281 const Array4<const Real> & u =
xvel.array(mfi);
282 const Array4<const Real> & v =
yvel.array(mfi);
283 const Array4<const Real> & w =
zvel.array(mfi);
285 const Array4<const Real>& rho_u = S_data[
IntVars::xmom].array(mfi);
286 const Array4<const Real>& rho_v = S_data[
IntVars::ymom].array(mfi);
287 const Array4<const Real>& rho_w = S_data[
IntVars::zmom].array(mfi);
290 const Array4<const Real>& mf_m = mapfac_m->const_array(mfi);
291 const Array4<const Real>& mf_u = mapfac_u->const_array(mfi);
292 const Array4<const Real>& mf_v = mapfac_v->const_array(mfi);
294 const Array4< Real>& omega_arr = Omega.array(mfi);
296 Array4<const Real> z_t;
298 z_t = z_t_mf->array(mfi);
300 z_t = Array4<const Real>{};
303 const Array4<Real>& rho_u_rhs = S_rhs[
IntVars::xmom].array(mfi);
304 const Array4<Real>& rho_v_rhs = S_rhs[
IntVars::ymom].array(mfi);
305 const Array4<Real>& rho_w_rhs = S_rhs[
IntVars::zmom].array(mfi);
307 const Array4<Real const>& mu_turb = l_use_turb ? eddyDiffs->const_array(mfi) : Array4<const Real>{};
310 const Array4<const Real>& z_nd = l_use_terrain ? z_phys_nd->const_array(mfi) : Array4<const Real>{};
313 const Array4<const Real>& p0_arr = p0->const_array(mfi);
318 for (
int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
319 flux[dir].resize(surroundingNodes(bx,dir),2);
320 flux[dir].setVal<RunOn::Device>(0.);
321 if (l_use_mono_adv) {
322 flux_tmp[dir].resize(surroundingNodes(bx,dir),2);
323 flux_tmp[dir].setVal<RunOn::Device>(0.);
326 const GpuArray<const Array4<Real>, AMREX_SPACEDIM>
327 flx_arr{{AMREX_D_DECL(flux[0].array(), flux[1].array(), flux[2].array())}};
328 Array4<Real> tmpx = (l_use_mono_adv) ? flux_tmp[0].array() : Array4<Real>{};
329 Array4<Real> tmpy = (l_use_mono_adv) ? flux_tmp[1].array() : Array4<Real>{};
330 Array4<Real> tmpz = (l_use_mono_adv) ? flux_tmp[2].array() : Array4<Real>{};
331 const GpuArray<Array4<Real>, AMREX_SPACEDIM> flx_tmp_arr{{AMREX_D_DECL(tmpx,tmpy,tmpz)}};
338 Box gbx = mfi.tilebox(); gbx.grow(IntVect(1,1,1));
339 if (gbx.smallEnd(2) < 0) gbx.setSmall(2,0);
340 pprime.resize(gbx,1,The_Async_Arena());
341 const Array4<Real>& pptemp_arr = pprime.array();
342 ParallelFor(gbx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
345 if (cell_data(i,j,k,
RhoTheta_comp) <= 0.) AMREX_DEVICE_PRINTF(
"BAD THETA AT %d %d %d %e %e \n",
346 i,j,k,cell_data(i,j,k,
RhoTheta_comp),cell_data(i,j,k+1,
RhoTheta_comp));
349 printf(
"BAD THETA AT %d %d %d %e %e \n",
350 i,j,k,cell_data(i,j,k,
RhoTheta_comp),cell_data(i,j,k+1,
RhoTheta_comp));
351 amrex::Abort(
"Bad theta in ERF_slow_rhs_pre");
354 Real qv_for_p = (l_use_moisture) ? cell_data(i,j,k,
RhoQ1_comp)/cell_data(i,j,k,
Rho_comp) : 0.0;
359 const Array4<const Real>& pp_arr = (l_anelastic) ? pp_inc.const_array(mfi) : pprime.const_array();
365 BL_PROFILE(
"slow_rhs_making_omega");
366 Box gbxo = surroundingNodes(bx,2); gbxo.grow(IntVect(1,1,1));
372 if (!l_use_terrain) {
373 ParallelFor(gbxo, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept {
374 omega_arr(i,j,k) = rho_w(i,j,k);
379 Box gbxo_lo = gbxo; gbxo_lo.setBig(2,domain.smallEnd(2));
380 int lo_z_face = domain.smallEnd(2);
381 if (gbxo_lo.smallEnd(2) <= lo_z_face) {
382 ParallelFor(gbxo_lo, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept {
383 omega_arr(i,j,k) = 0.;
386 Box gbxo_hi = gbxo; gbxo_hi.setSmall(2,gbxo.bigEnd(2));
387 int hi_z_face = domain.bigEnd(2)+1;
388 if (gbxo_hi.bigEnd(2) >= hi_z_face) {
389 ParallelFor(gbxo_hi, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept {
390 omega_arr(i,j,k) = rho_w(i,j,k);
395 Box gbxo_mid = gbxo; gbxo_mid.setSmall(2,1); gbxo_mid.setBig(2,gbxo.bigEnd(2)-1);
396 ParallelFor(gbxo_mid, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept {
398 Real rho_at_face = 0.5 * (cell_data(i,j,k,
Rho_comp) + cell_data(i,j,k-1,
Rho_comp));
399 omega_arr(i,j,k) =
OmegaFromW(i,j,k,rho_w(i,j,k),rho_u,rho_v,z_nd,dxInv) -
400 rho_at_face * z_t(i,j,k);
404 if (gbxo_mid.smallEnd(2) <= domain.smallEnd(2)) {
405 gbxo_mid.setSmall(2,1);
407 if (gbxo_mid.bigEnd(2) >= domain.bigEnd(2)+1) {
408 gbxo_mid.setBig(2,gbxo.bigEnd(2)-1);
410 ParallelFor(gbxo_mid, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept {
411 omega_arr(i,j,k) =
OmegaFromW(i,j,k,rho_w(i,j,k),rho_u,rho_v,z_nd,dxInv);
422 Array4<Real> tau11,tau22,tau33;
423 Array4<Real> tau12,tau13,tau23;
425 tau11 = Tau11->array(mfi); tau22 = Tau22->array(mfi); tau33 = Tau33->array(mfi);
426 tau12 = Tau12->array(mfi); tau13 = Tau13->array(mfi); tau23 = Tau23->array(mfi);
428 tau11 = Array4<Real>{}; tau22 = Array4<Real>{}; tau33 = Array4<Real>{};
429 tau12 = Array4<Real>{}; tau13 = Array4<Real>{}; tau23 = Array4<Real>{};
432 Array4<Real> tau21,tau31,tau32;
434 tau21 = Tau21->array(mfi); tau31 = Tau31->array(mfi); tau32 = Tau32->array(mfi);
436 tau21 = Array4<Real>{}; tau31 = Array4<Real>{}; tau32 = Array4<Real>{};
440 Array4<Real> SmnSmn_a;
441 if (tc.
les_type == LESType::Deardorff) {
442 SmnSmn_a = SmnSmn->array(mfi);
444 SmnSmn_a = Array4<Real>{};
451 auto const& ax_arr = ebfact.getAreaFrac()[0]->const_array(mfi);
452 auto const& ay_arr = ebfact.getAreaFrac()[1]->const_array(mfi);
453 auto const& az_arr = ebfact.getAreaFrac()[2]->const_array(mfi);
454 const auto& detJ_arr = ebfact.getVolFrac().const_array(mfi);
456 auto const& ax_arr = ax->const_array(mfi);
457 auto const& ay_arr = ay->const_array(mfi);
458 auto const& az_arr = az->const_array(mfi);
459 auto const& detJ_arr = detJ->const_array(mfi);
463 rho_u, rho_v, omega_arr,
464 avg_xmom, avg_ymom, avg_zmom,
465 ax_arr, ay_arr, az_arr, detJ_arr,
466 dxInv, mf_m, mf_u, mf_v,
467 flx_arr, l_const_rho);
471 avg_xmom, avg_ymom, avg_zmom,
472 cell_data, cell_prim, cell_rhs,
473 l_use_mono_adv, max_s_ptr, min_s_ptr,
474 detJ_arr, dxInv, mf_m,
475 l_horiz_adv_type, l_vert_adv_type,
476 l_horiz_upw_frac, l_vert_upw_frac,
477 flx_arr, flx_tmp_arr, domain, bc_ptr_h);
480 Array4<Real> diffflux_x = dflux_x->array(mfi);
481 Array4<Real> diffflux_y = dflux_y->array(mfi);
482 Array4<Real> diffflux_z = dflux_z->array(mfi);
484 Array4<Real> hfx_x = Hfx1->array(mfi);
485 Array4<Real> hfx_y = Hfx2->array(mfi);
486 Array4<Real> hfx_z = Hfx3->array(mfi);
488 Array4<Real> q1fx_x = (Q1fx1) ? Q1fx1->array(mfi) : Array4<Real>{};
489 Array4<Real> q1fx_y = (Q1fx2) ? Q1fx2->array(mfi) : Array4<Real>{};
490 Array4<Real> q1fx_z = (Q1fx3) ? Q1fx3->array(mfi) : Array4<Real>{};
492 Array4<Real> q2fx_z = (Q2fx3) ? Q2fx3->array(mfi) : Array4<Real>{};
493 Array4<Real> diss = Diss->array(mfi);
495 const Array4<const Real> tm_arr = t_mean_mf ? t_mean_mf->const_array(mfi) : Array4<const Real>{};
499 int n_comp = end_comp - n_start + 1;
503 cell_data, cell_prim, cell_rhs,
504 diffflux_x, diffflux_y, diffflux_z,
505 z_nd, ax_arr, ay_arr, az_arr, detJ_arr,
506 dxInv, SmnSmn_a, mf_m, mf_u, mf_v,
507 hfx_x, hfx_y, hfx_z, q1fx_x, q1fx_y, q1fx_z, q2fx_z, diss,
508 mu_turb, solverChoice, level,
509 tm_arr, grav_gpu, bc_ptr_d, l_use_most);
512 cell_data, cell_prim, cell_rhs,
513 diffflux_x, diffflux_y, diffflux_z,
514 dxInv, SmnSmn_a, mf_m, mf_u, mf_v,
515 hfx_z, q1fx_z, q2fx_z, diss,
516 mu_turb, solverChoice, level,
517 tm_arr, grav_gpu, bc_ptr_d, l_use_most);
521 const Array4<Real const>& source_arr = cc_src.const_array(mfi);
522 ParallelFor(bx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
529 if (l_use_terrain && l_moving_terrain) {
530 ParallelFor(bx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
532 cell_rhs(i,j,k,
Rho_comp) *= detJ_arr(i,j,k);
538 if ( l_anelastic && (nrk == 1) )
540 ParallelFor(bx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
553 int lo_z_face = domain.smallEnd(2);
554 int hi_z_face = domain.bigEnd(2)+1;
557 rho_u_rhs, rho_v_rhs, rho_w_rhs,
559 rho_u, rho_v, omega_arr,
560 z_nd, ax_arr, ay_arr, az_arr, detJ_arr,
561 dxInv, mf_m, mf_u, mf_v,
562 l_horiz_adv_type, l_vert_adv_type,
563 l_horiz_upw_frac, l_vert_upw_frac,
564 l_use_terrain, lo_z_face, hi_z_face,
575 rho_u_rhs, rho_v_rhs, rho_w_rhs,
584 rho_u_rhs, rho_v_rhs, rho_w_rhs,
594 ParallelFor(tbx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
598 Real gp_xi = dxInv[0] * (pp_arr(i,j,k) - pp_arr(i-1,j,k));
605 Real gp_zeta_on_iface;
607 gp_zeta_on_iface = 0.5 * dxInv[2] * (
608 pp_arr(i-1,j,k+1) + pp_arr(i,j,k+1)
609 - pp_arr(i-1,j,k ) - pp_arr(i,j,k ) );
610 }
else if (k==domhi_z) {
611 gp_zeta_on_iface = 0.5 * dxInv[2] * (
612 pp_arr(i-1,j,k ) + pp_arr(i,j,k )
613 - pp_arr(i-1,j,k-1) - pp_arr(i,j,k-1) );
615 gp_zeta_on_iface = 0.25 * dxInv[2] * (
616 pp_arr(i-1,j,k+1) + pp_arr(i,j,k+1)
617 - pp_arr(i-1,j,k-1) - pp_arr(i,j,k-1) );
619 gpx -= (met_h_xi/ met_h_zeta) * gp_zeta_on_iface;
625 if (l_use_moisture) {
630 rho_u_rhs(i, j, k) += (-gpx - abl_pressure_grad[0]) / (1.0 + q)
631 + xmom_src_arr(i,j,k);
633 if (l_moving_terrain) {
635 rho_u_rhs(i, j, k) *= h_zeta;
638 if ( l_anelastic && (nrk == 1) ) {
639 rho_u_rhs(i,j,k) *= 0.5;
640 rho_u_rhs(i,j,k) += 0.5 / dt * (rho_u(i,j,k) - rho_u_old(i,j,k));
644 ParallelFor(tby, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
648 Real gp_eta = dxInv[1] * (pp_arr(i,j,k) - pp_arr(i,j-1,k));
654 Real gp_zeta_on_jface;
656 gp_zeta_on_jface = 0.5 * dxInv[2] * (
657 pp_arr(i,j,k+1) + pp_arr(i,j-1,k+1)
658 - pp_arr(i,j,k ) - pp_arr(i,j-1,k ) );
659 }
else if (k==domhi_z) {
660 gp_zeta_on_jface = 0.5 * dxInv[2] * (
661 pp_arr(i,j,k ) + pp_arr(i,j-1,k )
662 - pp_arr(i,j,k-1) - pp_arr(i,j-1,k-1) );
664 gp_zeta_on_jface = 0.25 * dxInv[2] * (
665 pp_arr(i,j,k+1) + pp_arr(i,j-1,k+1)
666 - pp_arr(i,j,k-1) - pp_arr(i,j-1,k-1) );
668 gpy -= (met_h_eta / met_h_zeta) * gp_zeta_on_jface;
674 if (l_use_moisture) {
679 rho_v_rhs(i, j, k) += (-gpy - abl_pressure_grad[1]) / (1.0_rt + q) + ymom_src_arr(i,j,k);
681 if (l_moving_terrain) {
683 rho_v_rhs(i, j, k) *= h_zeta;
686 if ( l_anelastic && (nrk == 1) ) {
687 rho_v_rhs(i,j,k) *= 0.5;
688 rho_v_rhs(i,j,k) += 0.5 / dt * (rho_v(i,j,k) - rho_v_old(i,j,k));
698 if ( (bx.smallEnd(0) == domain.smallEnd(0)) &&
700 Box lo_x_dom_face(bx); lo_x_dom_face.setBig(0,bx.smallEnd(0));
701 ParallelFor(lo_x_dom_face, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
702 rho_u_rhs(i,j,k) = 0.;
705 if ( (bx.bigEnd(0) == domain.bigEnd(0)) &&
707 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);
708 ParallelFor(hi_x_dom_face, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
709 rho_u_rhs(i,j,k) = 0.;
712 if ( (bx.smallEnd(1) == domain.smallEnd(1)) &&
714 Box lo_y_dom_face(bx); lo_y_dom_face.setBig(1,bx.smallEnd(1));
715 ParallelFor(lo_y_dom_face, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
716 rho_v_rhs(i,j,k) = 0.;
719 if ( (bx.bigEnd(1) == domain.bigEnd(1)) &&
721 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);
722 ParallelFor(hi_y_dom_face, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
723 rho_v_rhs(i,j,k) = 0.;
728 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
732 Real gpz = dxInv[2] * ( pp_arr(i,j,k)-pp_arr(i,j,k-1) ) / met_h_zeta;
735 if (l_use_moisture) {
739 rho_w_rhs(i, j, k) += (zmom_src_arr(i,j,k) - gpz - abl_pressure_grad[2]) / (1.0_rt + q);
741 if (l_use_terrain && l_moving_terrain) {
742 rho_w_rhs(i, j, k) *= 0.5 * (detJ_arr(i,j,k) + detJ_arr(i,j,k-1));
746 auto const lo = lbound(bx);
747 auto const hi = ubound(bx);
752 const Array4<const Real>& rho_w_rhs_crse = zmom_crse_rhs->const_array(mfi);
754 Box b2d = bx; b2d.setRange(2,0);
756 if (lo.z > domlo_z) {
757 ParallelFor(b2d, [=] AMREX_GPU_DEVICE (
int i,
int j,
int )
759 rho_w_rhs(i,j,lo.z) = rho_w_rhs_crse(i,j,lo.z);
763 if (hi.z < domhi_z+1) {
764 ParallelFor(b2d, [=] AMREX_GPU_DEVICE (
int i,
int j,
int )
766 rho_w_rhs(i,j,hi.z+1) = rho_w_rhs_crse(i,j,hi.z+1);
772 BL_PROFILE(
"slow_rhs_pre_fluxreg");
776 if (l_reflux && nrk == 2) {
777 int strt_comp_reflux = (l_const_rho) ? 1 : 0;
778 int num_comp_reflux = 1;
779 if (level < finest_level) {
780 fr_as_crse->CrseAdd(mfi,
781 {{AMREX_D_DECL(&(flux[0]), &(flux[1]), &(flux[2]))}},
782 dx, dt, strt_comp_reflux, strt_comp_reflux, num_comp_reflux, RunOn::Device);
785 fr_as_fine->FineAdd(mfi,
786 {{AMREX_D_DECL(&(flux[0]), &(flux[1]), &(flux[2]))}},
787 dx, dt, strt_comp_reflux, strt_comp_reflux, num_comp_reflux, RunOn::Device);
793 Gpu::streamSynchronize();
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_m, const amrex::Array4< const amrex::Real > &mf_u, const amrex::Array4< const amrex::Real > &mf_v, const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_arr, const bool const_rho)
void AdvectionSrcForMom(const amrex::Box &bx, 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 > &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, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &mf_m, const amrex::Array4< const amrex::Real > &mf_u, const amrex::Array4< const amrex::Real > &mf_v, const AdvType horiz_adv_type, const AdvType vert_adv_type, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac, const bool use_terrain, const int lo_z_face, const int hi_z_face, const amrex::Box &domain, const amrex::BCRec *bc_ptr_h)
void AdvectionSrcForScalars(const amrex::Real &dt, 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 > &cur_cons, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< amrex::Real > &src, const bool &use_mono_adv, amrex::Real *max_s_ptr, amrex::Real *min_s_ptr, const amrex::Array4< const amrex::Real > &vf_arr, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &mf_m, 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::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_tmp_arr, const amrex::Box &domain, const amrex::BCRec *bc_ptr_h)
@ nvars
Definition: ERF_DataStruct.H:70
void DiffusionSrcForMom_N(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 > &tau13, const amrex::Array4< const amrex::Real > &tau23, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv, const amrex::Array4< const amrex::Real > &mf_m, const amrex::Array4< const amrex::Real > &mf_u, const amrex::Array4< const amrex::Real > &mf_v)
void DiffusionSrcForState_N(const amrex::Box &bx, const amrex::Box &domain, int start_comp, int num_comp, const bool &exp_most, 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_m, const amrex::Array4< const amrex::Real > &mf_u, const amrex::Array4< const amrex::Real > &mf_v, 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_most)
void DiffusionSrcForMom_T(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 > &tau13, const amrex::Array4< const amrex::Real > &tau21, const amrex::Array4< const amrex::Real > &tau23, const amrex::Array4< const amrex::Real > &tau31, const amrex::Array4< const amrex::Real > &tau32, const amrex::Array4< const amrex::Real > &detJ, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv, const amrex::Array4< const amrex::Real > &mf_m, const amrex::Array4< const amrex::Real > &mf_u, const amrex::Array4< const amrex::Real > &mf_v)
void DiffusionSrcForState_T(const amrex::Box &bx, const amrex::Box &domain, int start_comp, int num_comp, const bool &exp_most, const bool &rot_most, 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 > &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_m, const amrex::Array4< const amrex::Real > &mf_u, const amrex::Array4< const amrex::Real > &mf_v, 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_most)
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getPgivenRTh(const amrex::Real rhotheta, const amrex::Real qv=0.)
Definition: ERF_EOS.H:84
#define PrimQ1_comp
Definition: ERF_IndexDefines.H:53
#define PrimQ2_comp
Definition: ERF_IndexDefines.H:54
#define Rho_comp
Definition: ERF_IndexDefines.H:36
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:42
AdvType
Definition: ERF_IndexDefines.H:191
#define RhoKE_comp
Definition: ERF_IndexDefines.H:38
void erf_make_tau_terms(int level, int nrk, const Vector< BCRec > &domain_bcs_type_h, std::unique_ptr< MultiFab > &z_phys_nd, Vector< MultiFab > &S_data, const MultiFab &xvel, const MultiFab &yvel, const MultiFab &zvel, MultiFab *Tau11, MultiFab *Tau22, MultiFab *Tau33, MultiFab *Tau12, MultiFab *Tau13, MultiFab *Tau21, MultiFab *Tau23, MultiFab *Tau31, MultiFab *Tau32, MultiFab *SmnSmn, MultiFab *eddyDiffs, const Geometry geom, const SolverChoice &solverChoice, std::unique_ptr< ABLMost > &most, std::unique_ptr< MultiFab > &detJ, std::unique_ptr< MultiFab > &mapfac_m, std::unique_ptr< MultiFab > &mapfac_u, std::unique_ptr< MultiFab > &mapfac_v)
Definition: ERF_MakeTauTerms.cpp:12
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_xi_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:101
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_zeta_AtKface(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:173
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 > z_nd, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv)
Definition: ERF_TerrainMetrics.H:374
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:87
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:130
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_eta_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:158
AMREX_FORCE_INLINE amrex::IntVect TileNoZ()
Definition: ERF_TileNoZ.H:11
@ yvel_bc
Definition: ERF_IndexDefines.H:89
@ xvel_bc
Definition: ERF_IndexDefines.H:88
@ ext_dir
Definition: ERF_IndexDefines.H:180
@ ymom
Definition: ERF_IndexDefines.H:141
@ cons
Definition: ERF_IndexDefines.H:139
@ zmom
Definition: ERF_IndexDefines.H:142
@ xmom
Definition: ERF_IndexDefines.H:140
@ xvel
Definition: ERF_IndexDefines.H:130
@ zvel
Definition: ERF_IndexDefines.H:132
@ yvel
Definition: ERF_IndexDefines.H:131
AdvType dycore_vert_adv_type
Definition: ERF_AdvStruct.H:283
amrex::Real dycore_vert_upw_frac
Definition: ERF_AdvStruct.H:293
AdvType dycore_horiz_adv_type
Definition: ERF_AdvStruct.H:282
amrex::Real dycore_horiz_upw_frac
Definition: ERF_AdvStruct.H:292
Definition: ERF_DiffStruct.H:19
MolecDiffType molec_diff_type
Definition: ERF_DiffStruct.H:84
bool use_explicit_most
Definition: ERF_DataStruct.H:645
bool use_mono_adv
Definition: ERF_DataStruct.H:661
DiffChoice diffChoice
Definition: ERF_DataStruct.H:579
amrex::Real gravity
Definition: ERF_DataStruct.H:617
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > abl_pressure_grad
Definition: ERF_DataStruct.H:670
amrex::Vector< TurbChoice > turbChoice
Definition: ERF_DataStruct.H:581
amrex::Vector< int > anelastic
Definition: ERF_DataStruct.H:589
int constant_density
Definition: ERF_DataStruct.H:591
AdvChoice advChoice
Definition: ERF_DataStruct.H:578
MoistureType moisture_type
Definition: ERF_DataStruct.H:664
static TerrainType terrain_type
Definition: ERF_DataStruct.H:567
bool use_rotate_most
Definition: ERF_DataStruct.H:648
CouplingType coupling_type
Definition: ERF_DataStruct.H:663
Definition: ERF_TurbStruct.H:31
PBLType pbl_type
Definition: ERF_TurbStruct.H:201
LESType les_type
Definition: ERF_TurbStruct.H:175