381 FArrayBox isotropy_zi, brunt_zi, w_sec_zi, thetal_zi;
383 isotropy_zi.resize(iface_box, 1, The_Async_Arena());
384 brunt_zi.resize(iface_box, 1, The_Async_Arena());
385 w_sec_zi.resize(iface_box, 1, The_Async_Arena());
386 thetal_zi.resize(iface_box, 1, The_Async_Arena());
388 interpolate_cc_to_iface(col, col.
isotropy, isotropy_zi, 0.0);
389 interpolate_cc_to_iface(col, col.
brunt, brunt_zi, shoc_large_neg());
390 interpolate_cc_to_iface(col, col.
w_sec, w_sec_zi, (2.0_rt / 3.0_rt) * shoc_min_tke());
391 interpolate_cc_to_iface(col, col.
thetal, thetal_zi, 0.0);
393 auto w3 = col.
w3.array();
394 const auto w_sec = col.
w_sec.const_array();
395 const auto thl_sec = col.
thl_sec.const_array();
396 const auto wthl_sec = col.
wthl_sec.const_array();
397 const auto tke = col.
tke.const_array();
398 const auto dz = col.
dz.const_array();
399 const auto isotropy_i = isotropy_zi.const_array();
400 const auto brunt_i = brunt_zi.const_array();
401 const auto w_sec_i = w_sec_zi.const_array();
402 const auto thetal_i = thetal_zi.const_array();
403 const auto zt = col.
zt.const_array();
404 const auto zi = col.
zi.const_array();
405 const auto layout = col.
layout;
406 const Box col_box(IntVect(0,0,0), IntVect(layout.ncell - 1, 0, 0));
407 ParallelFor(col_box, [=] AMREX_GPU_DEVICE (
int ic,
int,
int) noexcept
410 w3(ic,layout.nlev,0) = 0.0_rt;
412 for (
int k = 1; k < layout.nlev; ++k) {
418 const Real dz_zt_k = amrex::max(
dz(ic,k,0), eps());
419 const Real dz_zt_km1 = amrex::max(
dz(ic,k-1,0), eps());
420 const Real dz_zi = cell_spacing_at_iface(zt,
zi, layout, ic, k);
421 const Real thedz = 1.0_rt / dz_zi;
422 const Real thedz2 = 1.0_rt / (dz_zt_k + dz_zt_km1);
423 const Real iso = isotropy_i(ic,k,0);
424 const Real isosq = iso * iso;
425 const Real buoy_sgs2 = isosq * brunt_i(ic,k,0);
426 const Real bet2 =
CONST_GRAV / amrex::max(thetal_i(ic,k,0), eps());
432 const Real thl_sec_diff = thl_sec(ic,amrex::min(k+1, layout.nlev),0) - thl_sec(ic,k-1,0);
433 const Real wthl_sec_diff = wthl_sec(ic,amrex::min(k+1, layout.nlev),0) - wthl_sec(ic,k-1,0);
434 const Real wsec_diff = w_sec(ic,k,0) - w_sec(ic,k-1,0);
435 const Real tke_diff = tke(ic,k,0) - tke(ic,k-1,0);
438 const Real a0 = (0.52_rt / (c * c)) / amrex::max(c - 2.0_rt, eps());
439 const Real a1 = 0.87_rt / (c * c);
440 const Real a2 = 0.5_rt / c;
441 const Real a3 = 0.6_rt / (c * amrex::max(c - 2.0_rt, eps()));
442 const Real a4 = 2.4_rt / (3.0_rt * c + 5.0_rt);
443 const Real a5 = 0.6_rt / (c * (3.0_rt + 5.0_rt * c));
444 const Real bet2_sq = bet2 * bet2;
445 const Real bet2_cu = bet2_sq * bet2;
446 const Real iso_cu = isosq * iso;
448 const Real f0 = thedz2 * bet2_cu * isosq * isosq *
449 wthl_sec(ic,k,0) * thl_sec_diff;
450 const Real f1 = thedz2 * bet2_sq * iso_cu *
451 (wthl_sec(ic,k,0) * wthl_sec_diff +
452 0.5_rt * w_sec_i(ic,k,0) * thl_sec_diff);
453 const Real f2 = thedz * bet2 * isosq * wthl_sec(ic,k,0) * wsec_diff +
454 2.0_rt * thedz2 * bet2 * isosq * w_sec_i(ic,k,0) * wthl_sec_diff;
455 const Real f3 = thedz2 * bet2 * isosq * w_sec_i(ic,k,0) * wthl_sec_diff +
456 thedz * bet2 * isosq * (wthl_sec(ic,k,0) * tke_diff);
457 const Real f4 = thedz * iso * w_sec_i(ic,k,0) * (wsec_diff + tke_diff);
458 const Real f5 = thedz * iso * w_sec_i(ic,k,0) * wsec_diff;
460 const Real denom0 = signed_denominator(1.0_rt - (a1 +
a3) * buoy_sgs2);
461 const Real omega0 =
a4 / signed_denominator(1.0_rt - a5 * buoy_sgs2);
462 const Real omega1 = omega0 / (2.0_rt * c);
463 const Real omega2 = omega1 * f3 + 1.25_rt * omega0 * f4;
464 const Real x0 = (
a2 * buoy_sgs2 * (1.0_rt -
a3 * buoy_sgs2)) / denom0;
465 const Real y0 = (2.0_rt *
a2 * buoy_sgs2 * x0) / signed_denominator(1.0_rt -
a3 * buoy_sgs2);
466 const Real x1 = (a0 * f0 + a1 * f1 +
a2 * (1.0_rt -
a3 * buoy_sgs2) * f2) / denom0;
467 const Real y1 = (2.0_rt *
a2 * (buoy_sgs2 * x1 + (a0 / amrex::max(a1, eps())) * f0 + f1)) /
468 signed_denominator(1.0_rt -
a3 * buoy_sgs2);
469 const Real aa0 = omega0 * x0 + omega1 * y0;
470 const Real aa1 = omega0 * x1 + omega1 * y1 + omega2;
472 const Real denom = signed_denominator(c - 1.2_rt * x0 + aa0);
473 Real w3_val = (aa1 - 1.2_rt * x1 - 1.5_rt * f5) / denom;
479 apply_top_taper_to_third_moments(col, opts);
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:64
static void clip_third_moments(const ShocColumnData &col, const amrex::FArrayBox &w_sec_zi, amrex::FArrayBox &w3)
Definition: ERF_ShocMoments.cpp:356
@ dz
Definition: ERF_AdvanceWSM6.cpp:104
real(c_double), parameter a2
Definition: ERF_module_model_constants.F90:95
real(c_double), parameter a3
Definition: ERF_module_model_constants.F90:96
real(c_double), parameter a4
Definition: ERF_module_model_constants.F90:97
amrex::FArrayBox dz
Definition: ERF_ShocTypes.H:210
amrex::FArrayBox w3
Definition: ERF_ShocTypes.H:257
amrex::FArrayBox brunt
Definition: ERF_ShocTypes.H:234
amrex::Real c_diag_3rd_mom
Definition: ERF_ShocTypes.H:93