Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug introduced in #3959 #3960

Merged
merged 1 commit into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 12 additions & 21 deletions Src/Boundary/AMReX_InterpBndryData.H
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public:
* \param max_order interpolation order
*/
void updateBndryValues (BndryRegisterT<MF>& crse, int c_start, int bnd_start, int num_comp,
const IntVect& ratio, int max_order = IBD_max_order_DEF);
const IntVect& ratio, int max_order = IBD_max_order_DEF, int max_width = 2);

//! Set boundary values to zero
void setHomogValues ();
Expand All @@ -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 Expand Up @@ -270,10 +261,10 @@ InterpBndryDataT<MF>::setBndryValues (BndryRegisterT<MF> const& crse, int c_star
template <typename MF>
void
InterpBndryDataT<MF>::updateBndryValues (BndryRegisterT<MF>& crse, int c_start, int bnd_start,
int num_comp, const IntVect& ratio, int max_order)
int num_comp, const IntVect& ratio, int max_order, int max_width)
{
MF foo(this->grids, this->bndry[0].DistributionMap(), 1, num_comp, MFInfo().SetAlloc(false));
setBndryValues(crse, c_start, foo, 0, bnd_start, num_comp, ratio, max_order);
setBndryValues(crse, c_start, foo, 0, bnd_start, num_comp, ratio, max_order, max_width);
}

template <typename MF>
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
Loading