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
40
41#include <cstddef>
42#include <memory>
43#include <vector>
44
45namespace Opm {
46
47class EclipseState;
48class Well;
49
50template<class Grid, class GridView, class DofMapper, class Stencil, class FluidSystem, class Scalar>
52{
53public:
54 using EnergyMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<Scalar, 1, 1>>;
55 using EnergyVector = Dune::BlockVector<Dune::FieldVector<Scalar, 1>>;
57 static constexpr int dimWorld = Grid::dimensionworld;
58
59 bool doTemp()
60 {
61 return doTemp_;
62 }
63
64 const Scalar temperature(size_t globalIdx) const
65 {
66 return temperature_[globalIdx];
67 }
68
69protected:
70 GenericTemperatureModel(const GridView& gridView,
71 const EclipseState& eclState,
72 const CartesianIndexMapper& cartMapper,
73 const DofMapper& dofMapper);
74
78 void doInit(std::size_t numGridDof);
79
81
82 const GridView& gridView_;
83 const EclipseState& eclState_;
85 const DofMapper& dofMapper_;
86
88 std::unique_ptr<EnergyMatrix> energyMatrix_;
89 std::vector<Scalar> temperature_;
90 std::vector<Scalar> energy_rates_;
91 bool doTemp_{false};
92 Scalar maxTempChange_{5.0};
93};
94
95} // namespace Opm
96
97#endif // OPM_GENERIC_TEMPERATURE_MODEL_HPP
Definition: CollectDataOnIORank.hpp:49
Definition: GenericTemperatureModel.hpp:52
GenericTemperatureModel(const GridView &gridView, const EclipseState &eclState, const CartesianIndexMapper &cartMapper, const DofMapper &dofMapper)
Definition: GenericTemperatureModel_impl.hpp:102
EnergyVector energyVector_
Definition: GenericTemperatureModel.hpp:87
const DofMapper & dofMapper_
Definition: GenericTemperatureModel.hpp:85
std::vector< Scalar > energy_rates_
Definition: GenericTemperatureModel.hpp:90
std::unique_ptr< EnergyMatrix > energyMatrix_
Definition: GenericTemperatureModel.hpp:88
const CartesianIndexMapper & cartMapper_
Definition: GenericTemperatureModel.hpp:84
Dune::BCRSMatrix< Opm::MatrixBlock< Scalar, 1, 1 > > EnergyMatrix
Definition: GenericTemperatureModel.hpp:54
bool doTemp_
Definition: GenericTemperatureModel.hpp:91
bool linearSolve_(const EnergyMatrix &M, EnergyVector &x, EnergyVector &b)
Definition: GenericTemperatureModel_impl.hpp:165
Dune::BlockVector< Dune::FieldVector< Scalar, 1 > > EnergyVector
Definition: GenericTemperatureModel.hpp:55
bool doTemp()
Definition: GenericTemperatureModel.hpp:59
static constexpr int dimWorld
Definition: GenericTemperatureModel.hpp:57
Dune::CartesianIndexMapper< Grid > CartesianIndexMapper
Definition: GenericTemperatureModel.hpp:56
void doInit(std::size_t numGridDof)
Initialize all internal data structures needed by the temperature module.
Definition: GenericTemperatureModel_impl.hpp:115
Scalar maxTempChange_
Definition: GenericTemperatureModel.hpp:92
const Scalar temperature(size_t globalIdx) const
Definition: GenericTemperatureModel.hpp:64
std::vector< Scalar > temperature_
Definition: GenericTemperatureModel.hpp:89
const GridView & gridView_
Definition: GenericTemperatureModel.hpp:82
const EclipseState & eclState_
Definition: GenericTemperatureModel.hpp:83
Definition: blackoilbioeffectsmodules.hh:43