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
36
38
39#include <opm/input/eclipse/EclipseState/Phase.hpp>
40
41#include <array>
42#include <cstddef>
43#include <functional>
44#include <map>
45#include <memory>
46#include <string>
47#include <vector>
48
49namespace Opm {
50
51class EclipseState;
52class Well;
53
54template<class Grid, class GridView, class DofMapper, class Stencil, class FluidSystem, class Scalar>
56public:
57 using EnergyMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<Scalar, 1, 1>>;
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 return temperature_[globalIdx];
69 }
70
71protected:
72 GenericTemperatureModel(const GridView& gridView,
73 const EclipseState& eclState,
74 const CartesianIndexMapper& cartMapper,
75 const DofMapper& dofMapper);
76
80 void doInit(std::size_t numGridDof);
81
83
84 const GridView& gridView_;
85 const EclipseState& eclState_;
87 const DofMapper& dofMapper_;
88
90 std::unique_ptr<EnergyMatrix> energyMatrix_;
91 std::vector<Scalar> temperature_;
92 std::vector<Scalar> energy_rates_;
93 bool doTemp_{false};
94 Scalar maxTempChange_{5.0};
95
96};
97
98} // namespace Opm
99
100#endif // OPM_GENERIC_TEMPERATURE_MODEL_HPP
Definition: CollectDataOnIORank.hpp:49
Definition: GenericTemperatureModel.hpp:55
GenericTemperatureModel(const GridView &gridView, const EclipseState &eclState, const CartesianIndexMapper &cartMapper, const DofMapper &dofMapper)
Definition: GenericTemperatureModel_impl.hpp:99
EnergyVector energyVector_
Definition: GenericTemperatureModel.hpp:89
const DofMapper & dofMapper_
Definition: GenericTemperatureModel.hpp:87
std::vector< Scalar > energy_rates_
Definition: GenericTemperatureModel.hpp:92
std::unique_ptr< EnergyMatrix > energyMatrix_
Definition: GenericTemperatureModel.hpp:90
const CartesianIndexMapper & cartMapper_
Definition: GenericTemperatureModel.hpp:86
Dune::BCRSMatrix< Opm::MatrixBlock< Scalar, 1, 1 > > EnergyMatrix
Definition: GenericTemperatureModel.hpp:57
bool doTemp_
Definition: GenericTemperatureModel.hpp:93
bool linearSolve_(const EnergyMatrix &M, EnergyVector &x, EnergyVector &b)
Definition: GenericTemperatureModel_impl.hpp:163
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
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:113
Scalar maxTempChange_
Definition: GenericTemperatureModel.hpp:94
const Scalar temperature(size_t globalIdx) const
Definition: GenericTemperatureModel.hpp:67
std::vector< Scalar > temperature_
Definition: GenericTemperatureModel.hpp:91
const GridView & gridView_
Definition: GenericTemperatureModel.hpp:84
const EclipseState & eclState_
Definition: GenericTemperatureModel.hpp:85
Definition: blackoilbioeffectsmodules.hh:43