Impose lateral boundary conditions on base-state variables.
22 BL_PROFILE_VAR(
"impose_lateral_base_bcs()",impose_lateral_base_bcs);
28 const int* bxlo = bx.loVect();
29 const int* bxhi = bx.hiVect();
31 const int* dlo = domain.loVect();
32 const int* dhi = domain.hiVect();
34 const auto& dom_lo = lbound(domain);
35 const auto& dom_hi = ubound(domain);
46 Vector<BCRec> bcrs(ncomp);
50 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]
61 Gpu::DeviceVector<BCRec> bcrs_d(ncomp);
62 Gpu::copyAsync(Gpu::hostToDevice, bcrs.begin(), bcrs.end(), bcrs_d.begin());
63 const BCRec* bc_ptr = bcrs_d.data();
65 GeometryData
const& geomdata =
m_geom.data();
66 bool is_periodic_in_x = geomdata.isPeriodic(0);
67 bool is_periodic_in_y = geomdata.isPeriodic(1);
71 if (!is_periodic_in_x)
74 Box bx_xlo(bx); bx_xlo.setBig (0,dom_lo.x-1);
75 Box bx_xhi(bx); bx_xhi.setSmall(0,dom_hi.x+1);
78 bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
81 int l_bc_type = bc_ptr[n].lo(0);
82 int iflip = dom_lo.x - 1 - i;
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(dom_lo.x,j,k,dest_comp);
88 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
91 bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
94 int h_bc_type = bc_ptr[n].hi(0);
95 int iflip = 2*dom_hi.x + 1 - i;
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(dom_hi.x,j,k,dest_comp);
101 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
107 if (!is_periodic_in_y)
110 Box bx_ylo(bx); bx_ylo.setBig (1,dom_lo.y-1);
111 Box bx_yhi(bx); bx_yhi.setSmall(1,dom_hi.y+1);
112 if (bx_ylo.smallEnd(2) != domain.smallEnd(2)) bx_ylo.growLo(2,nghost[2]);
113 if (bx_ylo.bigEnd(2) != domain.bigEnd(2)) bx_ylo.growHi(2,nghost[2]);
114 if (bx_yhi.smallEnd(2) != domain.smallEnd(2)) bx_yhi.growLo(2,nghost[2]);
115 if (bx_yhi.bigEnd(2) != domain.bigEnd(2)) bx_yhi.growHi(2,nghost[2]);
117 bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
120 int l_bc_type = bc_ptr[n].lo(1);
121 int jflip = dom_lo.y - 1 - j;
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,dom_lo.y,k,dest_comp);
127 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
131 bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
134 int h_bc_type = bc_ptr[n].hi(1);
135 int jflip = 2*dom_hi.y + 1 - j;
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,dom_hi.y,k,dest_comp);
141 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
149 if (!is_periodic_in_x)
152 Box bx_xlo(bx); bx_xlo.setBig (0,dom_lo.x-1);
153 Box bx_xhi(bx); bx_xhi.setSmall(0,dom_hi.x+1);
154 if (bx_xlo.smallEnd(2) != domain.smallEnd(2)) bx_xlo.growLo(2,nghost[2]);
155 if (bx_xlo.bigEnd(2) != domain.bigEnd(2)) bx_xlo.growHi(2,nghost[2]);
156 if (bx_xhi.smallEnd(2) != domain.smallEnd(2)) bx_xhi.growLo(2,nghost[2]);
157 if (bx_xhi.bigEnd(2) != domain.bigEnd(2)) bx_xhi.growHi(2,nghost[2]);
159 bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
162 int l_bc_type = bc_ptr[n].lo(0);
163 int iflip = dom_lo.x - 1 - i;
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(dom_lo.x,j,k,dest_comp);
169 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
171 dest_arr(i,j,k,dest_comp) = -dest_arr(iflip,j,k,dest_comp);
173 Real delta_i =
static_cast<Real>(dom_lo.x - i);
174 dest_arr(i,j,k,dest_comp) = (
one + delta_i)*dest_arr(dom_lo.x,j,k,dest_comp) - delta_i*dest_arr(dom_lo.x+1,j,k,dest_comp) ;
177 bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
180 int h_bc_type = bc_ptr[n].hi(0);
181 int iflip = 2*dom_hi.x + 1 - i;
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(dom_hi.x,j,k,dest_comp);
187 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
189 dest_arr(i,j,k,dest_comp) = -dest_arr(iflip,j,k,dest_comp);
191 Real delta_i =
static_cast<Real>(i - dom_hi.x);
192 dest_arr(i,j,k,dest_comp) = (
one + delta_i)*dest_arr(dom_hi.x,j,k,dest_comp) - delta_i*dest_arr(dom_hi.x-1,j,k,dest_comp) ;
198 if (!is_periodic_in_y)
201 Box bx_ylo(bx); bx_ylo.setBig (1,dom_lo.y-1);
202 Box bx_yhi(bx); bx_yhi.setSmall(1,dom_hi.y+1);
203 if (bx_ylo.smallEnd(2) != domain.smallEnd(2)) bx_ylo.growLo(2,nghost[2]);
204 if (bx_ylo.bigEnd(2) != domain.bigEnd(2)) bx_ylo.growHi(2,nghost[2]);
205 if (bx_yhi.smallEnd(2) != domain.smallEnd(2)) bx_yhi.growLo(2,nghost[2]);
206 if (bx_yhi.bigEnd(2) != domain.bigEnd(2)) bx_yhi.growHi(2,nghost[2]);
208 bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
211 int l_bc_type = bc_ptr[n].lo(1);
212 int jflip = dom_lo.y - 1 - j;
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,dom_lo.y,k,dest_comp);
218 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
220 dest_arr(i,j,k,dest_comp) = -dest_arr(i,jflip,k,dest_comp);
222 Real delta_j =
static_cast<Real>(dom_lo.y - j);
223 dest_arr(i,j,k,dest_comp) = (
one + delta_j)*dest_arr(i,dom_lo.y,k,dest_comp) - delta_j*dest_arr(i,dom_lo.y+1,k,dest_comp) ;
227 bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
230 int h_bc_type = bc_ptr[n].hi(1);
231 int jflip = 2*dom_hi.y + 1 - j;
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,dom_hi.y,k,dest_comp);
237 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
239 dest_arr(i,j,k,dest_comp) = -dest_arr(i,jflip,k,dest_comp);
241 Real delta_j =
static_cast<Real>(j - dom_hi.y);
242 dest_arr(i,j,k,dest_comp) = (
one + delta_j)*dest_arr(i,dom_hi.y,k,dest_comp) - delta_j*dest_arr(i,dom_hi.y-1,k,dest_comp);
247 Gpu::streamSynchronize();
constexpr amrex::Real one
Definition: ERF_Constants.H:9
ParallelFor(fab_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ rho0_bc_comp
Definition: ERF_IndexDefines.H:113
@ open
Definition: ERF_IndexDefines.H:256
@ reflect_odd
Definition: ERF_IndexDefines.H:245
@ hoextrap
Definition: ERF_IndexDefines.H:250
@ foextrap
Definition: ERF_IndexDefines.H:248
@ int_dir
Definition: ERF_IndexDefines.H:246
@ reflect_even
Definition: ERF_IndexDefines.H:247
@ nc
Definition: ERF_Morrison.H:45