Function for computing the advective tendency for scalars when terrain_type is EB.
55 auto dxInv = cellSizeInv[0], dyInv = cellSizeInv[1], dzInv = cellSizeInv[2];
57 const Box xbx = surroundingNodes(bx,0);
58 const Box ybx = surroundingNodes(bx,1);
59 const Box zbx = surroundingNodes(bx,2);
68 Box bx_xlo, bx_xhi, bx_ylo, bx_yhi;
70 if ( bx.smallEnd(0) == domain.smallEnd(0)) { bx_xlo = makeSlab( bx,0,domain.smallEnd(0));}
73 if ( bx.bigEnd(0) == domain.bigEnd(0)) { bx_xhi = makeSlab( bx,0,domain.bigEnd(0) );}
76 if ( bx.smallEnd(1) == domain.smallEnd(1)) { bx_ylo = makeSlab( bx,1,domain.smallEnd(1));}
79 if ( bx.bigEnd(1) == domain.bigEnd(1)) { bx_yhi = makeSlab( bx,1,domain.bigEnd(1) );}
88 ParallelFor(xbx, ncomp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
90 const int cons_index = icomp + n;
91 const int prim_index = cons_index - 1;
92 const Real prim_on_face = 0.5 * (cell_prim(i,j,k,prim_index) + cell_prim(i-1,j,k,prim_index));
93 (flx_arr[0])(i,j,k,cons_index) = avg_xmom(i,j,k) * prim_on_face;
95 ParallelFor(ybx, ncomp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
97 const int cons_index = icomp + n;
98 const int prim_index = cons_index - 1;
99 const Real prim_on_face = 0.5 * (cell_prim(i,j,k,prim_index) + cell_prim(i,j-1,k,prim_index));
100 (flx_arr[1])(i,j,k,cons_index) = avg_ymom(i,j,k) * prim_on_face;
102 ParallelFor(zbx, ncomp,[=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
104 const int cons_index = icomp + n;
105 const int prim_index = cons_index - 1;
106 const Real prim_on_face = 0.5 * (cell_prim(i,j,k,prim_index) + cell_prim(i,j,k-1,prim_index));
107 (flx_arr[2])(i,j,k,cons_index) = avg_zmom(i,j,k) * prim_on_face;
112 switch(horiz_adv_type) {
114 EBAdvectionSrcForScalarsVert<CENTERED2>(bx, ncomp, icomp, flx_arr, cell_prim,
115 avg_xmom, avg_ymom, avg_zmom, cfg_arr, ax_arr, ay_arr, az_arr,
116 horiz_upw_frac, vert_upw_frac, vert_adv_type);
119 EBAdvectionSrcForScalarsVert<UPWIND3>(bx, ncomp, icomp, flx_arr, cell_prim,
120 avg_xmom, avg_ymom, avg_zmom, cfg_arr, ax_arr, ay_arr, az_arr,
121 horiz_upw_frac, vert_upw_frac, vert_adv_type);
124 EBAdvectionSrcForScalarsVert<CENTERED4>(bx, ncomp, icomp, flx_arr, cell_prim,
125 avg_xmom, avg_ymom, avg_zmom, cfg_arr, ax_arr, ay_arr, az_arr,
126 horiz_upw_frac, vert_upw_frac, vert_adv_type);
129 EBAdvectionSrcForScalarsVert<UPWIND5>(bx, ncomp, icomp, flx_arr, cell_prim,
130 avg_xmom, avg_ymom, avg_zmom, cfg_arr, ax_arr, ay_arr, az_arr,
131 horiz_upw_frac, vert_upw_frac, vert_adv_type);
134 EBAdvectionSrcForScalarsVert<CENTERED6>(bx, ncomp, icomp, flx_arr, cell_prim,
135 avg_xmom, avg_ymom, avg_zmom, cfg_arr, ax_arr, ay_arr, az_arr,
136 horiz_upw_frac, vert_upw_frac, vert_adv_type);
139 AMREX_ASSERT_WITH_MESSAGE(
false,
"Unknown advection scheme! WENO is currently not supported for EB.");
143 ParallelFor(bx, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) noexcept
145 const int cons_index = icomp + n;
146 if (detJ(i,j,k) > 0.)
148 Real invdetJ = 1.0 / detJ(i,j,k);
149 Real mfsq = mf_m(i,j,0) * mf_m(i,j,0);
151 advectionSrc(i,j,k,cons_index) = - invdetJ * mfsq * (
152 ( (flx_arr[0])(i+1,j,k,cons_index) - (flx_arr[0])(i ,j,k,cons_index) ) * dxInv +
153 ( (flx_arr[1])(i,j+1,k,cons_index) - (flx_arr[1])(i,j ,k,cons_index) ) * dyInv +
154 ( (flx_arr[2])(i,j,k+1,cons_index) - (flx_arr[2])(i,j,k ,cons_index) ) * dzInv );
156 advectionSrc(i,j,k,cons_index) = 0.;
164 avg_xmom, avg_ymom, avg_zmom,
165 detJ, cellSizeInv, do_lo);
169 avg_xmom, avg_ymom, avg_zmom,
175 avg_xmom, avg_ymom, avg_zmom,
176 detJ, cellSizeInv, do_lo);
180 avg_xmom, avg_ymom, avg_zmom,
void AdvectionSrcForOpenBC_Tangent_Cons(const amrex::Box &bx, const int &dir, const int &icomp, const int &ncomp, const amrex::Array4< amrex::Real > &cell_rhs, 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::Array4< const amrex::Real > &detJ, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const bool do_lo=false)
void EBAdvectionSrcForScalars(const Box &bx, const int icomp, const int ncomp, const Array4< const Real > &avg_xmom, const Array4< const Real > &avg_ymom, const Array4< const Real > &avg_zmom, const Array4< const Real > &cell_prim, const Array4< Real > &advectionSrc, const Array4< const EBCellFlag > &cfg_arr, const Array4< const Real > &ax_arr, const Array4< const Real > &ay_arr, const Array4< const Real > &az_arr, const Array4< const Real > &detJ, const GpuArray< Real, AMREX_SPACEDIM > &cellSizeInv, const Array4< const Real > &mf_m, const AdvType horiz_adv_type, const AdvType vert_adv_type, const Real horiz_upw_frac, const Real vert_upw_frac, const GpuArray< const Array4< Real >, AMREX_SPACEDIM > &flx_arr, const Box &domain, const BCRec *bc_ptr_h)
Definition: ERF_EBAdvectionSrcForState.cpp:31
@ cons_bc
Definition: ERF_IndexDefines.H:76
@ open
Definition: ERF_IndexDefines.H:186