23 void apply(
const int lev,
const amrex::MFIter& mfi)
const
25 const auto& geom =
m_phi.repo().mesh().Geom(lev);
26 const auto& idx = geom.InvCellSizeArray();
27 const auto& qcritphi =
m_qcritphi(lev).array(mfi);
28 const auto& phi =
m_phi(lev).const_array(mfi);
31 const auto& bx_in = mfi.tilebox();
32 const auto& bx = Stencil::box(bx_in, geom);
37 bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
noexcept {
38 amrex::Real cp1, c, cm1, ux, uy, uz, vx, vy, vz, wx, wy, wz;
43 ux = (cp1 * phi(i + 1, j, k, 0) + c * phi(i, j, k, 0) +
44 cm1 * phi(i - 1, j, k, 0)) *
46 vx = (cp1 * phi(i + 1, j, k, 1) + c * phi(i, j, k, 1) +
47 cm1 * phi(i - 1, j, k, 1)) *
49 wx = (cp1 * phi(i + 1, j, k, 2) + c * phi(i, j, k, 2) +
50 cm1 * phi(i - 1, j, k, 2)) *
57 uy = (cp1 * phi(i, j + 1, k, 0) + c * phi(i, j, k, 0) +
58 cm1 * phi(i, j - 1, k, 0)) *
60 vy = (cp1 * phi(i, j + 1, k, 1) + c * phi(i, j, k, 1) +
61 cm1 * phi(i, j - 1, k, 1)) *
63 wy = (cp1 * phi(i, j + 1, k, 2) + c * phi(i, j, k, 2) +
64 cm1 * phi(i, j - 1, k, 2)) *
71 uz = (cp1 * phi(i, j, k + 1, 0) + c * phi(i, j, k, 0) +
72 cm1 * phi(i, j, k - 1, 0)) *
74 vz = (cp1 * phi(i, j, k + 1, 1) + c * phi(i, j, k, 1) +
75 cm1 * phi(i, j, k - 1, 1)) *
77 wz = (cp1 * phi(i, j, k + 1, 2) + c * phi(i, j, k, 2) +
78 cm1 * phi(i, j, k - 1, 2)) *
81 const amrex::Real S2 =
82 std::pow(ux, 2) + std::pow(vy, 2) + std::pow(wz, 2) +
83 0.5 * std::pow(uy + vx, 2) + 0.5 * std::pow(vz + wy, 2) +
84 0.5 * std::pow(wx + uz, 2);
86 const amrex::Real W2 = 0.5 * std::pow(uy - vx, 2) +
87 0.5 * std::pow(vz - wy, 2) +
88 0.5 * std::pow(wx - uz, 2);
91 0.5 * (W2 / amrex::max(1e-14, S2) - 1.0);
93 qcritphi(i, j, k) = 0.5 * (W2 - S2);