376 FArrayBox isotropy_zi, brunt_zi, w_sec_zi, thetal_zi;
378 isotropy_zi.resize(iface_box, 1, The_Async_Arena());
379 brunt_zi.resize(iface_box, 1, The_Async_Arena());
380 w_sec_zi.resize(iface_box, 1, The_Async_Arena());
381 thetal_zi.resize(iface_box, 1, The_Async_Arena());
383 interpolate_cc_to_iface(col, col.
isotropy, isotropy_zi, 0.0);
384 interpolate_cc_to_iface(col, col.
brunt, brunt_zi, shoc_large_neg());
385 interpolate_cc_to_iface(col, col.
w_sec, w_sec_zi, (2.0_rt / 3.0_rt) * shoc_min_tke());
386 interpolate_cc_to_iface(col, col.
thetal, thetal_zi, 0.0);
388 auto w3 = col.
w3.array();
389 const auto w_sec = col.
w_sec.const_array();
390 const auto thl_sec = col.
thl_sec.const_array();
391 const auto wthl_sec = col.
wthl_sec.const_array();
392 const auto tke = col.
tke.const_array();
393 const auto dz = col.
dz.const_array();
394 const auto isotropy_i = isotropy_zi.const_array();
395 const auto brunt_i = brunt_zi.const_array();
396 const auto w_sec_i = w_sec_zi.const_array();
397 const auto thetal_i = thetal_zi.const_array();
398 const auto zt = col.
zt.const_array();
399 const auto zi = col.
zi.const_array();
400 const auto layout = col.
layout;
401 const Box col_box(IntVect(0,0,0), IntVect(layout.ncell - 1, 0, 0));
402 ParallelFor(col_box, [=] AMREX_GPU_DEVICE (
int ic,
int,
int) noexcept
405 w3(ic,layout.nlev,0) = 0.0_rt;
407 for (
int k = 1; k < layout.nlev; ++k) {
413 const Real dz_zt_k = amrex::max(
dz(ic,k,0), 1.0e-12_rt);
414 const Real dz_zt_km1 = amrex::max(
dz(ic,k-1,0), 1.0e-12_rt);
415 const Real dz_zi = cell_spacing_at_iface(zt,
zi, layout, ic, k);
416 const Real thedz = 1.0_rt / dz_zi;
417 const Real thedz2 = 1.0_rt / (dz_zt_k + dz_zt_km1);
418 const Real iso = isotropy_i(ic,k,0);
419 const Real isosq = iso * iso;
420 const Real buoy_sgs2 = isosq * brunt_i(ic,k,0);
421 const Real bet2 =
CONST_GRAV / amrex::max(thetal_i(ic,k,0), 1.0e-12_rt);
427 const Real thl_sec_diff = thl_sec(ic,amrex::min(k+1, layout.nlev),0) - thl_sec(ic,k-1,0);
428 const Real wthl_sec_diff = wthl_sec(ic,amrex::min(k+1, layout.nlev),0) - wthl_sec(ic,k-1,0);
429 const Real wsec_diff = w_sec(ic,k,0) - w_sec(ic,k-1,0);
430 const Real tke_diff = tke(ic,k,0) - tke(ic,k-1,0);
433 const Real a0 = (0.52_rt / (c * c)) / amrex::max(c - 2.0_rt, 1.0e-12_rt);
434 const Real a1 = 0.87_rt / (c * c);
435 const Real a2 = 0.5_rt / c;
436 const Real a3 = 0.6_rt / (c * amrex::max(c - 2.0_rt, 1.0e-12_rt));
437 const Real a4 = 2.4_rt / (3.0_rt * c + 5.0_rt);
438 const Real a5 = 0.6_rt / (c * (3.0_rt + 5.0_rt * c));
439 const Real bet2_sq = bet2 * bet2;
440 const Real bet2_cu = bet2_sq * bet2;
441 const Real iso_cu = isosq * iso;
443 const Real f0 = thedz2 * bet2_cu * isosq * isosq *
444 wthl_sec(ic,k,0) * thl_sec_diff;
445 const Real f1 = thedz2 * bet2_sq * iso_cu *
446 (wthl_sec(ic,k,0) * wthl_sec_diff +
447 0.5_rt * w_sec_i(ic,k,0) * thl_sec_diff);
448 const Real f2 = thedz * bet2 * isosq * wthl_sec(ic,k,0) * wsec_diff +
449 2.0_rt * thedz2 * bet2 * isosq * w_sec_i(ic,k,0) * wthl_sec_diff;
450 const Real f3 = thedz2 * bet2 * isosq * w_sec_i(ic,k,0) * wthl_sec_diff +
451 thedz * bet2 * isosq * (wthl_sec(ic,k,0) * tke_diff);
452 const Real f4 = thedz * iso * w_sec_i(ic,k,0) * (wsec_diff + tke_diff);
453 const Real f5 = thedz * iso * w_sec_i(ic,k,0) * wsec_diff;
455 const Real denom0 = signed_denominator(1.0_rt - (a1 +
a3) * buoy_sgs2);
456 const Real omega0 =
a4 / signed_denominator(1.0_rt - a5 * buoy_sgs2);
457 const Real omega1 = omega0 / (2.0_rt * c);
458 const Real omega2 = omega1 * f3 + 1.25_rt * omega0 * f4;
459 const Real x0 = (
a2 * buoy_sgs2 * (1.0_rt -
a3 * buoy_sgs2)) / denom0;
460 const Real y0 = (2.0_rt *
a2 * buoy_sgs2 * x0) / signed_denominator(1.0_rt -
a3 * buoy_sgs2);
461 const Real x1 = (a0 * f0 + a1 * f1 +
a2 * (1.0_rt -
a3 * buoy_sgs2) * f2) / denom0;
462 const Real y1 = (2.0_rt *
a2 * (buoy_sgs2 * x1 + (a0 / amrex::max(a1, 1.0e-12_rt)) * f0 + f1)) /
463 signed_denominator(1.0_rt -
a3 * buoy_sgs2);
464 const Real aa0 = omega0 * x0 + omega1 * y0;
465 const Real aa1 = omega0 * x1 + omega1 * y1 + omega2;
467 const Real denom = signed_denominator(c - 1.2_rt * x0 + aa0);
468 Real w3_val = (aa1 - 1.2_rt * x1 - 1.5_rt * f5) / denom;
474 apply_top_taper_to_third_moments(col, opts);
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:53
static void clip_third_moments(const ShocColumnData &col, const amrex::FArrayBox &w_sec_zi, amrex::FArrayBox &w3)
Definition: ERF_ShocMoments.cpp:351
@ 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