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
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>
53{
54public:
55 // the jacobian matrix
57 using EnergyMatrix = Dune::BCRSMatrix<MatrixBlockTemp>;
58 using EnergyVector = Dune::BlockVector<Dune::FieldVector<Scalar, 1>>;
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);
85
86 const GridView& gridView_;
87 const EclipseState& eclState_;
89 const DofMapper& dofMapper_;
90
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>;
100
101 std::unique_ptr<AbstractSolverType> linear_solver_;
102 std::unique_ptr<AbstractOperatorType> op_;
104};
105
106} // namespace Opm
107
108#endif // OPM_GENERIC_TEMPERATURE_MODEL_HPP
Definition: CollectDataOnIORank.hpp:49
Interface class adding the update() method to the preconditioner interface.
Definition: PreconditionerWithUpdate.hpp:32
Definition: GenericTemperatureModel.hpp:53
GenericTemperatureModel(const GridView &gridView, const EclipseState &eclState, const CartesianIndexMapper &cartMapper, const DofMapper &dofMapper)
Definition: GenericTemperatureModel_impl.hpp:102
EnergyVector energyVector_
Definition: GenericTemperatureModel.hpp:91
const DofMapper & dofMapper_
Definition: GenericTemperatureModel.hpp:89
std::vector< Scalar > energy_rates_
Definition: GenericTemperatureModel.hpp:93
void setupLinearSolver(const EnergyMatrix &M)
Definition: GenericTemperatureModel_impl.hpp:129
AbstractPreconditionerType * pre_
Definition: GenericTemperatureModel.hpp:103
const CartesianIndexMapper & cartMapper_
Definition: GenericTemperatureModel.hpp:88
bool doTemp_
Definition: GenericTemperatureModel.hpp:94
Dune::BCRSMatrix< MatrixBlockTemp > EnergyMatrix
Definition: GenericTemperatureModel.hpp:57
bool linearSolve_(const EnergyMatrix &M, EnergyVector &x, EnergyVector &b)
Definition: GenericTemperatureModel_impl.hpp:166
Dune::BlockVector< Dune::FieldVector< Scalar, 1 > > EnergyVector
Definition: GenericTemperatureModel.hpp:58
bool doTemp()
Definition: GenericTemperatureModel.hpp:62
static constexpr int dimWorld
Definition: GenericTemperatureModel.hpp:60
std::unique_ptr< AbstractSolverType > linear_solver_
Definition: GenericTemperatureModel.hpp:101
Dune::CartesianIndexMapper< Grid > CartesianIndexMapper
Definition: GenericTemperatureModel.hpp:59
void doInit(std::size_t numGridDof)
Initialize all internal data structures needed by the temperature module.
Definition: GenericTemperatureModel_impl.hpp:115
Dune::AssembledLinearOperator< EnergyMatrix, EnergyVector, EnergyVector > AbstractOperatorType
Definition: GenericTemperatureModel.hpp:98
Scalar maxTempChange_
Definition: GenericTemperatureModel.hpp:95
const Scalar temperature(size_t globalIdx) const
Definition: GenericTemperatureModel.hpp:67
std::vector< Scalar > temperature_
Definition: GenericTemperatureModel.hpp:92
const GridView & gridView_
Definition: GenericTemperatureModel.hpp:86
const EclipseState & eclState_
Definition: GenericTemperatureModel.hpp:87
std::unique_ptr< AbstractOperatorType > op_
Definition: GenericTemperatureModel.hpp:102
Dune::InverseOperator< EnergyVector, EnergyVector > AbstractSolverType
Definition: GenericTemperatureModel.hpp:97
Definition: matrixblock.hh:229
Definition: blackoilbioeffectsmodules.hh:45