Function to compute 6th order numerical diffusion RHS.
35 Box planebx(bx); planebx.setSmall(2,0); planebx.setBig(2,0);
36 FArrayBox mf_x_bar; mf_x_bar.resize(planebx,1,The_Async_Arena());
37 FArrayBox mf_y_bar; mf_y_bar.resize(planebx,1,The_Async_Arena());
38 const Array4<Real>& mfx_arr = mf_x_bar.array();
39 const Array4<Real>& mfy_arr = mf_y_bar.array();
40 ParallelFor(planebx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
43 mfx_arr(i,j,k) = 0.5 * ( mf_x(i,j-1,k) + mf_x(i,j,k) );
45 mfx_arr(i,j,k) = mf_x(i,j,k);
48 mfy_arr(i,j,k) = 0.5 * ( mf_y(i-1,j,k) + mf_y(i,j,k) );
50 mfy_arr(i,j,k) = mf_y(i,j,k);
55 Real coeff6 = num_diff_coeff / (2.0 * dt);
58 ParallelFor(bx, num_comp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int m) noexcept
60 int n = start_comp + m;
61 Real xflux_lo = 10. * (data(i ,j,k,n) - data(i-1,j,k,n))
62 - 5. * (data(i+1,j,k,n) - data(i-2,j,k,n))
63 + (data(i+2,j,k,n) - data(i-3,j,k,n));
64 if ( (xflux_lo * (data(i,j,k,n) - data(i-1,j,k,n)) ) < 0.) xflux_lo = 0.;
65 Real xflux_hi = 10. * (data(i+1,j,k,n) - data(i ,j,k,n))
66 - 5. * (data(i+2,j,k,n) - data(i-1,j,k,n))
67 + (data(i+3,j,k,n) - data(i-2,j,k,n));
68 if ( (xflux_hi * (data(i+1,j,k,n) - data(i,j,k,n)) ) < 0.) xflux_hi = 0.;
69 Real yflux_lo = 10. * (data(i,j ,k,n) - data(i,j-1,k,n))
70 - 5. * (data(i,j+1,k,n) - data(i,j-2,k,n))
71 + (data(i,j+2,k,n) - data(i,j-3,k,n));
72 if ( (yflux_lo * (data(i,j,k,n) - data(i,j-1,k,n)) ) < 0.) yflux_lo = 0.;
73 Real yflux_hi = 10. * (data(i,j+1,k,n) - data(i,j ,k,n))
74 - 5. * (data(i,j+2,k,n) - data(i,j-1,k,n))
75 + (data(i,j+3,k,n) - data(i,j-2,k,n));
76 if ( (yflux_hi * (data(i,j+1,k,n) - data(i,j,k,n)) ) < 0.) yflux_hi = 0.;
77 rhs(i,j,k,n) += coeff6 * ( (xflux_hi - xflux_lo) * mfx_arr(i,j,0)
78 + (yflux_hi - yflux_lo) * mfy_arr(i,j,0) );
void NumericalDiffusion(const Box &bx, const int start_comp, const int num_comp, const Real dt, const Real num_diff_coeff, const Array4< const Real > &data, const Array4< Real > &rhs, const Array4< const Real > &mf_x, const Array4< const Real > &mf_y, const bool avg_mf_x_y, const bool avg_mf_y_x)
Definition: ERF_NumericalDiffusion.cpp:20