192 const auto& dom_lo = lbound(domain);
193 const auto& dom_hi = ubound(domain);
195 GeometryData
const& geomdata =
m_geom.data();
207 Vector<BCRec> bcrs(icomp+ncomp);
210 Gpu::DeviceVector<BCRec> bcrs_d(icomp+ncomp);
211 Gpu::copyAsync(Gpu::hostToDevice, bcrs.begin(), bcrs.end(), bcrs_d.begin());
212 const BCRec* bc_ptr = bcrs_d.data();
214 GpuArray<GpuArray<Real, AMREX_SPACEDIM*2>,AMREX_SPACEDIM+
NVAR_max> l_bc_extdir_vals_d;
215 for (
int i = 0; i < icomp+ncomp; i++)
216 for (
int ori = 0; ori < 2*AMREX_SPACEDIM; ori++)
219 GpuArray<GpuArray<Real, AMREX_SPACEDIM*2>,AMREX_SPACEDIM+
NVAR_max> l_bc_neumann_vals_d;
220 for (
int i = 0; i < icomp+ncomp; i++)
221 for (
int ori = 0; ori < 2*AMREX_SPACEDIM; ori++)
226 Box bx_zlo(bx); bx_zlo.setBig (2,dom_lo.z-1);
227 Box bx_zhi(bx); bx_zhi.setSmall(2,dom_hi.z+1);
229 bx_zlo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) {
231 dest_arr(i,j,k,icomp+n) = l_bc_extdir_vals_d[icomp+n][2];
234 bx_zhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) {
236 dest_arr(i,j,k,icomp+n) = l_bc_extdir_vals_d[icomp+n][5];
243 Box bx_zlo(bx); bx_zlo.setBig (2,dom_lo.z-1);
244 Box bx_zhi(bx); bx_zhi.setSmall(2,dom_hi.z+1);
247 bx_zlo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) {
248 int kflip = dom_lo.z - 1 - i;
250 dest_arr(i,j,k,icomp+n) = dest_arr(i,j,dom_lo.z,icomp+n);
252 dest_arr(i,j,k,icomp+n) = dest_arr(i,j,dom_lo.z,icomp+n);
254 dest_arr(i,j,k,icomp+n) = dest_arr(i,j,kflip,icomp+n);
256 dest_arr(i,j,k,icomp+n) = -dest_arr(i,j,kflip,icomp+n);
258 Real delta_z = (dom_lo.z - k) / dxInv[2];
259 dest_arr(i,j,k,icomp+n) = dest_arr(i,j,dom_lo.z,icomp+n) -
260 delta_z*l_bc_neumann_vals_d[icomp+n][2]*dest_arr(i,j,dom_lo.z,
Rho_comp);
262 dest_arr(i,j,k,icomp+n) = 2.0*dest_arr(i,j,dom_lo.z,icomp+n) - dest_arr(i,j,dom_lo.z+1,icomp+n);
265 bx_zhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n) {
266 int kflip = 2*dom_hi.z + 1 - i;
268 dest_arr(i,j,k,icomp+n) = dest_arr(i,j,dom_hi.z,icomp+n);
270 dest_arr(i,j,k,icomp+n) = dest_arr(i,j,dom_hi.z,icomp+n);
272 dest_arr(i,j,k,icomp+n) = dest_arr(i,j,kflip,icomp+n);
274 dest_arr(i,j,k,icomp+n) = -dest_arr(i,j,kflip,icomp+n);
276 Real delta_z = (k - dom_hi.z) / dxInv[2];
278 dest_arr(i,j,k,icomp+n) = dest_arr(i,j,dom_hi.z,icomp+n) +
279 delta_z*l_bc_neumann_vals_d[icomp+n][5];
281 dest_arr(i,j,k,icomp+n) = dest_arr(i,j,dom_hi.z,icomp+n) +
282 delta_z*l_bc_neumann_vals_d[icomp+n][5]*dest_arr(i,j,dom_hi.z,
Rho_comp);
285 dest_arr(i,j,k,icomp+n) = 2.0*dest_arr(i,j,dom_hi.z,icomp+n) - dest_arr(i,j,dom_hi.z-1,icomp+n);
292 const auto& bx_lo = lbound(bx);
293 const auto& bx_hi = ubound(bx);
300 for (
int n = icomp; n < icomp+ncomp; n++) {
308 if (xybx.smallEnd(2) < 0) {
310 xybx.setBig(2,dom_lo.z-1);
311 xybx.setSmall(2,bx.smallEnd()[2]);
314 Real dz = geomdata.CellSize(2);
317 ParallelFor(xybx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
320 int ii = amrex::min(amrex::max(i,dom_lo.x),dom_hi.x);
321 int jj = amrex::min(amrex::max(j,dom_lo.y),dom_hi.y);
330 Real GradVarx, GradVary;
331 if (i < dom_lo.x-1 || i > dom_hi.x+1) {
333 }
else if (i+1 > bx_hi.x) {
334 GradVarx = dxInv[0] * (dest_arr(i ,j,k0,n) - dest_arr(i-1,j,k0,n));
335 }
else if (i-1 < bx_lo.x) {
336 GradVarx = dxInv[0] * (dest_arr(i+1,j,k0,n) - dest_arr(i ,j,k0,n));
338 GradVarx = 0.5 * dxInv[0] * (dest_arr(i+1,j,k0,n) - dest_arr(i-1,j,k0,n));
343 if (j < dom_lo.y-1 || j > dom_hi.y+1) {
345 }
else if (j+1 > bx_hi.y) {
346 GradVary = dxInv[1] * (dest_arr(i,j ,k0,n) - dest_arr(i,j-1,k0,n));
347 }
else if (j-1 < bx_lo.y) {
348 GradVary = dxInv[1] * (dest_arr(i,j+1,k0,n) - dest_arr(i,j ,k0,n));
350 GradVary = 0.5 * dxInv[1] * (dest_arr(i,j+1,k0,n) - dest_arr(i,j-1,k0,n));
354 Real met_fac = met_h_zeta / ( met_h_xi*met_h_xi + met_h_eta*met_h_eta + 1. );
357 dest_arr(i,j,k,n) -= dz * met_fac * ( met_h_xi * GradVarx + met_h_eta * GradVary );
363 Gpu::streamSynchronize();
#define Rho_comp
Definition: IndexDefines.H:12
AMREX_FORCE_INLINE AMREX_GPU_DEVICE amrex::Real Compute_h_zeta_AtCellCenter(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: TerrainMetrics.H:31
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_eta_AtCellCenter(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: TerrainMetrics.H:61
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_xi_AtCellCenter(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: TerrainMetrics.H:46
@ neumann
Definition: IndexDefines.H:155