opm-common
Loading...
Searching...
No Matches
DeadOilPvt.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_DEAD_OIL_PVT_HPP
28#define OPM_DEAD_OIL_PVT_HPP
29
31
32#include <cstddef>
33#include <vector>
34
35namespace Opm {
36
37#if HAVE_ECL_INPUT
38class EclipseState;
39class Schedule;
40#endif
41
46template <class Scalar>
48{
49public:
50 using TabulatedOneDFunction = Tabulated1DFunction<Scalar>;
51
52#if HAVE_ECL_INPUT
56 void initFromState(const EclipseState& eclState, const Schedule&);
57#endif // HAVE_ECL_INPUT
58
59 void setNumRegions(std::size_t numRegions);
60
61 void setVapPars(const Scalar, const Scalar)
62 {
63 }
64
68 void setReferenceDensities(unsigned regionIdx,
69 Scalar rhoRefOil,
70 Scalar /*rhoRefGas*/,
71 Scalar /*rhoRefWater*/)
72 {
73 oilReferenceDensity_[regionIdx] = rhoRefOil;
74 }
75
86 void setInverseOilFormationVolumeFactor(unsigned regionIdx,
87 const TabulatedOneDFunction& invBo)
88 { inverseOilB_[regionIdx] = invBo; }
89
95 void setOilViscosity(unsigned regionIdx, const TabulatedOneDFunction& muo)
96 { oilMu_[regionIdx] = muo; }
97
101 void initEnd();
102
106 unsigned numRegions() const
107 { return inverseOilBMu_.size(); }
108
112 template <class Evaluation>
113 Evaluation internalEnergy(unsigned,
114 const Evaluation&,
115 const Evaluation&,
116 const Evaluation&) const
117 {
118 throw std::runtime_error("Requested the enthalpy of oil but the thermal "
119 "option is not enabled");
120 }
121
122 Scalar hVap(unsigned) const
123 {
124 throw std::runtime_error("Requested the hvap of oil but the thermal "
125 "option is not enabled");
126 }
130 template <class Evaluation>
131 Evaluation viscosity(unsigned regionIdx,
132 const Evaluation& temperature,
133 const Evaluation& pressure,
134 const Evaluation& /*Rs*/) const
135 { return saturatedViscosity(regionIdx, temperature, pressure); }
136
140 template <class Evaluation>
141 Evaluation saturatedViscosity(unsigned regionIdx,
142 const Evaluation& /*temperature*/,
143 const Evaluation& pressure) const
144 {
145 const Evaluation& invBo = inverseOilB_[regionIdx].eval(pressure, /*extrapolate=*/true);
146 const Evaluation& invMuoBo = inverseOilBMu_[regionIdx].eval(pressure, /*extrapolate=*/true);
147
148 return invBo / invMuoBo;
149 }
150
154 template <class Evaluation>
155 Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
156 const Evaluation& /*temperature*/,
157 const Evaluation& pressure,
158 const Evaluation& /*Rs*/) const
159 { return inverseOilB_[regionIdx].eval(pressure, /*extrapolate=*/true); }
160
164 template <class FluidState, class LhsEval = typename FluidState::Scalar>
165 std::pair<LhsEval, LhsEval>
166 inverseFormationVolumeFactorAndViscosity(const FluidState& fluidState, unsigned regionIdx)
167 {
168 const LhsEval& p = decay<LhsEval>(fluidState.pressure(FluidState::oilPhaseIdx));
169 const auto segIdx = this->inverseOilB_[regionIdx].findSegmentIndex(p, /*extrapolate=*/ true);
170 const auto& invBo = this->inverseOilB_[regionIdx].eval(p, SegmentIndex{segIdx});
171 const auto& invMuoBo = this->inverseOilBMu_[regionIdx].eval(p, SegmentIndex{segIdx});
172 return { invBo, invBo / invMuoBo };
173 }
174
180 template <class Evaluation>
181 Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
182 const Evaluation& /*temperature*/,
183 const Evaluation& pressure) const
184 { return inverseOilB_[regionIdx].eval(pressure, /*extrapolate=*/true); }
185
189 template <class Evaluation>
190 Evaluation saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
191 const Evaluation& /*temperature*/,
192 const Evaluation& /*pressure*/) const
193 { return 0.0; /* this is dead oil! */ }
194
198 template <class Evaluation>
199 Evaluation saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
200 const Evaluation& /*temperature*/,
201 const Evaluation& /*pressure*/,
202 const Evaluation& /*oilSaturation*/,
203 const Evaluation& /*maxOilSaturation*/) const
204 { return 0.0; /* this is dead oil! */ }
205
212 template <class Evaluation>
213 Evaluation saturationPressure(unsigned /*regionIdx*/,
214 const Evaluation& /*temperature*/,
215 const Evaluation& /*Rs*/) const
216 { return 0.0; /* this is dead oil, so there isn't any meaningful saturation pressure! */ }
217
218 template <class Evaluation>
219 Evaluation saturatedGasMassFraction(unsigned /*regionIdx*/,
220 const Evaluation& /*temperature*/,
221 const Evaluation& /*pressure*/) const
222 { return 0.0; /* this is dead oil! */ }
223
224 template <class Evaluation>
225 Evaluation saturatedGasMoleFraction(unsigned /*regionIdx*/,
226 const Evaluation& /*temperature*/,
227 const Evaluation& /*pressure*/) const
228 { return 0.0; /* this is dead oil! */ }
229
230 template <class Evaluation>
231 Evaluation diffusionCoefficient(const Evaluation& /*temperature*/,
232 const Evaluation& /*pressure*/,
233 unsigned /*compIdx*/) const
234 {
235 throw std::runtime_error("Not implemented: The PVT model does not provide "
236 "a diffusionCoefficient()");
237 }
238
239 Scalar oilReferenceDensity(unsigned regionIdx) const
240 { return oilReferenceDensity_[regionIdx]; }
241
242 const std::vector<TabulatedOneDFunction>& inverseOilB() const
243 { return inverseOilB_; }
244
245 const std::vector<TabulatedOneDFunction>& oilMu() const
246 { return oilMu_; }
247
248 const std::vector<TabulatedOneDFunction>& inverseOilBMu() const
249 { return inverseOilBMu_; }
250
251private:
252 std::vector<Scalar> oilReferenceDensity_{};
253 std::vector<TabulatedOneDFunction> inverseOilB_{};
254 std::vector<TabulatedOneDFunction> oilMu_{};
255 std::vector<TabulatedOneDFunction> inverseOilBMu_{};
256};
257
258} // namespace Opm
259
260#endif
Implements a linearly interpolated scalar function that depends on one variable.
This class represents the Pressure-Volume-Temperature relations of the oil phase without dissolved ga...
Definition DeadOilPvt.hpp:48
void setOilViscosity(unsigned regionIdx, const TabulatedOneDFunction &muo)
Initialize the viscosity of the oil phase.
Definition DeadOilPvt.hpp:95
Evaluation saturatedGasDissolutionFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the gas dissolution factor [m^3/m^3] of the oil phase.
Definition DeadOilPvt.hpp:190
std::pair< LhsEval, LhsEval > inverseFormationVolumeFactorAndViscosity(const FluidState &fluidState, unsigned regionIdx)
Returns the formation volume factor [-] and viscosity [Pa s] of the fluid phase.
Definition DeadOilPvt.hpp:166
void setInverseOilFormationVolumeFactor(unsigned regionIdx, const TabulatedOneDFunction &invBo)
Initialize the function for the oil formation volume factor.
Definition DeadOilPvt.hpp:86
Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition DeadOilPvt.hpp:131
void setReferenceDensities(unsigned regionIdx, Scalar rhoRefOil, Scalar, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition DeadOilPvt.hpp:68
void initEnd()
Finish initializing the oil phase PVT properties.
Definition DeadOilPvt.cpp:92
Evaluation saturatedViscosity(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of gas saturated oil given a pressure.
Definition DeadOilPvt.hpp:141
Evaluation internalEnergy(unsigned, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the specific enthalpy [J/kg] of oil given a set of parameters.
Definition DeadOilPvt.hpp:113
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the formation volume factor [-] of saturated oil.
Definition DeadOilPvt.hpp:181
Evaluation saturationPressure(unsigned, const Evaluation &, const Evaluation &) const
Returns the saturation pressure of the oil phase [Pa] depending on its mass fraction of the gas compo...
Definition DeadOilPvt.hpp:213
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure, const Evaluation &) const
Returns the formation volume factor [-] of the fluid phase.
Definition DeadOilPvt.hpp:155
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition DeadOilPvt.hpp:106
Evaluation saturatedGasDissolutionFactor(unsigned, const Evaluation &, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the gas dissolution factor [m^3/m^3] of the oil phase.
Definition DeadOilPvt.hpp:199
Definition EclipseState.hpp:62
Definition Schedule.hpp:101
Implements a linearly interpolated scalar function that depends on one variable.
Definition Tabulated1DFunction.hpp:51
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition Tabulated1DFunction.hpp:41