20 BL_PROFILE_VAR(
"impose_lateral_base_bcs()",impose_lateral_base_bcs);
26 const int* bxlo = bx.loVect();
27 const int* bxhi = bx.hiVect();
29 const int* dlo = domain.loVect();
30 const int* dhi = domain.hiVect();
32 const auto&
dom_lo = lbound(domain);
33 const auto&
dom_hi = ubound(domain);
44 Vector<BCRec> bcrs(ncomp);
48 for (
int nc = 0;
nc < ncomp;
nc++)
50 for (
int dir = 0; dir < AMREX_SPACEDIM; dir++)
52 bcrs[
nc].setLo(dir, ( bxlo[dir]<=dlo[dir]
54 bcrs[
nc].setHi(dir, ( bxhi[dir]>=dhi[dir]
59 Gpu::DeviceVector<BCRec> bcrs_d(ncomp);
60 Gpu::copyAsync(Gpu::hostToDevice, bcrs.begin(), bcrs.end(), bcrs_d.begin());
61 const BCRec* bc_ptr = bcrs_d.data();
63 GeometryData
const& geomdata =
m_geom.data();
64 bool is_periodic_in_x = geomdata.isPeriodic(0);
65 bool is_periodic_in_y = geomdata.isPeriodic(1);
69 if (!is_periodic_in_x)
72 Box bx_xlo(bx); bx_xlo.setBig (0,
dom_lo.x-nghost[0]);
73 Box bx_xhi(bx); bx_xhi.setSmall(0,
dom_hi.x+nghost[0]);
76 bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
79 int l_bc_type = bc_ptr[n].lo(0);
80 int iflip =
dom_lo.x - 1 - i;
82 dest_arr(i,j,k,dest_comp) = dest_arr(
dom_lo.x,j,k,dest_comp);
84 dest_arr(i,j,k,dest_comp) = dest_arr(
dom_lo.x,j,k,dest_comp);
86 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
89 bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
92 int h_bc_type = bc_ptr[n].hi(0);
93 int iflip = 2*
dom_hi.x + 1 - i;
95 dest_arr(i,j,k,dest_comp) = dest_arr(
dom_hi.x,j,k,dest_comp);
97 dest_arr(i,j,k,dest_comp) = dest_arr(
dom_hi.x,j,k,dest_comp);
99 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
105 if (!is_periodic_in_y)
108 Box bx_ylo(bx); bx_ylo.setBig (1,
dom_lo.y-nghost[1]);
109 Box bx_yhi(bx); bx_yhi.setSmall(1,
dom_hi.y+nghost[1]);
110 if (bx_ylo.smallEnd(2) != domain.smallEnd(2)) bx_ylo.growLo(2,nghost[2]);
111 if (bx_ylo.bigEnd(2) != domain.bigEnd(2)) bx_ylo.growHi(2,nghost[2]);
112 if (bx_yhi.smallEnd(2) != domain.smallEnd(2)) bx_yhi.growLo(2,nghost[2]);
113 if (bx_yhi.bigEnd(2) != domain.bigEnd(2)) bx_yhi.growHi(2,nghost[2]);
115 bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
118 int l_bc_type = bc_ptr[n].lo(1);
119 int jflip =
dom_lo.y - 1 - j;
121 dest_arr(i,j,k,dest_comp) = dest_arr(i,
dom_lo.y,k,dest_comp);
123 dest_arr(i,j,k,dest_comp) = dest_arr(i,
dom_lo.y,k,dest_comp);
125 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
129 bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
132 int h_bc_type = bc_ptr[n].hi(1);
133 int jflip = 2*
dom_hi.y + 1 - j;
135 dest_arr(i,j,k,dest_comp) = dest_arr(i,
dom_hi.y,k,dest_comp);
137 dest_arr(i,j,k,dest_comp) = dest_arr(i,
dom_hi.y,k,dest_comp);
139 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
147 if (!is_periodic_in_x)
150 Box bx_xlo(bx); bx_xlo.setBig (0,
dom_lo.x-1);
151 Box bx_xhi(bx); bx_xhi.setSmall(0,
dom_hi.x+1);
152 if (bx_xlo.smallEnd(2) != domain.smallEnd(2)) bx_xlo.growLo(2,nghost[2]);
153 if (bx_xlo.bigEnd(2) != domain.bigEnd(2)) bx_xlo.growHi(2,nghost[2]);
154 if (bx_xhi.smallEnd(2) != domain.smallEnd(2)) bx_xhi.growLo(2,nghost[2]);
155 if (bx_xhi.bigEnd(2) != domain.bigEnd(2)) bx_xhi.growHi(2,nghost[2]);
157 bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
160 int l_bc_type = bc_ptr[n].lo(0);
161 int iflip =
dom_lo.x - 1 - i;
163 dest_arr(i,j,k,dest_comp) = dest_arr(
dom_lo.x,j,k,dest_comp);
165 dest_arr(i,j,k,dest_comp) = dest_arr(
dom_lo.x,j,k,dest_comp);
167 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
169 dest_arr(i,j,k,dest_comp) = -dest_arr(iflip,j,k,dest_comp);
171 Real delta_i = (
dom_lo.x - i);
172 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) ;
175 bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
178 int h_bc_type = bc_ptr[n].hi(0);
179 int iflip = 2*
dom_hi.x + 1 - i;
181 dest_arr(i,j,k,dest_comp) = dest_arr(
dom_hi.x,j,k,dest_comp);
183 dest_arr(i,j,k,dest_comp) = dest_arr(
dom_hi.x,j,k,dest_comp);
185 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
187 dest_arr(i,j,k,dest_comp) = -dest_arr(iflip,j,k,dest_comp);
189 Real delta_i = (i -
dom_hi.x);
190 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) ;
196 if (!is_periodic_in_y)
199 Box bx_ylo(bx); bx_ylo.setBig (1,
dom_lo.y-1);
200 Box bx_yhi(bx); bx_yhi.setSmall(1,
dom_hi.y+1);
201 if (bx_ylo.smallEnd(2) != domain.smallEnd(2)) bx_ylo.growLo(2,nghost[2]);
202 if (bx_ylo.bigEnd(2) != domain.bigEnd(2)) bx_ylo.growHi(2,nghost[2]);
203 if (bx_yhi.smallEnd(2) != domain.smallEnd(2)) bx_yhi.growLo(2,nghost[2]);
204 if (bx_yhi.bigEnd(2) != domain.bigEnd(2)) bx_yhi.growHi(2,nghost[2]);
206 bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
209 int l_bc_type = bc_ptr[n].lo(1);
210 int jflip =
dom_lo.y - 1 - j;
212 dest_arr(i,j,k,dest_comp) = dest_arr(i,
dom_lo.y,k,dest_comp);
214 dest_arr(i,j,k,dest_comp) = dest_arr(i,
dom_lo.y,k,dest_comp);
216 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
218 dest_arr(i,j,k,dest_comp) = -dest_arr(i,jflip,k,dest_comp);
220 Real delta_j = (
dom_lo.y - j);
221 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) ;
225 bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
228 int h_bc_type = bc_ptr[n].hi(1);
229 int jflip = 2*
dom_hi.y + 1 - j;
231 dest_arr(i,j,k,dest_comp) = dest_arr(i,
dom_hi.y,k,dest_comp);
233 dest_arr(i,j,k,dest_comp) = dest_arr(i,
dom_hi.y,k,dest_comp);
235 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
237 dest_arr(i,j,k,dest_comp) = -dest_arr(i,jflip,k,dest_comp);
239 Real delta_j = (j -
dom_hi.y);
240 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);
245 Gpu::streamSynchronize();
const auto & dom_hi
Definition: ERF_DiffSetup.H:10
const auto & dom_lo
Definition: ERF_DiffSetup.H:9
@ rho0_bc_comp
Definition: ERF_IndexDefines.H:98
@ 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
@ int_dir
Definition: ERF_IndexDefines.H:206
@ reflect_even
Definition: ERF_IndexDefines.H:207
@ nc
Definition: ERF_Morrison.H:44