Skip to content

Commit

Permalink
update amrex and FFT solver
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren committed Nov 24, 2024
1 parent e852d02 commit 3b96a18
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 88 deletions.
87 changes: 0 additions & 87 deletions Source/LinearSolvers/ERF_solve_with_fft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,93 +112,6 @@ void ERF::solve_with_fft (int lev, MultiFab& rhs, MultiFab& phi, Array<MultiFab,
amrex::Abort("FFT isn't appropriate for spatially varying terrain");
}

phi.FillBoundary(geom[lev].periodicity());

// ****************************************************************************
// Impose bc's on pprime
// ****************************************************************************
#ifdef _OPENMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
for (MFIter mfi(phi,TilingIfNotGPU()); mfi.isValid(); ++mfi)
{
Array4<Real> const& pp_arr = phi.array(mfi);
Box const& bx = mfi.tilebox();
auto const bx_lo = lbound(bx);
auto const bx_hi = ubound(bx);
if (bx_lo.x == dom_lo.x) {
auto bc_type = domain_bc_type[Orientation(0,Orientation::low)];
if (bc_type == "Outflow" || bc_type == "Open") {
ParallelFor(makeSlab(bx,0,dom_lo.x), [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
pp_arr(i-1,j,k) = -pp_arr(i,j,k);
});
} else {
ParallelFor(makeSlab(bx,0,dom_lo.x), [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
pp_arr(i-1,j,k) = pp_arr(i,j,k);
});
}
}
if (bx_lo.y == dom_lo.y) {
auto bc_type = domain_bc_type[Orientation(1,Orientation::low)];
if (bc_type == "Outflow" || bc_type == "Open") {
ParallelFor(makeSlab(bx,1,dom_lo.y), [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
pp_arr(i,j-1,k) = -pp_arr(i,j,k);
});
} else {
ParallelFor(makeSlab(bx,1,dom_lo.y), [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
pp_arr(i,j-1,k) = pp_arr(i,j,k);
});
}
}
if (bx_lo.z == dom_lo.z) {
ParallelFor(makeSlab(bx,2,dom_lo.z), [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
pp_arr(i,j,k-1) = pp_arr(i,j,k);
});
}
if (bx_hi.x == dom_hi.x) {
auto bc_type = domain_bc_type[Orientation(0,Orientation::high)];
if (bc_type == "Outflow" || bc_type == "Open") {
ParallelFor(makeSlab(bx,0,dom_hi.x), [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
pp_arr(i+1,j,k) = -pp_arr(i,j,k);
});
} else {
ParallelFor(makeSlab(bx,0,dom_hi.x), [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
pp_arr(i+1,j,k) = pp_arr(i,j,k);
});
}
}
if (bx_hi.y == dom_hi.y) {
auto bc_type = domain_bc_type[Orientation(1,Orientation::high)];
if (bc_type == "Outflow" || bc_type == "Open") {
ParallelFor(makeSlab(bx,1,dom_hi.y), [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
pp_arr(i,j+1,k) = -pp_arr(i,j,k);
});
} else {
ParallelFor(makeSlab(bx,1,dom_hi.y), [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
pp_arr(i,j+1,k) = pp_arr(i,j,k);
});
}
}
if (bx_hi.z == dom_hi.z) {
ParallelFor(makeSlab(bx,2,dom_hi.z), [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
pp_arr(i,j,k+1) = pp_arr(i,j,k);
});
}
} // mfi

// Now overwrite with periodic fill outside domain and fine-fine fill inside
phi.FillBoundary(geom[lev].periodicity());

#ifdef _OPENMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
Expand Down

0 comments on commit 3b96a18

Please sign in to comment.