opm-common
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 
35 namespace Opm {
36 
37 class EclipseState;
38 class Schedule;
39 
44 template <class Scalar>
46 {
47 public:
49 
53  void initFromState(const EclipseState& eclState, const Schedule&);
54 
55  void setNumRegions(std::size_t numRegions);
56 
57  void setVapPars(const Scalar, const Scalar)
58  {
59  }
60 
64  void setReferenceDensities(unsigned regionIdx,
65  Scalar rhoRefOil,
66  Scalar /*rhoRefGas*/,
67  Scalar /*rhoRefWater*/)
68  {
69  oilReferenceDensity_[regionIdx] = rhoRefOil;
70  }
71 
82  void setInverseOilFormationVolumeFactor(unsigned regionIdx,
83  const TabulatedOneDFunction& invBo)
84  { inverseOilB_[regionIdx] = invBo; }
85 
91  void setOilViscosity(unsigned regionIdx, const TabulatedOneDFunction& muo)
92  { oilMu_[regionIdx] = muo; }
93 
97  void initEnd();
98 
102  unsigned numRegions() const
103  { return inverseOilBMu_.size(); }
104 
108  template <class Evaluation>
109  Evaluation internalEnergy(unsigned,
110  const Evaluation&,
111  const Evaluation&,
112  const Evaluation&) const
113  {
114  throw std::runtime_error("Requested the enthalpy of oil but the thermal "
115  "option is not enabled");
116  }
117 
118  Scalar hVap(unsigned) const
119  {
120  throw std::runtime_error("Requested the hvap of oil but the thermal "
121  "option is not enabled");
122  }
126  template <class Evaluation>
127  Evaluation viscosity(unsigned regionIdx,
128  const Evaluation& temperature,
129  const Evaluation& pressure,
130  const Evaluation& /*Rs*/) const
131  { return saturatedViscosity(regionIdx, temperature, pressure); }
132 
136  template <class Evaluation>
137  Evaluation saturatedViscosity(unsigned regionIdx,
138  const Evaluation& /*temperature*/,
139  const Evaluation& pressure) const
140  {
141  const Evaluation& invBo = inverseOilB_[regionIdx].eval(pressure, /*extrapolate=*/true);
142  const Evaluation& invMuoBo = inverseOilBMu_[regionIdx].eval(pressure, /*extrapolate=*/true);
143 
144  return invBo / invMuoBo;
145  }
146 
150  template <class Evaluation>
151  Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
152  const Evaluation& /*temperature*/,
153  const Evaluation& pressure,
154  const Evaluation& /*Rs*/) const
155  { return inverseOilB_[regionIdx].eval(pressure, /*extrapolate=*/true); }
156 
160  template <class FluidState, class LhsEval = typename FluidState::ValueType>
161  std::pair<LhsEval, LhsEval>
162  inverseFormationVolumeFactorAndViscosity(const FluidState& fluidState, unsigned regionIdx)
163  {
164  const LhsEval& p = decay<LhsEval>(fluidState.pressure(FluidState::oilPhaseIdx));
165  const auto segIdx = this->inverseOilB_[regionIdx].findSegmentIndex(p, /*extrapolate=*/ true);
166  const auto& invBo = this->inverseOilB_[regionIdx].eval(p, SegmentIndex{segIdx});
167  const auto& invMuoBo = this->inverseOilBMu_[regionIdx].eval(p, SegmentIndex{segIdx});
168  return { invBo, invBo / invMuoBo };
169  }
170 
176  template <class Evaluation>
177  Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
178  const Evaluation& /*temperature*/,
179  const Evaluation& pressure) const
180  { return inverseOilB_[regionIdx].eval(pressure, /*extrapolate=*/true); }
181 
185  template <class Evaluation>
186  Evaluation saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
187  const Evaluation& /*temperature*/,
188  const Evaluation& /*pressure*/) const
189  { return 0.0; /* this is dead oil! */ }
190 
194  template <class Evaluation>
195  Evaluation saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
196  const Evaluation& /*temperature*/,
197  const Evaluation& /*pressure*/,
198  const Evaluation& /*oilSaturation*/,
199  const Evaluation& /*maxOilSaturation*/) const
200  { return 0.0; /* this is dead oil! */ }
201 
208  template <class Evaluation>
209  Evaluation saturationPressure(unsigned /*regionIdx*/,
210  const Evaluation& /*temperature*/,
211  const Evaluation& /*Rs*/) const
212  { return 0.0; /* this is dead oil, so there isn't any meaningful saturation pressure! */ }
213 
214  template <class Evaluation>
215  Evaluation saturatedGasMassFraction(unsigned /*regionIdx*/,
216  const Evaluation& /*temperature*/,
217  const Evaluation& /*pressure*/) const
218  { return 0.0; /* this is dead oil! */ }
219 
220  template <class Evaluation>
221  Evaluation saturatedGasMoleFraction(unsigned /*regionIdx*/,
222  const Evaluation& /*temperature*/,
223  const Evaluation& /*pressure*/) const
224  { return 0.0; /* this is dead oil! */ }
225 
226  template <class Evaluation>
227  Evaluation diffusionCoefficient(const Evaluation& /*temperature*/,
228  const Evaluation& /*pressure*/,
229  unsigned /*compIdx*/) const
230  {
231  throw std::runtime_error("Not implemented: The PVT model does not provide "
232  "a diffusionCoefficient()");
233  }
234 
235  Scalar oilReferenceDensity(unsigned regionIdx) const
236  { return oilReferenceDensity_[regionIdx]; }
237 
238  const std::vector<TabulatedOneDFunction>& inverseOilB() const
239  { return inverseOilB_; }
240 
241  const std::vector<TabulatedOneDFunction>& oilMu() const
242  { return oilMu_; }
243 
244  const std::vector<TabulatedOneDFunction>& inverseOilBMu() const
245  { return inverseOilBMu_; }
246 
247 private:
248  std::vector<Scalar> oilReferenceDensity_{};
249  std::vector<TabulatedOneDFunction> inverseOilB_{};
250  std::vector<TabulatedOneDFunction> oilMu_{};
251  std::vector<TabulatedOneDFunction> inverseOilBMu_{};
252 };
253 
254 } // namespace Opm
255 
256 #endif
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the formation volume factor [-] of saturated oil.
Definition: DeadOilPvt.hpp:177
This class represents the Pressure-Volume-Temperature relations of the oil phase without dissolved ga...
Definition: DeadOilPvt.hpp:45
void setOilViscosity(unsigned regionIdx, const TabulatedOneDFunction &muo)
Initialize the viscosity of the oil phase.
Definition: DeadOilPvt.hpp:91
Definition: Schedule.hpp:100
void initEnd()
Finish initializing the oil phase PVT properties.
Definition: DeadOilPvt.cpp:88
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
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:195
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition: DeadOilPvt.hpp:102
Definition: EclipseState.hpp:66
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:109
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:137
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:209
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:162
void setReferenceDensities(unsigned regionIdx, Scalar rhoRefOil, Scalar, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition: DeadOilPvt.hpp:64
Evaluation saturatedGasDissolutionFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the gas dissolution factor [m^3/m^3] of the oil phase.
Definition: DeadOilPvt.hpp:186
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure, const Evaluation &) const
Returns the formation volume factor [-] of the fluid phase.
Definition: DeadOilPvt.hpp:151
Implements a linearly interpolated scalar function that depends on one variable.
Implements a linearly interpolated scalar function that depends on one variable.
Definition: Tabulated1DFunction.hpp:50
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:127
void initFromState(const EclipseState &eclState, const Schedule &)
Initialize the oil parameters via the data specified by the PVDO ECL keyword.
Definition: DeadOilPvt.cpp:39
Definition: Tabulated1DFunction.hpp:41
void setInverseOilFormationVolumeFactor(unsigned regionIdx, const TabulatedOneDFunction &invBo)
Initialize the function for the oil formation volume factor.
Definition: DeadOilPvt.hpp:82