opm-simulators
Loading...
Searching...
No Matches
GenericTemperatureModel.hpp
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
19 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
28#ifndef OPM_GENERIC_TEMPERATURE_MODEL_HPP
29#define OPM_GENERIC_TEMPERATURE_MODEL_HPP
30
31#include <dune/istl/bcrsmatrix.hh>
32
33#include <opm/grid/common/CartesianIndexMapper.hpp>
34
35#include <opm/input/eclipse/EclipseState/Phase.hpp>
36
38
39#include <opm/simulators/linalg/FlexibleSolver.hpp>
40#include <opm/simulators/linalg/matrixblock.hh>
41
42#include <cstddef>
43#include <memory>
44#include <vector>
45
46namespace Opm {
47
48class EclipseState;
49class Well;
50
51template<class Grid, class GridView, class DofMapper, class Stencil, class FluidSystem, class Scalar>
52class GenericTemperatureModel
53{
54public:
55 // the jacobian matrix
56 using MatrixBlockTemp = MatrixBlock<Scalar, 1, 1>;
57 using EnergyMatrix = Dune::BCRSMatrix<MatrixBlockTemp>;
58 using EnergyVector = Dune::BlockVector<Dune::FieldVector<Scalar, 1>>;
59 using CartesianIndexMapper = Dune::CartesianIndexMapper<Grid>;
60 static constexpr int dimWorld = Grid::dimensionworld;
61
62 bool doTemp()
63 {
64 return doTemp_;
65 }
66
67 const Scalar temperature(size_t globalIdx) const
68 {
69 return temperature_[globalIdx];
70 }
71
72protected:
73 GenericTemperatureModel(const GridView& gridView,
74 const EclipseState& eclState,
75 const CartesianIndexMapper& cartMapper,
76 const DofMapper& dofMapper);
77
81 void doInit(std::size_t numGridDof);
82
83 void setupLinearSolver(const EnergyMatrix& M);
84 bool linearSolve_(const EnergyMatrix& M, EnergyVector& x, EnergyVector& b);
85
86 const GridView& gridView_;
87 const EclipseState& eclState_;
88 const CartesianIndexMapper& cartMapper_;
89 const DofMapper& dofMapper_;
90
91 EnergyVector energyVector_;
92 std::vector<Scalar> temperature_;
93 std::vector<Scalar> energy_rates_;
94 bool doTemp_{false};
95 Scalar maxTempChange_{5.0};
96
97 using AbstractSolverType = Dune::InverseOperator<EnergyVector, EnergyVector>;
98 using AbstractOperatorType = Dune::AssembledLinearOperator<EnergyMatrix, EnergyVector, EnergyVector>;
99 using AbstractPreconditionerType = Dune::PreconditionerWithUpdate<EnergyVector, EnergyVector>;
100
101 std::unique_ptr<AbstractSolverType> linear_solver_;
102 std::unique_ptr<AbstractOperatorType> op_;
103 AbstractPreconditionerType* pre_ = nullptr;
104};
105
106} // namespace Opm
107
108#endif // OPM_GENERIC_TEMPERATURE_MODEL_HPP
A fully-implicit black-oil flow model.
Definition CollectDataOnIORank.hpp:49
Interface class adding the update() method to the preconditioner interface.
Definition PreconditionerWithUpdate.hpp:34
void doInit(std::size_t numGridDof)
Initialize all internal data structures needed by the temperature module.
Definition GenericTemperatureModel_impl.hpp:115
Definition matrixblock.hh:229
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:45