Skip to content

Commit

Permalink
fix bounds in computation of eb_divu (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren authored Sep 12, 2023
1 parent 77968a2 commit 4920806
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 0 additions & 2 deletions Source/Hydro/CAMR_construct_hydro_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,13 @@ CAMR::construct_hydro_source (const MultiFab& S,
getFluxReg(level + 1).CrseAdd(mfi,
{{AMREX_D_DECL(&(flux[0]), &(flux[1]), &(flux[2]))}},
dxDp, fac_for_reflux*dt, (*volfrac)[mfi],
// dxDp, 0.0*dt, (*volfrac)[mfi],
{AMREX_D_DECL(&(*areafrac[0])[mfi], &(*areafrac[1])[mfi], &(*areafrac[2])[mfi])},
amrex::RunOn::Device);
}
if (level > 0) {
getFluxReg(level).FineAdd(mfi,
{{AMREX_D_DECL(&(flux[0]), &(flux[1]), &(flux[2]))}},
dxDp, fac_for_reflux*dt, (*volfrac)[mfi],
// dxDp, 0.0*dt, (*volfrac)[mfi],
{AMREX_D_DECL(&(*areafrac[0])[mfi], &(*areafrac[1])[mfi], &(*areafrac[2])[mfi])},
dm_as_fine, amrex::RunOn::Device);
} // level > 0
Expand Down
2 changes: 1 addition & 1 deletion Source/Hydro/Hydro.H
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void adjust_fluxes_eb (
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> dx,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> dxInv,
const amrex::GpuArray<const amrex::Array4<amrex::Real>, AMREX_SPACEDIM> flux,
const int* domlo, const int* domhi,
const amrex::Geometry& geom,
const int* bclo, const int* bchi,
const amrex::Real l_difmag);

Expand Down
12 changes: 8 additions & 4 deletions Source/Hydro/Hydro_adjust_fluxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ adjust_fluxes_eb (
const GpuArray<amrex::Real, AMREX_SPACEDIM> dx,
const GpuArray<amrex::Real, AMREX_SPACEDIM> dxinv,
const GpuArray<const amrex::Array4<amrex::Real>, AMREX_SPACEDIM> flux,
const int* domlo, const int* domhi,
const Geometry& geom,
const int* bclo, const int* bchi,
Real l_difmag)
{
Expand All @@ -74,12 +74,13 @@ adjust_fluxes_eb (
FArrayBox divu(bx_divu,NVAR);
divu.setVal<RunOn::Device>(0.0);

Box nddom = amrex::convert(geom.growPeriodicDomain(16), IntVect(1));
bx_divu &= nddom;

auto const& divu_arr = divu.array();
amrex::ParallelFor(bx_divu, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
if (vfrac(i,j,k) > 0.) {
eb_divu(i, j, k, q_arr, divu_arr, vfrac, dxinv);
}
eb_divu(i, j, k, q_arr, divu_arr, vfrac, dxinv);
});

// Flux alterations
Expand All @@ -90,6 +91,9 @@ adjust_fluxes_eb (
areafac = dx[1]*dx[2];
#endif

auto const* domlo = geom.Domain().loVect();
auto const* domhi = geom.Domain().hiVect();

int domlo_dir = domlo[0];
int domhi_dir = domhi[0];
int bclo_dir = bclo[0];
Expand Down
2 changes: 1 addition & 1 deletion Source/Hydro/Hydro_umdrv_eb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ hydro_umdrv_eb( const bool do_mol, Box const& bx,
adjust_fluxes_eb(bx, q_arr, uin_arr,
AMREX_D_DECL(apx, apy, apz),
vf_arr, dx, dxinv, flux_tmp_arr,
domlo, domhi, bclo, bchi, difmag);
geom, bclo, bchi, difmag);

hydro_consup_eb(bx, q_arr, qaux_arr,
divc_arr, redistwgt_arr,
Expand Down

0 comments on commit 4920806

Please sign in to comment.