27 #ifndef OPM_DRY_GAS_PVT_HPP 28 #define OPM_DRY_GAS_PVT_HPP 35 #include <opm/parser/eclipse/Deck/Deck.hpp> 36 #include <opm/parser/eclipse/EclipseState/EclipseState.hpp> 37 #include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp> 38 #include <opm/parser/eclipse/EclipseState/Tables/PvdgTable.hpp> 39 #include <opm/parser/eclipse/Deck/DeckKeyword.hpp> 40 #include <opm/parser/eclipse/Deck/DeckRecord.hpp> 50 template <
class Scalar>
54 typedef std::vector<std::pair<Scalar, Scalar> > SamplingPoints;
63 void initFromDeck(
const Deck& deck,
const EclipseState& eclState)
65 const auto& pvdgTables = eclState.getTableManager().getPvdgTables();
66 const auto& densityKeyword = deck.getKeyword(
"DENSITY");
68 assert(pvdgTables.size() == densityKeyword.size());
73 for (
unsigned regionIdx = 0; regionIdx <
numRegions; ++ regionIdx) {
74 Scalar rhoRefO = densityKeyword.getRecord(regionIdx).getItem(
"OIL").getSIDouble(0);
75 Scalar rhoRefG = densityKeyword.getRecord(regionIdx).getItem(
"GAS").getSIDouble(0);
76 Scalar rhoRefW = densityKeyword.getRecord(regionIdx).getItem(
"WATER").getSIDouble(0);
82 Scalar T = 273.15 + 15.56;
90 const auto& pvdgTable = pvdgTables.getTable<PvdgTable>(regionIdx);
94 std::vector<Scalar> invB(pvdgTable.numRows());
95 const auto& Bg = pvdgTable.getFormationFactorColumn();
96 for (
unsigned i = 0; i < Bg.size(); ++ i) {
100 size_t numSamples = invB.size();
101 inverseGasB_[regionIdx].setXYArrays(numSamples, pvdgTable.getPressureColumn(), invB);
102 gasMu_[regionIdx].setXYArrays(numSamples, pvdgTable.getPressureColumn(), pvdgTable.getViscosityColumn());
126 gasReferenceDensity_[regionIdx] = rhoRefGas;
144 { gasMu_[regionIdx] = mug; }
153 SamplingPoints tmp(samplePoints);
154 auto it = tmp.begin();
155 const auto& endIt = tmp.end();
156 for (; it != endIt; ++ it)
157 std::get<1>(*it) = 1.0/std::get<1>(*it);
159 inverseGasB_[regionIdx].setContainerOfTuples(tmp);
160 assert(inverseGasB_[regionIdx].monotonic());
170 for (
unsigned regionIdx = 0; regionIdx <
numRegions; ++ regionIdx) {
173 const auto& gasMu = gasMu_[regionIdx];
174 const auto& invGasB = inverseGasB_[regionIdx];
175 assert(gasMu.numSamples() == invGasB.numSamples());
177 std::vector<Scalar> pressureValues(gasMu.numSamples());
178 std::vector<Scalar> invGasBMuValues(gasMu.numSamples());
179 for (
unsigned pIdx = 0; pIdx < gasMu.numSamples(); ++pIdx) {
180 pressureValues[pIdx] = invGasB.xAt(pIdx);
181 invGasBMuValues[pIdx] = invGasB.valueAt(pIdx) * (1.0/gasMu.valueAt(pIdx));
184 inverseGasBMu_[regionIdx].setXYContainers(pressureValues, invGasBMuValues);
192 {
return gasReferenceDensity_.size(); }
197 template <
class Evaluation>
199 const Evaluation& temperature,
200 const Evaluation& pressure,
201 const Evaluation& )
const 207 template <
class Evaluation>
210 const Evaluation& pressure)
const 212 const Evaluation& invBg = inverseGasB_[regionIdx].eval(pressure,
true);
213 const Evaluation& invMugBg = inverseGasBMu_[regionIdx].eval(pressure,
true);
215 return invBg/invMugBg;
221 template <
class Evaluation>
223 const Evaluation& temperature,
224 const Evaluation& pressure,
225 const Evaluation& )
const 231 template <
class Evaluation>
234 const Evaluation& pressure)
const 235 {
return inverseGasB_[regionIdx].eval(pressure,
true); }
243 template <
class Evaluation>
246 const Evaluation& )
const 252 template <
class Evaluation>
263 template <
class Evaluation>
266 const Evaluation& )
const 270 std::vector<Scalar> gasReferenceDensity_;
271 std::vector<TabulatedOneDFunction> inverseGasB_;
272 std::vector<TabulatedOneDFunction> gasMu_;
273 std::vector<TabulatedOneDFunction> inverseGasBMu_;
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:208
void initEnd()
Finish initializing the oil phase PVT properties.
Definition: DryGasPvt.hpp:166
void setGasFormationVolumeFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
Initialize the function for the formation volume factor of dry gas.
Definition: DryGasPvt.hpp:151
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: DryGasPvt.hpp:198
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition: DryGasPvt.hpp:191
Evaluation saturatedOilVaporizationFactor(unsigned, const Evaluation &, const Evaluation &, const Evaluation &, Scalar) const
Returns the oil vaporization factor [m^3/m^3] of the oil phase.
Definition: DryGasPvt.hpp:253
void setMolarMasses(unsigned, Scalar, Scalar, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition: DryGasPvt.hpp:132
Evaluation saturatedOilVaporizationFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the oil vaporization factor [m^3/m^3] of the oil phase.
Definition: DryGasPvt.hpp:264
Definition: Air_Mesitylene.hpp:33
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:232
A central place for various physical constants occuring in some equations.
Definition: Constants.hpp:40
void setReferenceDensities(unsigned regionIdx, Scalar, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition: DryGasPvt.hpp:121
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &) const
Returns the formation volume factor [-] of the fluid phase.
Definition: DryGasPvt.hpp:222
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:244
Implements a linearly interpolated scalar function that depends on one variable.
A central place for various physical constants occuring in some equations.
This class represents the Pressure-Volume-Temperature relations of the gas phase without vaporized oi...
Definition: DryGasPvt.hpp:51
Implements a linearly interpolated scalar function that depends on one variable.
Definition: Tabulated1DFunction.hpp:47
void setGasViscosity(unsigned regionIdx, const TabulatedOneDFunction &mug)
Initialize the viscosity of the gas phase.
Definition: DryGasPvt.hpp:143