opm-common
Loading...
Searching...
No Matches
DryGasPvt.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_DRY_GAS_PVT_HPP
28#define OPM_DRY_GAS_PVT_HPP
29
31
33
34#include <cstddef>
35#include <vector>
36
37namespace Opm {
38
39#if HAVE_ECL_INPUT
40class EclipseState;
41class Schedule;
42#endif
43
48template <class Scalar>
50{
51 using SamplingPoints = std::vector<std::pair<Scalar, Scalar>>;
52
53public:
54 using TabulatedOneDFunction = Tabulated1DFunction<Scalar>;
55
56#if HAVE_ECL_INPUT
62 void initFromState(const EclipseState& eclState, const Schedule&);
63#endif
64
65 void setNumRegions(std::size_t numRegions);
66
67 void setVapPars(const Scalar, const Scalar)
68 {
69 }
70
74 void setReferenceDensities(unsigned regionIdx,
75 Scalar /*rhoRefOil*/,
76 Scalar rhoRefGas,
77 Scalar /*rhoRefWater*/)
78 {
79 gasReferenceDensity_[regionIdx] = rhoRefGas;
80 }
81
85 void setMolarMasses(unsigned /*regionIdx*/,
86 Scalar /*MOil*/,
87 Scalar /*MGas*/,
88 Scalar /*MWater*/)
89 { }
90
96 void setGasViscosity(unsigned regionIdx, const TabulatedOneDFunction& mug)
97 { gasMu_[regionIdx] = mug; }
98
105 void setGasFormationVolumeFactor(unsigned regionIdx,
106 const SamplingPoints& samplePoints);
107
111 void initEnd();
112
116 unsigned numRegions() const
117 { return gasReferenceDensity_.size(); }
118
122 template <class Evaluation>
123 Evaluation internalEnergy(unsigned,
124 const Evaluation&,
125 const Evaluation&,
126 const Evaluation&,
127 const Evaluation&) const
128 {
129 throw std::runtime_error("Requested the enthalpy of gas but the thermal "
130 "option is not enabled");
131 }
132
133 Scalar hVap(unsigned) const
134 {
135 throw std::runtime_error("Requested the hvap of oil but the thermal "
136 "option is not enabled");
137 }
141 template <class Evaluation>
142 Evaluation viscosity(unsigned regionIdx,
143 const Evaluation& temperature,
144 const Evaluation& pressure,
145 const Evaluation& /*Rv*/,
146 const Evaluation& /*Rvw*/) const
147 { return saturatedViscosity(regionIdx, temperature, pressure); }
148
152 template <class Evaluation>
153 Evaluation saturatedViscosity(unsigned regionIdx,
154 const Evaluation& /*temperature*/,
155 const Evaluation& pressure) const
156 {
157 const Evaluation& invBg = inverseGasB_[regionIdx].eval(pressure, /*extrapolate=*/true);
158 const Evaluation& invMugBg = inverseGasBMu_[regionIdx].eval(pressure, /*extrapolate=*/true);
159
160 return invBg / invMugBg;
161 }
162
166 template <class Evaluation>
167 Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
168 const Evaluation& temperature,
169 const Evaluation& pressure,
170 const Evaluation& /*Rv*/,
171 const Evaluation& /*Rvw*/) const
172 { return saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure); }
173
177 template <class FluidState, class LhsEval = typename FluidState::Scalar>
178 std::pair<LhsEval, LhsEval>
179 inverseFormationVolumeFactorAndViscosity(const FluidState& fluidState, unsigned regionIdx)
180 {
181 const LhsEval& p = decay<LhsEval>(fluidState.pressure(FluidState::gasPhaseIdx));
182 const auto segIdx = this->inverseGasB_[regionIdx].findSegmentIndex(p, /*extrapolate=*/ true);
183 const auto& invBg = this->inverseGasB_[regionIdx].eval(p, SegmentIndex{segIdx});
184 const auto& invMugBg = this->inverseGasBMu_[regionIdx].eval(p, SegmentIndex{segIdx});
185 return { invBg, invBg / invMugBg };
186 }
187
191 template <class Evaluation>
192 Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
193 const Evaluation& /*temperature*/,
194 const Evaluation& pressure) const
195 { return inverseGasB_[regionIdx].eval(pressure, /*extrapolate=*/true); }
196
204 template <class Evaluation>
205 Evaluation saturationPressure(unsigned /*regionIdx*/,
206 const Evaluation& /*temperature*/,
207 const Evaluation& /*Rv*/) const
208 { return 0.0; /* this is dry gas! */ }
209
213 template <class Evaluation>
214 Evaluation saturatedWaterVaporizationFactor(unsigned /*regionIdx*/,
215 const Evaluation& /*temperature*/,
216 const Evaluation& /*pressure*/) const
217 { return 0.0; /* this is non-humid gas! */ }
218
222 template <class Evaluation = Scalar>
223 Evaluation saturatedWaterVaporizationFactor(unsigned /*regionIdx*/,
224 const Evaluation& /*temperature*/,
225 const Evaluation& /*pressure*/,
226 const Evaluation& /*saltConcentration*/) const
227 { return 0.0; }
228
232 template <class Evaluation>
233 Evaluation saturatedOilVaporizationFactor(unsigned /*regionIdx*/,
234 const Evaluation& /*temperature*/,
235 const Evaluation& /*pressure*/,
236 const Evaluation& /*oilSaturation*/,
237 const Evaluation& /*maxOilSaturation*/) const
238 { return 0.0; /* this is dry gas! */ }
239
243 template <class Evaluation>
244 Evaluation saturatedOilVaporizationFactor(unsigned /*regionIdx*/,
245 const Evaluation& /*temperature*/,
246 const Evaluation& /*pressure*/) const
247 { return 0.0; /* this is dry gas! */ }
248
249 template <class Evaluation>
250 Evaluation diffusionCoefficient(const Evaluation& /*temperature*/,
251 const Evaluation& /*pressure*/,
252 unsigned /*compIdx*/) const
253 {
254 throw std::runtime_error("Not implemented: The PVT model does not provide "
255 "a diffusionCoefficient()");
256 }
257
258 Scalar gasReferenceDensity(unsigned regionIdx) const
259 { return gasReferenceDensity_[regionIdx]; }
260
261 const std::vector<TabulatedOneDFunction>& inverseGasB() const
262 { return inverseGasB_; }
263
264 const std::vector<TabulatedOneDFunction>& gasMu() const
265 { return gasMu_; }
266
267 const std::vector<TabulatedOneDFunction>& inverseGasBMu() const
268 { return inverseGasBMu_; }
269
270private:
271 std::vector<Scalar> gasReferenceDensity_{};
272 std::vector<TabulatedOneDFunction> inverseGasB_{};
273 std::vector<TabulatedOneDFunction> gasMu_{};
274 std::vector<TabulatedOneDFunction> inverseGasBMu_{};
275};
276
277} // namespace Opm
278
279#endif
Implements a linearly interpolated scalar function that depends on one variable.
This class represents the Pressure-Volume-Temperature relations of the gas phase without vaporized oi...
Definition DryGasPvt.hpp:50
Evaluation saturatedViscosity(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of oil saturated gas at given pressure.
Definition DryGasPvt.hpp:153
Evaluation saturationPressure(unsigned, const Evaluation &, const Evaluation &) const
Returns the saturation pressure of the gas phase [Pa] depending on its mass fraction of the oil compo...
Definition DryGasPvt.hpp:205
Evaluation internalEnergy(unsigned, const Evaluation &, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the specific enthalpy [J/kg] of gas given a set of parameters.
Definition DryGasPvt.hpp:123
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition DryGasPvt.hpp:116
void setGasFormationVolumeFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
Initialize the function for the formation volume factor of dry gas.
Definition DryGasPvt.cpp:103
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &, const Evaluation &) const
Returns the formation volume factor [-] of the fluid phase.
Definition DryGasPvt.hpp:167
Evaluation saturatedWaterVaporizationFactor(unsigned, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the water vaporization factor [m^3/m^3] of water saturated gas.
Definition DryGasPvt.hpp:223
Evaluation saturatedOilVaporizationFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the oil vaporization factor [m^3/m^3] of the oil phase.
Definition DryGasPvt.hpp:244
Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &, const Evaluation &) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition DryGasPvt.hpp:142
std::pair< LhsEval, LhsEval > inverseFormationVolumeFactorAndViscosity(const FluidState &fluidState, unsigned regionIdx)
Returns the formation volume factor [-] and viscosity [Pa s] of the fluid phase.
Definition DryGasPvt.hpp:179
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the formation volume factor [-] of oil saturated gas at given pressure.
Definition DryGasPvt.hpp:192
void initEnd()
Finish initializing the oil phase PVT properties.
Definition DryGasPvt.cpp:117
Evaluation saturatedWaterVaporizationFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the water vaporization factor [m^3/m^3] of the water phase.
Definition DryGasPvt.hpp:214
void setMolarMasses(unsigned, Scalar, Scalar, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition DryGasPvt.hpp:85
void setGasViscosity(unsigned regionIdx, const TabulatedOneDFunction &mug)
Initialize the viscosity of the gas phase.
Definition DryGasPvt.hpp:96
void setReferenceDensities(unsigned regionIdx, Scalar, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition DryGasPvt.hpp:74
Evaluation saturatedOilVaporizationFactor(unsigned, const Evaluation &, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the oil vaporization factor [m^3/m^3] of the oil phase.
Definition DryGasPvt.hpp:233
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