7 template<
typename InterpType_H,
typename InterpType_V>
10 const int& ncomp,
const int& icomp,
11 const amrex::GpuArray<
const amrex::Array4<amrex::Real>, AMREX_SPACEDIM> flx_arr,
12 const amrex::Array4<const amrex::Real>& cell_prim,
13 const amrex::Array4<const amrex::Real>& avg_xmom,
14 const amrex::Array4<const amrex::Real>& avg_ymom,
15 const amrex::Array4<const amrex::Real>& avg_zmom,
16 const amrex::Real horiz_upw_frac,
17 const amrex::Real vert_upw_frac)
20 InterpType_H interp_prim_h(cell_prim);
21 InterpType_V interp_prim_v(cell_prim);
23 const amrex::Box xbx = amrex::surroundingNodes(bx,0);
24 const amrex::Box ybx = amrex::surroundingNodes(bx,1);
25 const amrex::Box zbx = amrex::surroundingNodes(bx,2);
27 amrex::ParallelFor(xbx, ncomp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
29 const int cons_index = icomp + n;
30 const int prim_index = cons_index - 1;
32 amrex::Real interpx(0.);
34 interp_prim_h.InterpolateInX(i,j,k,prim_index,interpx,avg_xmom(i ,j ,k ),horiz_upw_frac);
35 (flx_arr[0])(i,j,k,cons_index) = avg_xmom(i,j,k) * interpx;
37 amrex::ParallelFor(ybx, ncomp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
39 const int cons_index = icomp + n;
40 const int prim_index = cons_index - 1;
42 amrex::Real interpy(0.);
43 interp_prim_h.InterpolateInY(i,j,k,prim_index,interpy,avg_ymom(i ,j ,k ),horiz_upw_frac);
45 (flx_arr[1])(i,j,k,cons_index) = avg_ymom(i,j,k) * interpy;
47 amrex::ParallelFor(zbx, ncomp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
49 const int cons_index = icomp + n;
50 const int prim_index = cons_index - 1;
52 amrex::Real interpz(0.);
54 interp_prim_v.InterpolateInZ(i,j,k,prim_index,interpz,avg_zmom(i ,j ,k ),vert_upw_frac);
56 (flx_arr[2])(i,j,k,cons_index) = avg_zmom(i,j,k) * interpz;
63 template<
typename InterpType_H>
66 const int& ncomp,
const int& icomp,
67 const amrex::GpuArray<
const amrex::Array4<amrex::Real>, AMREX_SPACEDIM> flx_arr,
68 const amrex::Array4<const amrex::Real>& cell_prim,
69 const amrex::Array4<const amrex::Real>& avg_xmom,
70 const amrex::Array4<const amrex::Real>& avg_ymom,
71 const amrex::Array4<const amrex::Real>& avg_zmom,
72 const amrex::Real horiz_upw_frac,
73 const amrex::Real vert_upw_frac,
76 switch(vert_adv_type) {
78 AdvectionSrcForScalarsWrapper<InterpType_H,CENTERED2>(bx, ncomp, icomp,
80 avg_xmom, avg_ymom, avg_zmom,
81 horiz_upw_frac, vert_upw_frac);
84 AdvectionSrcForScalarsWrapper<InterpType_H,UPWIND3>(bx, ncomp, icomp,
86 avg_xmom, avg_ymom, avg_zmom,
87 horiz_upw_frac, vert_upw_frac);
90 AdvectionSrcForScalarsWrapper<InterpType_H,CENTERED4>(bx, ncomp, icomp,
92 avg_xmom, avg_ymom, avg_zmom,
93 horiz_upw_frac, vert_upw_frac);
96 AdvectionSrcForScalarsWrapper<InterpType_H,UPWIND5>(bx, ncomp, icomp,
98 avg_xmom, avg_ymom, avg_zmom,
99 horiz_upw_frac, vert_upw_frac);
102 AdvectionSrcForScalarsWrapper<InterpType_H,CENTERED6>(bx, ncomp, icomp,
104 avg_xmom, avg_ymom, avg_zmom,
105 horiz_upw_frac, vert_upw_frac);
108 AMREX_ASSERT_WITH_MESSAGE(
false,
"Unknown vertical advection scheme!");
void AdvectionSrcForScalarsWrapper(const amrex::Box &bx, const int &ncomp, const int &icomp, const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM > flx_arr, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< const amrex::Real > &avg_xmom, const amrex::Array4< const amrex::Real > &avg_ymom, const amrex::Array4< const amrex::Real > &avg_zmom, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac)
Definition: ERF_AdvectionSrcForScalars.H:9
void AdvectionSrcForScalarsVert(const amrex::Box &bx, const int &ncomp, const int &icomp, const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM > flx_arr, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< const amrex::Real > &avg_xmom, const amrex::Array4< const amrex::Real > &avg_ymom, const amrex::Array4< const amrex::Real > &avg_zmom, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac, const AdvType vert_adv_type)
Definition: ERF_AdvectionSrcForScalars.H:65
AdvType
Definition: ERF_IndexDefines.H:191