19 const auto& dom_lo = lbound(domain);
20 const auto& dom_hi = ubound(domain);
26 Vector<BCRec> bcrs(ncomp);
36 Gpu::DeviceVector<BCRec> bcrs_d(ncomp);
37 Gpu::copyAsync(Gpu::hostToDevice, bcrs.begin(), bcrs.end(), bcrs_d.begin());
38 const BCRec* bc_ptr = bcrs_d.data();
40 GpuArray<GpuArray<Real, AMREX_SPACEDIM*2>, AMREX_SPACEDIM+
NVAR_max> l_bc_extdir_vals_d;
42 for (
int i = 0; i < ncomp; i++)
43 for (
int ori = 0; ori < 2*AMREX_SPACEDIM; ori++)
46 GeometryData
const& geomdata =
m_geom.data();
47 bool is_periodic_in_x = geomdata.isPeriodic(0);
48 bool is_periodic_in_y = geomdata.isPeriodic(1);
51 if (!is_periodic_in_x)
54 Box bx_xlo(bx); bx_xlo.setBig (0,dom_lo.x-1);
55 Box bx_xhi(bx); bx_xhi.setSmall(0,dom_hi.x+1);
57 bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) {
58 int iflip = dom_lo.x - 1- i;
60 dest_arr(i,j,k) = l_bc_extdir_vals_d[n][0];
62 dest_arr(i,j,k) = dest_arr(dom_lo.x,j,k);
64 dest_arr(i,j,k) = dest_arr(dom_lo.x,j,k);
66 dest_arr(i,j,k) = dest_arr(iflip,j,k);
68 dest_arr(i,j,k) = -dest_arr(iflip,j,k);
71 bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) {
72 int iflip = 2*dom_hi.x + 1 - i;
74 dest_arr(i,j,k) = l_bc_extdir_vals_d[n][3];
76 dest_arr(i,j,k) = dest_arr(dom_hi.x,j,k);
78 dest_arr(i,j,k) = dest_arr(dom_hi.x,j,k);
80 dest_arr(i,j,k) = dest_arr(iflip,j,k);
82 dest_arr(i,j,k) = -dest_arr(iflip,j,k);
88 if (!is_periodic_in_y)
91 Box bx_ylo(bx); bx_ylo.setBig (1,dom_lo.y-1);
92 Box bx_yhi(bx); bx_yhi.setSmall(1,dom_hi.y+2);
93 Box bx_ylo_face(bx); bx_ylo_face.setSmall(1,dom_lo.y ); bx_ylo_face.setBig(1,dom_lo.y );
94 Box bx_yhi_face(bx); bx_yhi_face.setSmall(1,dom_hi.y+1); bx_yhi_face.setBig(1,dom_hi.y+1);
97 bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
99 int jflip = dom_lo.y-j;
101 dest_arr(i,j,k) = l_bc_extdir_vals_d[n][1];
103 dest_arr(i,j,k) = dest_arr(i,dom_lo.y,k);
105 dest_arr(i,j,k) = dest_arr(i,dom_lo.y,k);
107 dest_arr(i,j,k) = dest_arr(i,jflip,k);
109 dest_arr(i,j,k) = -dest_arr(i,jflip,k);
111 dest_arr(i,j,k) = (4.0*dest_arr(i,dom_lo.y+1,k) - dest_arr(i,dom_lo.y+2,k))/3.0;
115 bx_ylo_face, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
118 dest_arr(i,j,k) = l_bc_extdir_vals_d[n][1];
120 dest_arr(i,j,k) = (4.0*dest_arr(i,dom_lo.y+1,k) - dest_arr(i,dom_lo.y+2,k))/3.0;
125 bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
127 int jflip = 2*(dom_hi.y + 1) - j;
129 dest_arr(i,j,k) = l_bc_extdir_vals_d[n][4];
131 dest_arr(i,j,k) = dest_arr(i,dom_hi.y+1,k);
133 dest_arr(i,j,k) = dest_arr(i,dom_hi.y+1,k);
135 dest_arr(i,j,k) = dest_arr(i,jflip,k);
137 dest_arr(i,j,k) = -dest_arr(i,jflip,k);
139 dest_arr(i,j,k) = (4.0*dest_arr(i,dom_hi.y,k) - dest_arr(i,dom_hi.y-1,k))/3.0;
143 bx_yhi_face, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
146 dest_arr(i,j,k) = l_bc_extdir_vals_d[n][4];
148 dest_arr(i,j,k) = (4.0*dest_arr(i,dom_hi.y,k) - dest_arr(i,dom_hi.y-1,k))/3.0;
153 Gpu::streamSynchronize();
#define NVAR_max
Definition: IndexDefines.H:27
void impose_lateral_yvel_bcs(const amrex::Array4< amrex::Real > &dest_arr, const amrex::Box &bx, const amrex::Box &domain, int bccomp)
Definition: BoundaryConditions_yvel.cpp:14
@ open
Definition: IndexDefines.H:157
@ reflect_odd
Definition: IndexDefines.H:148
@ foextrap
Definition: IndexDefines.H:151
@ ext_dir
Definition: IndexDefines.H:152
@ neumann_int
Definition: IndexDefines.H:156
@ reflect_even
Definition: IndexDefines.H:150