Skip to content

Commit

Permalink
fix for fft on GPU (#1955)
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren authored Nov 19, 2024
1 parent 0c502fd commit 1a55772
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/Utils/ERF_solve_with_fft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,13 @@ void ERF::solve_with_fft (int lev, MultiFab& rhs, MultiFab& phi, Array<MultiFab,
Box const& zbx = mfi.nodaltilebox(2);
Array4<Real> const& fz_arr = fluxes[2].array(mfi);
if (l_use_terrain && SolverChoice::terrain_is_flat) {
Real* stretched_dz_d_ptr = stretched_dz_d[lev].data();
ParallelFor(zbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
if (k == dom_lo.z || k == dom_hi.z+1) {
fz_arr(i,j,k) = 0.0;
} else {
Real dz = 0.5 * (stretched_dz_d[lev][k] + stretched_dz_d[lev][k-1]);
Real dz = 0.5 * (stretched_dz_d_ptr[k] + stretched_dz_d_ptr[k-1]);
fz_arr(i,j,k) = -(p_arr(i,j,k) - p_arr(i,j,k-1)) / dz;
}
});
Expand Down

0 comments on commit 1a55772

Please sign in to comment.