opm-common
Toggle main menu visibility
Loading...
Searching...
No Matches
EclSpecrockLawParams.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
*/
27
#ifndef OPM_ECL_SPECROCK_LAW_PARAMS_HPP
28
#define OPM_ECL_SPECROCK_LAW_PARAMS_HPP
29
30
#include <
opm/material/common/EnsureFinalized.hpp
>
31
#include <
opm/material/common/Tabulated1DFunction.hpp
>
32
33
#include <cassert>
34
35
namespace
Opm
{
36
41
template
<
class
ScalarT>
42
class
EclSpecrockLawParams :
public
EnsureFinalized
43
{
44
using
InternalEnergyFunction =
Tabulated1DFunction<ScalarT>
;
45
46
public
:
47
using
Scalar = ScalarT;
48
49
EclSpecrockLawParams(
const
EclSpecrockLawParams&) =
default
;
50
51
EclSpecrockLawParams()
52
{ }
53
57
template
<
class
Container>
58
void
setHeatCapacities
(
const
Container& temperature,
59
const
Container& heatCapacity)
60
{
61
assert(temperature.size() == heatCapacity.size());
62
63
// integrate the heat capacity to compute the internal energy
64
Scalar curU = temperature[0]*heatCapacity[0];
65
unsigned
n = temperature.size();
66
std::vector<Scalar> T(n);
67
std::vector<Scalar> u(n);
68
for
(
unsigned
i = 0; i < temperature.size(); ++ i) {
69
T[i] = temperature[i];
70
u[i] = curU;
71
72
if
(i >= temperature.size() - 1)
73
break
;
74
75
// integrate to the heat capacity from the current sampling point to the next
76
// one. this leads to a quadratic polynomial.
77
Scalar c_v0 = heatCapacity[i];
78
Scalar c_v1 = heatCapacity[i + 1];
79
Scalar T0 = temperature[i];
80
Scalar T1 = temperature[i + 1];
81
curU += 0.5*(c_v0 + c_v1)*(T1 - T0);
82
}
83
84
internalEnergyFunction_.setXYContainers(T, u);
85
}
86
95
const
InternalEnergyFunction&
internalEnergyFunction
()
const
96
{ EnsureFinalized::check();
return
internalEnergyFunction_; }
97
98
private
:
99
InternalEnergyFunction internalEnergyFunction_;
100
};
101
102
}
// namespace Opm
103
104
#endif
EnsureFinalized.hpp
Default implementation for asserting finalization of parameter objects.
Tabulated1DFunction.hpp
Implements a linearly interpolated scalar function that depends on one variable.
Opm::EclSpecrockLawParams::internalEnergyFunction
const InternalEnergyFunction & internalEnergyFunction() const
Return the function which maps temparature to the rock's volumetric internal energy.
Definition
EclSpecrockLawParams.hpp:95
Opm::EclSpecrockLawParams::setHeatCapacities
void setHeatCapacities(const Container &temperature, const Container &heatCapacity)
Specify the volumetric internal energy of rock via heat capacities.
Definition
EclSpecrockLawParams.hpp:58
Opm::EnsureFinalized::EnsureFinalized
OPM_HOST_DEVICE EnsureFinalized()
The default constructor.
Definition
EnsureFinalized.hpp:58
Opm::Tabulated1DFunction
Implements a linearly interpolated scalar function that depends on one variable.
Definition
Tabulated1DFunction.hpp:51
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition
Exceptions.hpp:30
opm
material
thermal
EclSpecrockLawParams.hpp
Generated by
1.17.0