26 const auto&
dom_lo = lbound(domain);
27 const auto&
dom_hi = ubound(domain);
38 Vector<BCRec> bcrs(ncomp);
40 GpuArray<GpuArray<Real, AMREX_SPACEDIM*2>,
NBCVAR_max> l_bc_extdir_vals_d;
42 const int* bxlo = bx.loVect();
43 const int* bxhi = bx.hiVect();
44 const int* dlo = domain.loVect();
45 const int* dhi = domain.hiVect();
47 for (
int nc = 0;
nc < ncomp;
nc++)
52 for (
int dir = 0; dir < AMREX_SPACEDIM; dir++)
54 bcrs[
nc].setLo(dir, ( bxlo[dir]<=dlo[dir]
56 bcrs[
nc].setHi(dir, ( bxhi[dir]>=dhi[dir]
60 for (
int ori = 0; ori < 2*AMREX_SPACEDIM; ori++) {
65 Gpu::DeviceVector<BCRec> bcrs_d(ncomp);
66 Gpu::copyAsync(Gpu::hostToDevice, bcrs.begin(), bcrs.end(), bcrs_d.begin());
67 const BCRec* bc_ptr = bcrs_d.data();
69 GeometryData
const& geomdata =
m_geom.data();
70 bool is_periodic_in_x = geomdata.isPeriodic(0);
71 bool is_periodic_in_y = geomdata.isPeriodic(1);
74 if (!is_periodic_in_x)
77 Box bx_xlo(bx); bx_xlo.setBig (0,
dom_lo.x-1);
78 Box bx_xhi(bx); bx_xhi.setSmall(0,
dom_hi.x+1);
86 bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
88 int dest_comp = icomp+n;
92 int l_bc_type = bc_ptr[n].lo(0);
98 dest_arr(i,j,k,dest_comp) = th_bc_ptr[k];
100 dest_arr(i,j,k,dest_comp) = l_bc_extdir_vals_d[bc_comp][0];
105 dest_arr(i,j,k,dest_comp) =
rho * th_bc_ptr[k];
107 dest_arr(i,j,k,dest_comp) =
rho * l_bc_extdir_vals_d[bc_comp][0];
111 bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
113 int dest_comp = icomp+n;
117 int h_bc_type = bc_ptr[n].hi(0);
123 dest_arr(i,j,k,dest_comp) = th_bc_ptr[k];
125 dest_arr(i,j,k,dest_comp) = l_bc_extdir_vals_d[bc_comp][3];
130 dest_arr(i,j,k,dest_comp) =
rho * th_bc_ptr[k];
132 dest_arr(i,j,k,dest_comp) =
rho * l_bc_extdir_vals_d[bc_comp][3];
139 if (!is_periodic_in_y)
142 Box bx_ylo(bx); bx_ylo.setBig (1,
dom_lo.y-1);
143 Box bx_yhi(bx); bx_yhi.setSmall(1,
dom_hi.y+1);
148 bx_ylo.grow(2,
ng[2]);
149 bx_yhi.grow(2,
ng[2]);
152 bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
154 int dest_comp = icomp+n;
158 int l_bc_type = bc_ptr[n].lo(1);
163 dest_arr(i,j,k,dest_comp) = th_bc_ptr[k];
165 dest_arr(i,j,k,dest_comp) = l_bc_extdir_vals_d[bc_comp][1];
170 dest_arr(i,j,k,dest_comp) =
rho * th_bc_ptr[k];
172 dest_arr(i,j,k,dest_comp) =
rho * l_bc_extdir_vals_d[bc_comp][1];
176 bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
178 int dest_comp = icomp+n;
182 int h_bc_type = bc_ptr[n].hi(1);
187 dest_arr(i,j,k,dest_comp) = th_bc_ptr[k];
189 dest_arr(i,j,k,dest_comp) = l_bc_extdir_vals_d[bc_comp][4];
194 dest_arr(i,j,k,dest_comp) =
rho * th_bc_ptr[k];
196 dest_arr(i,j,k,dest_comp) =
rho * l_bc_extdir_vals_d[bc_comp][4];
205 if (!is_periodic_in_x)
208 Box bx_xlo(bx); bx_xlo.setBig (0,
dom_lo.x-1);
209 Box bx_xhi(bx); bx_xhi.setSmall(0,
dom_hi.x+1);
210 if (bx_xlo.smallEnd(2) != domain.smallEnd(2)) bx_xlo.growLo(2,
ng[2]);
211 if (bx_xlo.bigEnd(2) != domain.bigEnd(2)) bx_xlo.growHi(2,
ng[2]);
212 if (bx_xhi.smallEnd(2) != domain.smallEnd(2)) bx_xhi.growLo(2,
ng[2]);
213 if (bx_xhi.bigEnd(2) != domain.bigEnd(2)) bx_xhi.growHi(2,
ng[2]);
215 bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
217 int dest_comp = icomp+n;
218 int l_bc_type = bc_ptr[n].lo(0);
219 int iflip =
dom_lo.x - 1 - i;
221 dest_arr(i,j,k,dest_comp) = dest_arr(
dom_lo.x,j,k,dest_comp);
223 dest_arr(i,j,k,dest_comp) = dest_arr(
dom_lo.x,j,k,dest_comp);
225 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
227 dest_arr(i,j,k,dest_comp) = -dest_arr(iflip,j,k,dest_comp);
229 Real delta_i = (
dom_lo.x - i);
230 dest_arr(i,j,k,dest_comp) = (1.0 + delta_i)*dest_arr(
dom_lo.x,j,k,dest_comp) - delta_i*dest_arr(
dom_lo.x+1,j,k,dest_comp);
233 bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
235 int dest_comp = icomp+n;
236 int h_bc_type = bc_ptr[n].hi(0);
237 int iflip = 2*
dom_hi.x + 1 - i;
239 dest_arr(i,j,k,dest_comp) = dest_arr(
dom_hi.x,j,k,dest_comp);
241 dest_arr(i,j,k,dest_comp) = dest_arr(
dom_hi.x,j,k,dest_comp);
243 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
245 dest_arr(i,j,k,dest_comp) = -dest_arr(iflip,j,k,dest_comp);
247 Real delta_i = (i -
dom_hi.x);
248 dest_arr(i,j,k,dest_comp) = (1.0 + delta_i)*dest_arr(
dom_hi.x,j,k,dest_comp) - delta_i*dest_arr(
dom_hi.x-1,j,k,dest_comp);
254 if (!is_periodic_in_y)
257 Box bx_ylo(bx); bx_ylo.setBig (1,
dom_lo.y-1);
258 Box bx_yhi(bx); bx_yhi.setSmall(1,
dom_hi.y+1);
259 if (bx_ylo.smallEnd(2) != domain.smallEnd(2)) bx_ylo.growLo(2,
ng[2]);
260 if (bx_ylo.bigEnd(2) != domain.bigEnd(2)) bx_ylo.growHi(2,
ng[2]);
261 if (bx_yhi.smallEnd(2) != domain.smallEnd(2)) bx_yhi.growLo(2,
ng[2]);
262 if (bx_yhi.bigEnd(2) != domain.bigEnd(2)) bx_yhi.growHi(2,
ng[2]);
264 bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
266 int dest_comp = icomp+n;
267 int l_bc_type = bc_ptr[n].lo(1);
268 int jflip =
dom_lo.y - 1 - j;
270 dest_arr(i,j,k,dest_comp) = dest_arr(i,
dom_lo.y,k,dest_comp);
272 dest_arr(i,j,k,dest_comp) = dest_arr(i,
dom_lo.y,k,dest_comp);
274 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
276 dest_arr(i,j,k,dest_comp) = -dest_arr(i,jflip,k,dest_comp);
278 Real delta_j = (
dom_lo.y - j);
279 dest_arr(i,j,k,dest_comp) = (1.0 + delta_j)*dest_arr(i,
dom_lo.y,k,dest_comp) - delta_j*dest_arr(i,
dom_lo.y+1,k,dest_comp);
283 bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
285 int dest_comp = icomp+n;
286 int h_bc_type = bc_ptr[n].hi(1);
287 int jflip = 2*
dom_hi.y + 1 - j;
289 dest_arr(i,j,k,dest_comp) = dest_arr(i,
dom_hi.y,k,dest_comp);
291 dest_arr(i,j,k,dest_comp) = dest_arr(i,
dom_hi.y,k,dest_comp);
293 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
295 dest_arr(i,j,k,dest_comp) = -dest_arr(i,jflip,k,dest_comp);
297 Real delta_j = (j -
dom_hi.y);
298 dest_arr(i,j,k,dest_comp) = (1.0 + delta_j)*dest_arr(i,
dom_hi.y,k,dest_comp) - delta_j*dest_arr(i,
dom_hi.y-1,k,dest_comp);
303 Gpu::streamSynchronize();
const auto & dom_hi
Definition: ERF_DiffSetup.H:10
const auto & dom_lo
Definition: ERF_DiffSetup.H:9
#define RhoScalar_comp
Definition: ERF_IndexDefines.H:40
#define Rho_comp
Definition: ERF_IndexDefines.H:36
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
#define NBCVAR_max
Definition: ERF_IndexDefines.H:29
#define NSCALARS
Definition: ERF_IndexDefines.H:16
void impose_lateral_cons_bcs(const amrex::Array4< amrex::Real > &dest_arr, const amrex::Array4< amrex::Real const > &xvel_arr, const amrex::Array4< amrex::Real const > &yvel_arr, const amrex::Box &bx, const amrex::Box &domain, int icomp, int ncomp, amrex::IntVect ng, const amrex::Real time)
Definition: ERF_BoundaryConditionsCons.cpp:18
@ RhoScalar_bc_comp
Definition: ERF_IndexDefines.H:80
@ open
Definition: ERF_IndexDefines.H:215
@ reflect_odd
Definition: ERF_IndexDefines.H:205
@ hoextrap
Definition: ERF_IndexDefines.H:216
@ foextrap
Definition: ERF_IndexDefines.H:208
@ ext_dir
Definition: ERF_IndexDefines.H:209
@ ext_dir_prim
Definition: ERF_IndexDefines.H:211
@ ext_dir_upwind
Definition: ERF_IndexDefines.H:217
@ int_dir
Definition: ERF_IndexDefines.H:206
@ reflect_even
Definition: ERF_IndexDefines.H:207
@ rho
Definition: ERF_Kessler.H:22
@ ng
Definition: ERF_Morrison.H:48
@ nc
Definition: ERF_Morrison.H:44