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
32
33#include <cassert>
34
35namespace Opm {
36
41template <class ScalarT>
43{
45
46public:
47 using Scalar = ScalarT;
48
50
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
96 { EnsureFinalized::check(); return internalEnergyFunction_; }
97
98private:
99 InternalEnergyFunction internalEnergyFunction_;
100};
101
102} // namespace Opm
103
104#endif
The default implementation of a parameter object for the ECL thermal law based on SPECROCK.
Definition: EclSpecrockLawParams.hpp:43
const InternalEnergyFunction & internalEnergyFunction() const
Return the function which maps temparature to the rock's volumetric internal energy.
Definition: EclSpecrockLawParams.hpp:95
EclSpecrockLawParams()
Definition: EclSpecrockLawParams.hpp:51
EclSpecrockLawParams(const EclSpecrockLawParams &)=default
ScalarT Scalar
Definition: EclSpecrockLawParams.hpp:47
void setHeatCapacities(const Container &temperature, const Container &heatCapacity)
Specify the volumetric internal energy of rock via heat capacities.
Definition: EclSpecrockLawParams.hpp:58
Default implementation for asserting finalization of parameter objects.
Definition: EnsureFinalized.hpp:47
void check() const
Definition: EnsureFinalized.hpp:63
void setXYContainers(const ScalarContainerX &x, const ScalarContainerY &y, bool sortInputs=true)
Set the sampling points for the piecewise linear function.
Definition: Tabulated1DFunction.hpp:128
Definition: Air_Mesitylene.hpp:34