mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Use MatrixBlock consistently, also whitespace cleanup.
This commit is contained in:
parent
16b1756339
commit
7fe3839500
@ -65,8 +65,10 @@ namespace Opm
|
||||
commRW->remoteIndices().template rebuild<true>();
|
||||
//commRW->clearInterfaces(); may need this for correct rebuild
|
||||
}
|
||||
namespace Details {
|
||||
using PressureMatrixType = Dune::BCRSMatrix<Dune::FieldMatrix<double, 1, 1>>;
|
||||
|
||||
namespace Details
|
||||
{
|
||||
using PressureMatrixType = Dune::BCRSMatrix<Opm::MatrixBlock<double, 1, 1>>;
|
||||
using PressureVectorType = Dune::BlockVector<Dune::FieldVector<double, 1>>;
|
||||
using SeqCoarseOperatorType = Dune::MatrixAdapter<PressureMatrixType, PressureVectorType, PressureVectorType>;
|
||||
template <class Comm>
|
||||
@ -75,8 +77,8 @@ namespace Opm
|
||||
template <class Comm>
|
||||
using CoarseOperatorType = std::conditional_t<std::is_same<Comm, Dune::Amg::SequentialInformation>::value,
|
||||
SeqCoarseOperatorType,
|
||||
ParCoarseOperatorType<Comm>>;
|
||||
}
|
||||
ParCoarseOperatorType<Comm>>;
|
||||
} // namespace Details
|
||||
|
||||
template <class FineOperator, class Communication, bool transpose = false>
|
||||
class PressureBhpTransferPolicy : public Dune::Amg::LevelTransferPolicyCpr<FineOperator, Details::CoarseOperatorType<Communication>>
|
||||
|
@ -24,26 +24,31 @@
|
||||
|
||||
#include <opm/simulators/linalg/twolevelmethodcpr.hh>
|
||||
#include <opm/simulators/linalg/PropertyTree.hpp>
|
||||
#include <opm/simulators/linalg/matrixblock.hh>
|
||||
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
namespace Details {
|
||||
using PressureMatrixType = Dune::BCRSMatrix<Dune::FieldMatrix<double, 1, 1>>;
|
||||
using PressureVectorType = Dune::BlockVector<Dune::FieldVector<double, 1>>;
|
||||
using SeqCoarseOperatorType = Dune::MatrixAdapter<PressureMatrixType, PressureVectorType, PressureVectorType>;
|
||||
template <class Comm>
|
||||
using ParCoarseOperatorType
|
||||
= Dune::OverlappingSchwarzOperator<PressureMatrixType, PressureVectorType, PressureVectorType, Comm>;
|
||||
template <class Comm>
|
||||
using CoarseOperatorType = std::conditional_t<std::is_same<Comm, Dune::Amg::SequentialInformation>::value,
|
||||
SeqCoarseOperatorType,
|
||||
ParCoarseOperatorType<Comm>>;
|
||||
}
|
||||
|
||||
namespace Details
|
||||
{
|
||||
using PressureMatrixType = Dune::BCRSMatrix<Opm::MatrixBlock<double, 1, 1>>;
|
||||
using PressureVectorType = Dune::BlockVector<Dune::FieldVector<double, 1>>;
|
||||
using SeqCoarseOperatorType = Dune::MatrixAdapter<PressureMatrixType, PressureVectorType, PressureVectorType>;
|
||||
template <class Comm>
|
||||
using ParCoarseOperatorType
|
||||
= Dune::OverlappingSchwarzOperator<PressureMatrixType, PressureVectorType, PressureVectorType, Comm>;
|
||||
template <class Comm>
|
||||
using CoarseOperatorType = std::conditional_t<std::is_same<Comm, Dune::Amg::SequentialInformation>::value,
|
||||
SeqCoarseOperatorType,
|
||||
ParCoarseOperatorType<Comm>>;
|
||||
} // namespace Details
|
||||
|
||||
|
||||
|
||||
template <class FineOperator, class Communication, bool transpose = false>
|
||||
class PressureTransferPolicy : public Dune::Amg::LevelTransferPolicyCpr<FineOperator, Details::CoarseOperatorType<Communication>>
|
||||
class PressureTransferPolicy
|
||||
: public Dune::Amg::LevelTransferPolicyCpr<FineOperator, Details::CoarseOperatorType<Communication>>
|
||||
{
|
||||
public:
|
||||
typedef typename Details::CoarseOperatorType<Communication> CoarseOperator;
|
||||
|
@ -49,7 +49,7 @@ template <class X, class Y>
|
||||
class LinearOperatorExtra : public Dune::LinearOperator<X, Y>
|
||||
{
|
||||
public:
|
||||
using PressureMatrix = Dune::BCRSMatrix<Dune::FieldMatrix<double, 1, 1>>;
|
||||
using PressureMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<double, 1, 1>>;
|
||||
virtual void addWellPressureEquations(PressureMatrix& jacobian, const X& weights,const bool use_well_weights) const = 0;
|
||||
virtual void addWellPressureEquationsStruct(PressureMatrix& jacobian) const = 0;
|
||||
virtual int getNumberOfExtraEquations() const = 0;
|
||||
@ -61,7 +61,7 @@ class WellModelAsLinearOperator : public Opm::LinearOperatorExtra<X, Y>
|
||||
public:
|
||||
using Base = Opm::LinearOperatorExtra<X, Y>;
|
||||
using field_type = typename Base::field_type;
|
||||
using PressureMatrix = Dune::BCRSMatrix<Dune::FieldMatrix<double, 1, 1>>;
|
||||
using PressureMatrix = typename Base::PressureMatrix;
|
||||
explicit WellModelAsLinearOperator(const WellModel& wm)
|
||||
: wellMod_(wm)
|
||||
{
|
||||
@ -126,7 +126,7 @@ public:
|
||||
typedef X domain_type;
|
||||
typedef Y range_type;
|
||||
typedef typename X::field_type field_type;
|
||||
using PressureMatrix = Dune::BCRSMatrix<Dune::FieldMatrix<double, 1, 1>>;
|
||||
using PressureMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<double, 1, 1>>;
|
||||
#if HAVE_MPI
|
||||
typedef Dune::OwnerOverlapCopyCommunication<int,int> communication_type;
|
||||
#else
|
||||
@ -212,7 +212,7 @@ public:
|
||||
typedef X domain_type;
|
||||
typedef Y range_type;
|
||||
typedef typename X::field_type field_type;
|
||||
using PressureMatrix = Dune::BCRSMatrix<Dune::FieldMatrix<double, 1, 1>>;
|
||||
using PressureMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<double, 1, 1>>;
|
||||
#if HAVE_MPI
|
||||
typedef Dune::OwnerOverlapCopyCommunication<int,int> communication_type;
|
||||
#else
|
||||
|
@ -127,7 +127,7 @@ namespace Opm {
|
||||
typedef Dune::FieldVector<Scalar, numEq > VectorBlockType;
|
||||
typedef Dune::BlockVector<VectorBlockType> BVector;
|
||||
|
||||
typedef Dune::FieldMatrix<Scalar, numEq, numEq > MatrixBlockType;
|
||||
// typedef Dune::FieldMatrix<Scalar, numEq, numEq > MatrixBlockType;
|
||||
|
||||
typedef BlackOilPolymerModule<TypeTag> PolymerModule;
|
||||
typedef BlackOilMICPModule<TypeTag> MICPModule;
|
||||
@ -265,7 +265,7 @@ namespace Opm {
|
||||
const SimulatorReportSingle& lastReport() const;
|
||||
|
||||
void addWellContributions(SparseMatrixAdapter& jacobian) const;
|
||||
|
||||
|
||||
// called at the beginning of a report step
|
||||
void beginReportStep(const int time_step);
|
||||
|
||||
@ -289,14 +289,14 @@ namespace Opm {
|
||||
WellInterfacePtr getWell(const std::string& well_name) const;
|
||||
bool hasWell(const std::string& well_name) const;
|
||||
|
||||
using PressureMatrix = Dune::BCRSMatrix<Dune::FieldMatrix<double, 1, 1>>;
|
||||
using PressureMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<double, 1, 1>>;
|
||||
|
||||
int numLocalWellsEnd() const;
|
||||
|
||||
|
||||
void addWellPressureEquations(PressureMatrix& jacobian, const BVector& weights,const bool use_well_weights) const;
|
||||
|
||||
std::vector<std::vector<int>> getMaxWellConnections() const;
|
||||
|
||||
|
||||
void addWellPressureEquationsStruct(PressureMatrix& jacobian) const;
|
||||
|
||||
void initGliftEclWellMap(GLiftEclWells &ecl_well_map);
|
||||
|
@ -1194,13 +1194,12 @@ namespace Opm {
|
||||
int wdof = rdofs + i;
|
||||
jacobian[wdof][wdof] = 1.0;// better scaling ?
|
||||
}
|
||||
|
||||
|
||||
for ( const auto& well : well_container_ ) {
|
||||
well->addWellPressureEquations(jacobian, weights, pressureVarIndex, use_well_weights, this->wellState());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
int
|
||||
BlackoilWellModel<TypeTag>::
|
||||
|
@ -74,8 +74,8 @@ namespace Opm
|
||||
using MSWEval::GTotal;
|
||||
using MSWEval::SPres;
|
||||
using MSWEval::numWellEq;
|
||||
using PressureMatrix = Dune::BCRSMatrix<Dune::FieldMatrix<double, 1, 1>>;
|
||||
|
||||
using typename Base::PressureMatrix;
|
||||
|
||||
MultisegmentWell(const Well& well,
|
||||
const ParallelWellInfo& pw_info,
|
||||
const int time_step,
|
||||
|
@ -94,7 +94,7 @@ namespace Opm
|
||||
using PolymerModule = BlackOilPolymerModule<TypeTag>;
|
||||
using FoamModule = BlackOilFoamModule<TypeTag>;
|
||||
using BrineModule = BlackOilBrineModule<TypeTag>;
|
||||
using PressureMatrix = Dune::BCRSMatrix<Dune::FieldMatrix<double, 1, 1>>;
|
||||
using typename Base::PressureMatrix;
|
||||
|
||||
// number of the conservation equations
|
||||
static constexpr int numWellConservationEq = Indices::numPhases + Indices::numSolvents;
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
using MatrixBlockType = Dune::FieldMatrix<Scalar, Indices::numEq, Indices::numEq>;
|
||||
using BVector = Dune::BlockVector<VectorBlockType>;
|
||||
using Eval = DenseAd::Evaluation<Scalar, /*size=*/Indices::numEq>;
|
||||
using PressureMatrix = Dune::BCRSMatrix<Dune::FieldMatrix<double, 1, 1>>;
|
||||
using PressureMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<double, 1, 1>>;
|
||||
|
||||
using RateConverterType =
|
||||
typename WellInterfaceFluidSystem<FluidSystem>::RateConverterType;
|
||||
|
@ -28,6 +28,9 @@
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6) && \
|
||||
BOOST_VERSION / 100 % 1000 > 48
|
||||
|
||||
#include <opm/simulators/linalg/matrixblock.hh>
|
||||
#include <opm/simulators/linalg/ilufirstelement.hh>
|
||||
|
||||
#include <opm/simulators/linalg/PreconditionerFactory.hpp>
|
||||
#include <opm/simulators/linalg/PropertyTree.hpp>
|
||||
#include <opm/simulators/linalg/FlexibleSolver.hpp>
|
||||
@ -71,7 +74,7 @@ template <int bz>
|
||||
Dune::BlockVector<Dune::FieldVector<double, bz>>
|
||||
testPrec(const Opm::PropertyTree& prm, const std::string& matrix_filename, const std::string& rhs_filename)
|
||||
{
|
||||
using Matrix = Dune::BCRSMatrix<Dune::FieldMatrix<double, bz, bz>>;
|
||||
using Matrix = Dune::BCRSMatrix<Opm::MatrixBlock<double, bz, bz>>;
|
||||
using Vector = Dune::BlockVector<Dune::FieldVector<double, bz>>;
|
||||
Matrix matrix;
|
||||
{
|
||||
@ -79,7 +82,8 @@ testPrec(const Opm::PropertyTree& prm, const std::string& matrix_filename, const
|
||||
if (!mfile) {
|
||||
throw std::runtime_error("Could not read matrix file");
|
||||
}
|
||||
readMatrixMarket(matrix, mfile);
|
||||
using M = Dune::BCRSMatrix<Dune::FieldMatrix<double, bz, bz>>;
|
||||
readMatrixMarket(reinterpret_cast<M&>(matrix), mfile); // Hack to avoid hassle
|
||||
}
|
||||
Vector rhs;
|
||||
{
|
||||
@ -162,7 +166,7 @@ BOOST_AUTO_TEST_CASE(TestDefaultPreconditionerFactory)
|
||||
|
||||
|
||||
template <int bz>
|
||||
using M = Dune::BCRSMatrix<Dune::FieldMatrix<double, bz, bz>>;
|
||||
using M = Dune::BCRSMatrix<Opm::MatrixBlock<double, bz, bz>>;
|
||||
template <int bz>
|
||||
using V = Dune::BlockVector<Dune::FieldVector<double, bz>>;
|
||||
template <int bz>
|
||||
@ -276,15 +280,16 @@ template <int bz>
|
||||
Dune::BlockVector<Dune::FieldVector<double, bz>>
|
||||
testPrecRepeating(const Opm::PropertyTree& prm, const std::string& matrix_filename, const std::string& rhs_filename)
|
||||
{
|
||||
using Matrix = Dune::BCRSMatrix<Dune::FieldMatrix<double, bz, bz>>;
|
||||
using Vector = Dune::BlockVector<Dune::FieldVector<double, bz>>;
|
||||
using Matrix = M<bz>;
|
||||
using Vector = V<bz>;
|
||||
Matrix matrix;
|
||||
{
|
||||
std::ifstream mfile(matrix_filename);
|
||||
if (!mfile) {
|
||||
throw std::runtime_error("Could not read matrix file");
|
||||
}
|
||||
readMatrixMarket(matrix, mfile);
|
||||
using M = Dune::BCRSMatrix<Dune::FieldMatrix<double, bz, bz>>;
|
||||
readMatrixMarket(reinterpret_cast<M&>(matrix), mfile); // Hack to avoid hassle
|
||||
}
|
||||
Vector rhs;
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user