389 FArrayBox isotropy_zi, brunt_zi, w_sec_zi, thetal_zi;
391 isotropy_zi.resize(iface_box, 1, The_Async_Arena());
392 brunt_zi.resize(iface_box, 1, The_Async_Arena());
393 w_sec_zi.resize(iface_box, 1, The_Async_Arena());
394 thetal_zi.resize(iface_box, 1, The_Async_Arena());
396 interpolate_cc_to_iface(col, col.
isotropy, isotropy_zi, 0.0);
397 interpolate_cc_to_iface(col, col.
brunt, brunt_zi, shoc_large_neg());
398 interpolate_cc_to_iface(col, col.
w_sec, w_sec_zi, (2.0_rt / 3.0_rt) * shoc_min_tke());
399 interpolate_cc_to_iface(col, col.
thetal, thetal_zi, 0.0);
401 auto w3 = col.
w3.array();
402 const auto w_sec = col.
w_sec.const_array();
403 const auto thl_sec = col.
thl_sec.const_array();
404 const auto wthl_sec = col.
wthl_sec.const_array();
405 const auto tke = col.
tke.const_array();
406 const auto dz = col.
dz.const_array();
407 const auto isotropy_i = isotropy_zi.const_array();
408 const auto brunt_i = brunt_zi.const_array();
409 const auto w_sec_i = w_sec_zi.const_array();
410 const auto thetal_i = thetal_zi.const_array();
411 const auto zt = col.
zt.const_array();
412 const auto zi = col.
zi.const_array();
413 const auto layout = col.
layout;
414 const Box col_box(IntVect(0,0,0), IntVect(layout.ncell - 1, 0, 0));
415 ParallelFor(col_box, [=] AMREX_GPU_DEVICE (
int ic,
int,
int) noexcept
418 w3(ic,layout.nlev,0) = 0.0_rt;
420 for (
int k = 1; k < layout.nlev; ++k) {
426 const Real dz_zt_k = amrex::max(
dz(ic,k,0), eps());
427 const Real dz_zt_km1 = amrex::max(
dz(ic,k-1,0), eps());
428 const Real dz_zi = cell_spacing_at_iface(zt,
zi, layout, ic, k);
429 const Real thedz = 1.0_rt / dz_zi;
430 const Real thedz2 = 1.0_rt / (dz_zt_k + dz_zt_km1);
431 const Real iso = isotropy_i(ic,k,0);
432 const Real isosq = iso * iso;
433 const Real buoy_sgs2 = isosq * brunt_i(ic,k,0);
434 const Real bet2 =
CONST_GRAV / amrex::max(thetal_i(ic,k,0), eps());
440 const Real thl_sec_diff = thl_sec(ic,amrex::min(k+1, layout.nlev),0) - thl_sec(ic,k-1,0);
441 const Real wthl_sec_diff = wthl_sec(ic,amrex::min(k+1, layout.nlev),0) - wthl_sec(ic,k-1,0);
442 const Real wsec_diff = w_sec(ic,k,0) - w_sec(ic,k-1,0);
443 const Real tke_diff = tke(ic,k,0) - tke(ic,k-1,0);
446 const Real a0 = (0.52_rt / (c * c)) / amrex::max(c - 2.0_rt, eps());
447 const Real a1 = 0.87_rt / (c * c);
448 const Real a2 = 0.5_rt / c;
449 const Real a3 = 0.6_rt / (c * amrex::max(c - 2.0_rt, eps()));
450 const Real a4 = 2.4_rt / (3.0_rt * c + 5.0_rt);
451 const Real a5 = 0.6_rt / (c * (3.0_rt + 5.0_rt * c));
452 const Real bet2_sq = bet2 * bet2;
453 const Real bet2_cu = bet2_sq * bet2;
454 const Real iso_cu = isosq * iso;
456 const Real f0 = thedz2 * bet2_cu * isosq * isosq *
457 wthl_sec(ic,k,0) * thl_sec_diff;
458 const Real f1 = thedz2 * bet2_sq * iso_cu *
459 (wthl_sec(ic,k,0) * wthl_sec_diff +
460 0.5_rt * w_sec_i(ic,k,0) * thl_sec_diff);
461 const Real f2 = thedz * bet2 * isosq * wthl_sec(ic,k,0) * wsec_diff +
462 2.0_rt * thedz2 * bet2 * isosq * w_sec_i(ic,k,0) * wthl_sec_diff;
463 const Real f3 = thedz2 * bet2 * isosq * w_sec_i(ic,k,0) * wthl_sec_diff +
464 thedz * bet2 * isosq * (wthl_sec(ic,k,0) * tke_diff);
465 const Real f4 = thedz * iso * w_sec_i(ic,k,0) * (wsec_diff + tke_diff);
466 const Real f5 = thedz * iso * w_sec_i(ic,k,0) * wsec_diff;
468 const Real denom0 = signed_denominator(1.0_rt - (a1 +
a3) * buoy_sgs2);
469 const Real omega0 =
a4 / signed_denominator(1.0_rt - a5 * buoy_sgs2);
470 const Real omega1 = omega0 / (2.0_rt * c);
471 const Real omega2 = omega1 * f3 + 1.25_rt * omega0 * f4;
472 const Real x0 = (
a2 * buoy_sgs2 * (1.0_rt -
a3 * buoy_sgs2)) / denom0;
473 const Real y0 = (2.0_rt *
a2 * buoy_sgs2 * x0) / signed_denominator(1.0_rt -
a3 * buoy_sgs2);
474 const Real x1 = (a0 * f0 + a1 * f1 +
a2 * (1.0_rt -
a3 * buoy_sgs2) * f2) / denom0;
475 const Real y1 = (2.0_rt *
a2 * (buoy_sgs2 * x1 + (a0 / amrex::max(a1, eps())) * f0 + f1)) /
476 signed_denominator(1.0_rt -
a3 * buoy_sgs2);
477 const Real aa0 = omega0 * x0 + omega1 * y0;
478 const Real aa1 = omega0 * x1 + omega1 * y1 + omega2;
480 const Real denom = signed_denominator(c - 1.2_rt * x0 + aa0);
481 Real w3_val = (aa1 - 1.2_rt * x1 - 1.5_rt * f5) / denom;
487 apply_top_taper_to_third_moments(col, opts);
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:56
static void clip_third_moments(const ShocColumnData &col, const amrex::FArrayBox &w_sec_zi, amrex::FArrayBox &w3)
Definition: ERF_ShocMoments.cpp:357
@ dz
Definition: ERF_AdvanceWDM6.cpp:272
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:78
amrex::FArrayBox w3
Definition: ERF_ShocTypes.H:125
amrex::FArrayBox brunt
Definition: ERF_ShocTypes.H:102
amrex::Real c_diag_3rd_mom
Definition: ERF_ShocTypes.H:29