25 const auto& dom_lo = lbound(domain);
26 const auto& dom_hi = ubound(domain);
31 Vector<BCRec> bcrs_w(1);
41 Gpu::DeviceVector<BCRec> bcrs_w_d(1);
42 Gpu::copyAsync(Gpu::hostToDevice, bcrs_w.begin(), bcrs_w.end(), bcrs_w_d.begin());
43 const BCRec* bc_ptr_w = bcrs_w_d.data();
45 GpuArray<GpuArray<Real, AMREX_SPACEDIM*2>,1> l_bc_extdir_vals_d;
49 for (
int ori = 0; ori < 2*AMREX_SPACEDIM; ori++) {
53 GeometryData
const& geomdata =
m_geom.data();
54 bool is_periodic_in_x = geomdata.isPeriodic(0);
55 bool is_periodic_in_y = geomdata.isPeriodic(1);
60 if (!is_periodic_in_x)
63 Box bx_xlo(bx); bx_xlo.setBig (0,dom_lo.x-1);
64 Box bx_xhi(bx); bx_xhi.setSmall(0,dom_hi.x+1);
65 ParallelFor(bx_xlo, bx_xhi,
66 [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
67 int iflip = dom_lo.x - 1 - i;
69 dest_arr(i,j,k) = (zvel_bc_ptr) ? zvel_bc_ptr[k] : l_bc_extdir_vals_d[0][0];
71 dest_arr(i,j,k) =
WFromOmega(i,j,k,dest_arr(i,j,k),xvel_arr,yvel_arr,z_phys_nd,dxInv);
74 dest_arr(i,j,k) = dest_arr(dom_lo.x,j,k);
76 dest_arr(i,j,k) = dest_arr(dom_lo.x,j,k);
78 dest_arr(i,j,k) = dest_arr(iflip,j,k);
80 dest_arr(i,j,k) = -dest_arr(iflip,j,k);
83 [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
84 int iflip = 2*dom_hi.x + 1 - i;
86 dest_arr(i,j,k) = (zvel_bc_ptr) ? zvel_bc_ptr[k] : l_bc_extdir_vals_d[0][3];
88 dest_arr(i,j,k) =
WFromOmega(i,j,k,dest_arr(i,j,k),xvel_arr,yvel_arr,z_phys_nd,dxInv);
91 dest_arr(i,j,k) = dest_arr(dom_hi.x,j,k);
93 dest_arr(i,j,k) = dest_arr(dom_hi.x,j,k);
95 dest_arr(i,j,k) = dest_arr(iflip,j,k);
97 dest_arr(i,j,k) = -dest_arr(iflip,j,k);
104 if (!is_periodic_in_y)
107 Box bx_ylo(bx); bx_ylo.setBig (1,dom_lo.y-1);
108 Box bx_yhi(bx); bx_yhi.setSmall(1,dom_hi.y+1);
109 ParallelFor(bx_ylo, bx_yhi,
110 [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
111 int jflip = dom_lo.y - 1 - j;
113 dest_arr(i,j,k) = (zvel_bc_ptr) ? zvel_bc_ptr[k] : l_bc_extdir_vals_d[0][1];
115 dest_arr(i,j,k) =
WFromOmega(i,j,k,dest_arr(i,j,k),xvel_arr,yvel_arr,z_phys_nd,dxInv);
118 dest_arr(i,j,k) = dest_arr(i,dom_lo.y,k);
120 dest_arr(i,j,k) = dest_arr(i,dom_lo.y,k);
122 dest_arr(i,j,k) = dest_arr(i,jflip,k);
124 dest_arr(i,j,k) = -dest_arr(i,jflip,k);
127 [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) {
128 int jflip = 2*dom_hi.y + 1 - j;
130 dest_arr(i,j,k) = (zvel_bc_ptr) ? zvel_bc_ptr[k] : l_bc_extdir_vals_d[0][4];
132 dest_arr(i,j,k) =
WFromOmega(i,j,k,dest_arr(i,j,k),xvel_arr,yvel_arr,z_phys_nd,dxInv);
135 dest_arr(i,j,k) = dest_arr(i,dom_hi.y,k);
137 dest_arr(i,j,k) = dest_arr(i,dom_hi.y,k);
139 dest_arr(i,j,k) = dest_arr(i,jflip,k);
141 dest_arr(i,j,k) = -dest_arr(i,jflip,k);
145 Gpu::streamSynchronize();
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real WFromOmega(int i, int j, int k, amrex::Real omega, amrex::Real u, amrex::Real v, const amrex::Array4< const amrex::Real > &z_nd, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv)
Definition: ERF_TerrainMetrics.H:407
void impose_lateral_zvel_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, const amrex::Array4< amrex::Real const > &z_nd, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > dxInv, int bccomp)
Definition: ERF_BoundaryConditionsZvel.cpp:16
@ open
Definition: ERF_IndexDefines.H:186
@ reflect_odd
Definition: ERF_IndexDefines.H:176
@ foextrap
Definition: ERF_IndexDefines.H:179
@ ext_dir
Definition: ERF_IndexDefines.H:180
@ reflect_even
Definition: ERF_IndexDefines.H:178