Skip to content

Commit

Permalink
save dx and dy as Reals so they can be accessed on GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
hklion committed Nov 22, 2024
1 parent 0a751a1 commit c6ba8fc
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Source/Initialization/REMORA_make_new_level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,29 +567,31 @@ REMORA::set_pm_pn (int lev)
Array4<Real> const& yp = vec_yp[lev]->array(mfi);

Box bx = mfi.growntilebox(IntVect(NGROW-1,NGROW-1,0));
Real dx = 1.0_rt / dxi[0];
Real dy = 1.0_rt / dxi[1];

ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int)
{
xr(i,j,0) = (i + 0.5_rt) / dxi[0];
yr(i,j,0) = (j + 0.5_rt) / dxi[1];
xr(i,j,0) = (i + 0.5_rt) * dx;
yr(i,j,0) = (j + 0.5_rt) * dy;
});

ParallelFor(convert(bx,IntVect(1,0,0)), [=] AMREX_GPU_DEVICE (int i, int j, int)
{
xu(i,j,0) = i / dxi[0];
yu(i,j,0) = (j + 0.5_rt) / dxi[1];
xu(i,j,0) = i * dx;
yu(i,j,0) = (j + 0.5_rt) * dy;
});

ParallelFor(convert(bx,IntVect(0,1,0)), [=] AMREX_GPU_DEVICE (int i, int j, int)
{
xv(i,j,0) = (i + 0.5_rt) / dxi[0];
yv(i,j,0) = j / dxi[1];
xv(i,j,0) = (i + 0.5_rt) * dx;
yv(i,j,0) = j * dy;
});

ParallelFor(convert(bx,IntVect(1,1,0)), [=] AMREX_GPU_DEVICE (int i, int j, int)
{
xp(i,j,0) = i / dxi[0];
yp(i,j,0) = j / dxi[1];
xp(i,j,0) = i * dx;
yp(i,j,0) = j * dy;
});
}
}
Expand Down

0 comments on commit c6ba8fc

Please sign in to comment.