Skip to content

Commit

Permalink
Fix bug introduced in #3959
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed May 27, 2024
1 parent 8e67cc9 commit 4c58492
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
27 changes: 9 additions & 18 deletions Src/Boundary/AMReX_InterpBndryData.H
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,14 @@ template <typename MF>
void
InterpBndryDataT<MF>::setPhysBndryValues (const MF& mf, int mf_start, int bnd_start, int num_comp)
{
AMREX_ASSERT(mf.empty() || this->grids == mf.boxArray());
AMREX_ASSERT(this->grids == mf.boxArray());

const Box& fine_domain = this->geom.Domain();

#ifdef AMREX_USE_OMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
for (MFIter mfi(this->grids, this->DistributionMap(),
MFItInfo().SetDynamic(true)); mfi.isValid(); ++mfi)
for (MFIter mfi(mf,MFItInfo().SetDynamic(true)); mfi.isValid(); ++mfi)
{
const Box& bx = mfi.validbox();
for (OrientationIter fi; fi; ++fi) {
Expand All @@ -144,22 +143,14 @@ InterpBndryDataT<MF>::setPhysBndryValues (const MF& mf, int mf_start, int bnd_st
{
// Physical bndry, copy from grid.
auto & bnd_fab = this->bndry[face][mfi];
auto const& src_fab = mf[mfi];
auto const& bnd_array = bnd_fab.array();
if (mf.empty()) {
const Box& b = bnd_fab.box();
AMREX_HOST_DEVICE_PARALLEL_FOR_4D ( b, num_comp, i, j, k, n,
{
bnd_array(i,j,k,n+bnd_start) = value_type(0);
});
} else {
auto const& src_fab = mf[mfi];
auto const& src_array = src_fab.const_array();
const Box& b = src_fab.box() & bnd_fab.box();
AMREX_HOST_DEVICE_PARALLEL_FOR_4D ( b, num_comp, i, j, k, n,
{
bnd_array(i,j,k,n+bnd_start) = src_array(i,j,k,n+mf_start);
});
}
auto const& src_array = src_fab.const_array();
const Box& b = src_fab.box() & bnd_fab.box();
AMREX_HOST_DEVICE_PARALLEL_FOR_4D ( b, num_comp, i, j, k, n,
{
bnd_array(i,j,k,n+bnd_start) = src_array(i,j,k,n+mf_start);
});
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions Src/LinearSolvers/MLMG/AMReX_MLCellLinOp.H
Original file line number Diff line number Diff line change
Expand Up @@ -505,11 +505,15 @@ MLCellLinOpT<MF>::setLevelBC (int amrlev, const MF* a_levelbcdata, const MF* rob

const int ncomp = this->getNComp();

MF zero;
IntVect ng(1);
if (this->hasHiddenDimension()) { ng[this->hiddenDirection()] = 0; }
AMREX_ALWAYS_ASSERT(a_levelbcdata == nullptr || a_levelbcdata->nGrowVect().allGE(ng));

MF zero;
if (a_levelbcdata == nullptr) {
zero.define(this->m_grids[amrlev][0], this->m_dmap[amrlev][0], ncomp, ng);
zero.setVal(RT(0.0));
} else {
AMREX_ALWAYS_ASSERT(a_levelbcdata->nGrowVect().allGE(ng));
}
const MF& bcdata = (a_levelbcdata == nullptr) ? zero : *a_levelbcdata;

IntVect br_ref_ratio(-1);
Expand Down

0 comments on commit 4c58492

Please sign in to comment.