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
39class EclipseState;
40class Schedule;
41
46template <class Scalar>
48{
49 using SamplingPoints = std::vector<std::pair<Scalar, Scalar>>;
50
51public:
52 using TabulatedOneDFunction = Tabulated1DFunction<Scalar>;
53
59 void initFromState(const EclipseState& eclState, const Schedule&);
60
61 void setNumRegions(std::size_t numRegions);
62
63 void setVapPars(const Scalar, const Scalar)
64 {
65 }
66
70 void setReferenceDensities(unsigned regionIdx,
71 Scalar /*rhoRefOil*/,
72 Scalar rhoRefGas,
73 Scalar /*rhoRefWater*/)
74 {
75 gasReferenceDensity_[regionIdx] = rhoRefGas;
76 }
77
81 void setMolarMasses(unsigned /*regionIdx*/,
82 Scalar /*MOil*/,
83 Scalar /*MGas*/,
84 Scalar /*MWater*/)
85 { }
86
92 void setGasViscosity(unsigned regionIdx, const TabulatedOneDFunction& mug)
93 { gasMu_[regionIdx] = mug; }
94
101 void setGasFormationVolumeFactor(unsigned regionIdx,
102 const SamplingPoints& samplePoints);
103
107 void initEnd();
108
112 unsigned numRegions() const
113 { return gasReferenceDensity_.size(); }
114
118 template <class Evaluation>
119 Evaluation internalEnergy(unsigned,
120 const Evaluation&,
121 const Evaluation&,
122 const Evaluation&,
123 const Evaluation&) const
124 {
125 throw std::runtime_error("Requested the enthalpy of gas but the thermal "
126 "option is not enabled");
127 }
128
129 Scalar hVap(unsigned) const
130 {
131 throw std::runtime_error("Requested the hvap of oil but the thermal "
132 "option is not enabled");
133 }
137 template <class Evaluation>
138 Evaluation viscosity(unsigned regionIdx,
139 const Evaluation& temperature,
140 const Evaluation& pressure,
141 const Evaluation& /*Rv*/,
142 const Evaluation& /*Rvw*/) const
143 { return saturatedViscosity(regionIdx, temperature, pressure); }
144
148 template <class Evaluation>
149 Evaluation saturatedViscosity(unsigned regionIdx,
150 const Evaluation& /*temperature*/,
151 const Evaluation& pressure) const
152 {
153 const Evaluation& invBg = inverseGasB_[regionIdx].eval(pressure, /*extrapolate=*/true);
154 const Evaluation& invMugBg = inverseGasBMu_[regionIdx].eval(pressure, /*extrapolate=*/true);
155
156 return invBg / invMugBg;
157 }
158
162 template <class Evaluation>
163 Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
164 const Evaluation& temperature,
165 const Evaluation& pressure,
166 const Evaluation& /*Rv*/,
167 const Evaluation& /*Rvw*/) const
168 { return saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure); }
169
173 template <class FluidState, class LhsEval = typename FluidState::ValueType>
174 std::pair<LhsEval, LhsEval>
175 inverseFormationVolumeFactorAndViscosity(const FluidState& fluidState, unsigned regionIdx)
176 {
177 const LhsEval& p = decay<LhsEval>(fluidState.pressure(FluidState::gasPhaseIdx));
178 const auto segIdx = this->inverseGasB_[regionIdx].findSegmentIndex(p, /*extrapolate=*/ true);
179 const auto& invBg = this->inverseGasB_[regionIdx].eval(p, SegmentIndex{segIdx});
180 const auto& invMugBg = this->inverseGasBMu_[regionIdx].eval(p, SegmentIndex{segIdx});
181 return { invBg, invBg / invMugBg };
182 }
183
187 template <class Evaluation>
188 Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
189 const Evaluation& /*temperature*/,
190 const Evaluation& pressure) const
191 { return inverseGasB_[regionIdx].eval(pressure, /*extrapolate=*/true); }
192
200 template <class Evaluation>
201 Evaluation saturationPressure(unsigned /*regionIdx*/,
202 const Evaluation& /*temperature*/,
203 const Evaluation& /*Rv*/) const
204 { return 0.0; /* this is dry gas! */ }
205
209 template <class Evaluation>
210 Evaluation saturatedWaterVaporizationFactor(unsigned /*regionIdx*/,
211 const Evaluation& /*temperature*/,
212 const Evaluation& /*pressure*/) const
213 { return 0.0; /* this is non-humid gas! */ }
214
218 template <class Evaluation = Scalar>
219 Evaluation saturatedWaterVaporizationFactor(unsigned /*regionIdx*/,
220 const Evaluation& /*temperature*/,
221 const Evaluation& /*pressure*/,
222 const Evaluation& /*saltConcentration*/) const
223 { return 0.0; }
224
228 template <class Evaluation>
229 Evaluation saturatedOilVaporizationFactor(unsigned /*regionIdx*/,
230 const Evaluation& /*temperature*/,
231 const Evaluation& /*pressure*/,
232 const Evaluation& /*oilSaturation*/,
233 const Evaluation& /*maxOilSaturation*/) const
234 { return 0.0; /* this is dry gas! */ }
235
239 template <class Evaluation>
240 Evaluation saturatedOilVaporizationFactor(unsigned /*regionIdx*/,
241 const Evaluation& /*temperature*/,
242 const Evaluation& /*pressure*/) const
243 { return 0.0; /* this is dry gas! */ }
244
245 template <class Evaluation>
246 Evaluation diffusionCoefficient(const Evaluation& /*temperature*/,
247 const Evaluation& /*pressure*/,
248 unsigned /*compIdx*/) const
249 {
250 throw std::runtime_error("Not implemented: The PVT model does not provide "
251 "a diffusionCoefficient()");
252 }
253
254 Scalar gasReferenceDensity(unsigned regionIdx) const
255 { return gasReferenceDensity_[regionIdx]; }
256
257 const std::vector<TabulatedOneDFunction>& inverseGasB() const
258 { return inverseGasB_; }
259
260 const std::vector<TabulatedOneDFunction>& gasMu() const
261 { return gasMu_; }
262
263 const std::vector<TabulatedOneDFunction>& inverseGasBMu() const
264 { return inverseGasBMu_; }
265
266private:
267 std::vector<Scalar> gasReferenceDensity_{};
268 std::vector<TabulatedOneDFunction> inverseGasB_{};
269 std::vector<TabulatedOneDFunction> gasMu_{};
270 std::vector<TabulatedOneDFunction> inverseGasBMu_{};
271};
272
273} // namespace Opm
274
275#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:48
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:149
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:201
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:119
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition DryGasPvt.hpp:112
void setGasFormationVolumeFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
Initialize the function for the formation volume factor of dry gas.
Definition DryGasPvt.cpp:99
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:163
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:219
Evaluation saturatedOilVaporizationFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the oil vaporization factor [m^3/m^3] of the oil phase.
Definition DryGasPvt.hpp:240
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:138
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:175
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:188
void initEnd()
Finish initializing the oil phase PVT properties.
Definition DryGasPvt.cpp:113
void initFromState(const EclipseState &eclState, const Schedule &)
Initialize the parameters for dry gas using an ECL deck.
Definition DryGasPvt.cpp:39
Evaluation saturatedWaterVaporizationFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the water vaporization factor [m^3/m^3] of the water phase.
Definition DryGasPvt.hpp:210
void setMolarMasses(unsigned, Scalar, Scalar, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition DryGasPvt.hpp:81
void setGasViscosity(unsigned regionIdx, const TabulatedOneDFunction &mug)
Initialize the viscosity of the gas phase.
Definition DryGasPvt.hpp:92
void setReferenceDensities(unsigned regionIdx, Scalar, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition DryGasPvt.hpp:70
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:229
Definition EclipseState.hpp:66
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