Skip to content

Commit

Permalink
Nodal hypre fix (#1082)
Browse files Browse the repository at this point in the history
* Allow 2d nodal solver to use hypre at mglev > 0
  • Loading branch information
asalmgren authored Jul 2, 2020
1 parent 600d31d commit e338456
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2552,13 +2552,17 @@ MLNodeLaplacian::fillIJMatrix (MFIter const& mfi, Array4<HypreNodeLap::Int const
Vector<HypreNodeLap::Int>& ncols, Vector<HypreNodeLap::Int>& rows,
Vector<HypreNodeLap::Int>& cols, Vector<Real>& mat) const
{
const int amrlev = 0;
const int mglev = m_num_mg_levels[amrlev]-1;

const Box& ndbx = mfi.validbox();
const auto lo = amrex::lbound(ndbx);
const auto hi = amrex::ubound(ndbx);

AMREX_ASSERT(m_coarsening_strategy == CoarseningStrategy::RAP);
AMREX_ALWAYS_ASSERT_WITH_MESSAGE((mglev == 0) || (m_coarsening_strategy == CoarseningStrategy::RAP),
"Coarsening strategy must be RAP to use hypre at mglev > 0");

const auto& sten = m_stencil[0][0]->array(mfi);
const auto& sten = m_stencil[amrlev][mglev]->array(mfi);

constexpr int k = 0;
for (int j = lo.y; j <= hi.y; ++j) {
Expand Down Expand Up @@ -2637,7 +2641,8 @@ MLNodeLaplacian::fillIJMatrix (MFIter const& mfi, Array4<HypreNodeLap::Int const
const auto lo = amrex::lbound(ndbx);
const auto hi = amrex::ubound(ndbx);

AMREX_ASSERT(m_coarsening_strategy == CoarseningStrategy::RAP);
AMREX_ALWAYS_ASSERT_WITH_MESSAGE((mglev == 0) || (m_coarsening_strategy == CoarseningStrategy::RAP),
"Coarsening strategy must be RAP to use hypre at mglev > 0");

const auto& sten = m_stencil[amrlev][mglev]->array(mfi);

Expand Down

0 comments on commit e338456

Please sign in to comment.