Go to the documentation of this file.
28#ifndef OPM_GENERIC_TEMPERATURE_MODEL_IMPL_HPP
29#define OPM_GENERIC_TEMPERATURE_MODEL_IMPL_HPP
32#ifndef OPM_GENERIC_TEMPERATURE_MODEL_HPP
37#include <dune/istl/operators.hh>
38#include <dune/istl/solvers.hh>
39#include <dune/istl/schwarz.hh>
40#include <dune/istl/preconditioners.hh>
41#include <dune/istl/schwarz.hh>
43#include <opm/common/OpmLog/OpmLog.hpp>
45#include <opm/grid/CpGrid.hpp>
47#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
48#include <opm/input/eclipse/Schedule/Well/Well.hpp>
61#include <fmt/format.h>
66template< class M, class V>
69 using Comm = Dune::OwnerOverlapCopyCommunication<int, int>;
74template< class Vector, class Gr id, class Matrix>
75std::tuple<std::unique_ptr<Dune::OverlappingSchwarzOperator<Matrix,Vector,Vector,
76 Dune::OwnerOverlapCopyCommunication<int,int>>>,
77 std::unique_ptr<typename EnergySolverSelector<Matrix,Vector>::type>>
80 OPM_THROW(std::logic_error, "Grid not supported for parallel Temperatures.");
81 return { nullptr, nullptr};
84template< class Vector, class Matrix>
85std::tuple<std::unique_ptr<Dune::OverlappingSchwarzOperator<Matrix,Vector,Vector,
86 Dune::OwnerOverlapCopyCommunication<int,int>>>,
87 std::unique_ptr<typename EnergySolverSelector<Matrix,Vector>::type>>
90 using EnergyOperator = Dune::OverlappingSchwarzOperator<Matrix,Vector,Vector,
91 Dune::OwnerOverlapCopyCommunication<int,int>>;
93 const auto& cellComm = grid.cellCommunication();
94 auto op = std::make_unique<EnergyOperator>(M, cellComm);
95 auto dummyWeights = [](){ return Vector();};
96 return {std::move(op), std::make_unique<EnergySolver>(*op, cellComm, prm, dummyWeights, 0)};
100template< class Gr id, class Gr idView, class DofMapper, class Stencil, class Flu idSystem, class Scalar>
103 const EclipseState& eclState,
105 const DofMapper& dofMapper)
106 : gridView_(gridView)
107 , eclState_(eclState)
108 , cartMapper_(cartMapper)
109 , dofMapper_(dofMapper)
113template< class Gr id, class Gr idView, class DofMapper, class Stencil, class Flu idSystem, class Scalar>
115doInit(std::size_t numGridDof)
117 doTemp_ = eclState_.getSimulationConfig().isTemp();
118 temperature_.resize(numGridDof);
123 energyVector_.resize(numGridDof);
124 maxTempChange_ = Parameters::Get<Parameters::MaxTemperatureChange<Scalar>>();
127template< class Gr id, class Gr idView, class DofMapper, class Stencil, class Flu idSystem, class Scalar>
132 Scalar tolerance = 1e-2;
137 prm. put( "maxiter", maxIter);
138 prm. put( "tol", tolerance);
139 prm. put( "verbosity", verbosity);
140 prm. put( "solver", std::string( "bicgstab"));
141 prm. put( "preconditioner.type", std::string( "ParOverILU0"));
144 if(gridView_.grid().comm().size() > 1)
146 auto [energyOperator, solver] =
147 createParallelFlexibleSolver<EnergyVector>(gridView_.grid(), M, prm);
148 (void) energyOperator;
151 solver->apply(x, b, result);
154 return result.converged;
159 using EnergySolver = Dune::BiCGSTABSolver<EnergyVector>;
160 using EnergyOperator = Dune::MatrixAdapter<EnergyMatrix,EnergyVector,EnergyVector>;
161 using EnergyScalarProduct = Dune::SeqScalarProduct<EnergyVector>;
162 using EnergyPreconditioner = Dune::SeqILU< EnergyMatrix,EnergyVector,EnergyVector>;
164 EnergyOperator energyOperator(M);
165 EnergyScalarProduct energyScalarProduct;
166 EnergyPreconditioner energyPreconditioner(M, 0, 1);
168 EnergySolver solver (energyOperator, energyScalarProduct,
169 energyPreconditioner, tolerance, maxIter,
173 solver.apply(x, b, result);
176 return result.converged;
Definition: CollectDataOnIORank.hpp:49
Definition: FlexibleSolver.hpp:45
GenericTemperatureModel(const GridView &gridView, const EclipseState &eclState, const CartesianIndexMapper &cartMapper, const DofMapper &dofMapper) Definition: GenericTemperatureModel_impl.hpp:102
Dune::BCRSMatrix< MatrixBlockTemp > EnergyMatrix Definition: GenericTemperatureModel.hpp:56
bool linearSolve_(const EnergyMatrix &M, EnergyVector &x, EnergyVector &b) Definition: GenericTemperatureModel_impl.hpp:129
Dune::BlockVector< Dune::FieldVector< Scalar, 1 > > EnergyVector Definition: GenericTemperatureModel.hpp:57
void doInit(std::size_t numGridDof) Initialize all internal data structures needed by the temperature module. Definition: GenericTemperatureModel_impl.hpp:115
Hierarchical collection of key/value pairs. Definition: PropertyTree.hpp:39
void put(const std::string &key, const T &data)
Definition: blackoilbioeffectsmodules.hh:43
Dune::InverseOperatorResult InverseOperatorResult Definition: GpuBridge.hpp:32
std::tuple< std::unique_ptr< Dune::OverlappingSchwarzOperator< Matrix, Vector, Vector, Dune::OwnerOverlapCopyCommunication< int, int > > >, std::unique_ptr< typename EnergySolverSelector< Matrix, Vector >::type > > createParallelFlexibleSolver(const Grid &, const Matrix &, const PropertyTree &) Definition: GenericTemperatureModel_impl.hpp:78
Definition: GenericTemperatureModel_impl.hpp:68
Dune::OverlappingSchwarzOperator< M, V, V, Comm > EnergyOperator Definition: GenericTemperatureModel_impl.hpp:70
Dune::OwnerOverlapCopyCommunication< int, int > Comm Definition: GenericTemperatureModel_impl.hpp:69
|