From 1a5577240128fd2b02866d1ccfca3c353cd3d976 Mon Sep 17 00:00:00 2001 From: Ann Almgren Date: Tue, 19 Nov 2024 07:24:56 -0800 Subject: [PATCH] fix for fft on GPU (#1955) --- Source/Utils/ERF_solve_with_fft.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Utils/ERF_solve_with_fft.cpp b/Source/Utils/ERF_solve_with_fft.cpp index d18d3ee67..aafb78737 100644 --- a/Source/Utils/ERF_solve_with_fft.cpp +++ b/Source/Utils/ERF_solve_with_fft.cpp @@ -223,12 +223,13 @@ void ERF::solve_with_fft (int lev, MultiFab& rhs, MultiFab& phi, Array 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; } });