Merge pull request #5941 from bska/add-precond-for-interior-sizes

Add Preconditions to Avoid Incorrect Interior Sizes
This commit is contained in:
Bård Skaflestad
2025-02-03 13:19:28 +01:00
committed by GitHub
2 changed files with 8 additions and 0 deletions

View File

@@ -31,6 +31,8 @@
#include <opm/simulators/linalg/GraphColoring.hpp>
#include <opm/simulators/linalg/matrixblock.hh>
#include <cassert>
namespace Opm
{
namespace detail
@@ -41,6 +43,7 @@ template<class M>
void ghost_last_bilu0_decomposition (M& A, std::size_t interiorSize)
{
// iterator types
assert(interiorSize <= A.N());
using rowiterator = typename M::RowIterator;
using coliterator = typename M::ColIterator;
using block = typename M::block_type;
@@ -311,6 +314,7 @@ ParallelOverlappingILU0(const Matrix& A,
{
// BlockMatrix is a Subclass of FieldMatrix that just adds
// methods. Therefore this cast should be safe.
assert(interiorSize <= A_->N());
update( );
}
@@ -443,6 +447,7 @@ update()
if (comm_) {
interiorSize_ = detail::set_interiorSize(A_->N(), interiorSize_, *comm_);
assert(interiorSize_ <= A_->N());
}
// create ILU-0 decomposition

View File

@@ -58,6 +58,8 @@
#include <opm/simulators/linalg/AmgxPreconditioner.hpp>
#endif
#include <cassert>
namespace Opm {
template <class Smoother>
@@ -396,6 +398,7 @@ struct StandardPreconditioners {
// Already a parallel preconditioner. Need to pass comm, but no need to wrap it in a BlockPreconditioner.
if (ilulevel == 0) {
const std::size_t num_interior = interiorIfGhostLast(comm);
assert(num_interior <= op.getmat().N());
return std::make_shared<ParallelOverlappingILU0<M, V, V, Comm>>(
op.getmat(), comm, w, MILU_VARIANT::ILU, num_interior, redblack, reorder_spheres);
} else {