added: MultisegmentWellEquations::createSolver

this applies compute the LU decomposition of the D matrix
This commit is contained in:
Arne Morten Kvarving 2022-11-11 21:41:24 +01:00
parent abf5f94561
commit e67e58d0c8
3 changed files with 26 additions and 0 deletions

View File

@ -22,9 +22,15 @@
#include <config.h>
#include <opm/simulators/wells/MultisegmentWellEquations.hpp>
#include <dune/istl/umfpack.hh>
#include <opm/common/ErrorMacros.hpp>
#include <opm/simulators/wells/MSWellHelpers.hpp>
#include <opm/simulators/wells/MultisegmentWellGeneric.hpp>
#include <stdexcept>
namespace Opm {
template<class Scalar, int numWellEq, int numEq>
@ -140,6 +146,21 @@ apply(BVector& r) const
duneC_.mmtv(invDrw, r);
}
template<class Scalar, int numWellEq, int numEq>
void MultisegmentWellEquations<Scalar,numWellEq,numEq>::createSolver()
{
#if HAVE_UMFPACK
if (duneDSolver_) {
return;
}
duneDSolver_ = std::make_shared<Dune::UMFPack<DiagMatWell>>(duneD_, 0);
#else
OPM_THROW(std::runtime_error, "MultisegmentWell support requires UMFPACK. "
"Reconfigure opm-simulators with SuiteSparse/UMFPACK support and recompile.");
#endif
}
#define INSTANCE(numWellEq, numEq) \
template class MultisegmentWellEquations<double,numWellEq,numEq>;

View File

@ -80,6 +80,9 @@ public:
//! \brief Apply linear operator to vector.
void apply(BVector& r) const;
//! \brief Compute the LU-decomposition of D matrix.
void createSolver();
// two off-diagonal matrices
OffDiagMatWell duneB_;
OffDiagMatWell duneC_;

View File

@ -1776,6 +1776,8 @@ namespace Opm
this->assemblePressureEq(seg, unit_system, well_state, deferred_logger);
}
}
this->linSys_.createSolver();
}