FluidMatrixInteractionBlackoil.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2010 SINTEF ICT, Applied Mathematics.
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 3 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 
20 #ifndef OPM_FLUIDMATRIXINTERACTIONBLACKOIL_HEADER_INCLUDED
21 #define OPM_FLUIDMATRIXINTERACTIONBLACKOIL_HEADER_INCLUDED
22 
23 #include <opm/core/utility/UniformTableLinear.hpp>
24 #include <opm/core/utility/buildUniformMonotoneTable.hpp>
25 #include <opm/parser/eclipse/Deck/Deck.hpp>
26 #include <opm/parser/eclipse/Parser/ParseMode.hpp>
27 #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
28 #include "BlackoilDefs.hpp"
29 #include <iostream>
30 #include <stdexcept>
31 
32 namespace Opm
33 {
34 
35 // Forward declaration needed by associated parameters class.
36 template <class ScalarT, class ParamsT>
38 
39 template <class ScalarT>
41 {
42 public:
43  typedef ScalarT Scalar;
44  void init(Opm::DeckConstPtr deck)
45  {
46  ParseMode parseMode;
47  EclipseState eclipseState(deck , parseMode);
48  // Extract input data.
49  const auto& tables = eclipseState.getTableManager();
50  const auto& swofTable = tables->getSwofTables().getTable<SwofTable>(0);
51  const auto& sgofTable = tables->getSgofTables().getTable<SgofTable>(0);
52 
53  const std::vector<double>& sw = swofTable.getSwColumn();
54  const std::vector<double>& krw = swofTable.getKrwColumn();
55  const std::vector<double>& krow = swofTable.getKrowColumn();
56  const std::vector<double>& pcow = swofTable.getPcowColumn();
57  const std::vector<double>& sg = sgofTable.getSgColumn();
58  const std::vector<double>& krg = sgofTable.getKrgColumn();
59  const std::vector<double>& krog = sgofTable.getKrogColumn();
60  const std::vector<double>& pcog = sgofTable.getPcogColumn();
61 
62  // Create tables for krw, krow, krg and krog.
63  int samples = 200;
64  buildUniformMonotoneTable(sw, krw, samples, krw_);
65  buildUniformMonotoneTable(sw, krow, samples, krow_);
66  buildUniformMonotoneTable(sg, krg, samples, krg_);
67  buildUniformMonotoneTable(sg, krog, samples, krog_);
68  krocw_ = krow[0]; // At connate water -> ecl. SWOF
69 
70  // Create tables for pcow and pcog.
71  buildUniformMonotoneTable(sw, pcow, samples, pcow_);
72  buildUniformMonotoneTable(sg, pcog, samples, pcog_);
73  }
74 
75 private:
76  template <class S, class P>
78 
79  Opm::utils::UniformTableLinear<Scalar> krw_;
80  Opm::utils::UniformTableLinear<Scalar> krow_;
81  Opm::utils::UniformTableLinear<Scalar> pcow_;
82  Opm::utils::UniformTableLinear<Scalar> krg_;
83  Opm::utils::UniformTableLinear<Scalar> krog_;
84  Opm::utils::UniformTableLinear<Scalar> pcog_;
85  Scalar krocw_; // = krow_(s_wc)
86 };
87 
88 
94 template <class ScalarT, class ParamsT = FluidMatrixInteractionBlackoilParams<ScalarT> >
96 {
97 public:
98  typedef ParamsT Params;
99  typedef typename Params::Scalar Scalar;
100 
111  template <class pcContainerT, class SatContainerT>
112  static void pC(pcContainerT &pc,
113  const Params &params,
114  const SatContainerT &saturations,
115  Scalar /*temperature*/)
116  {
117  Scalar sw = saturations[Aqua];
118  Scalar sg = saturations[Vapour];
119  pc[Liquid] = 0.0;
120  pc[Aqua] = params.pcow_(sw);
121  pc[Vapour] = params.pcog_(sg);
122  }
123 
135  template <class SatContainerT, class pcContainerT>
136  static void S(SatContainerT &saturations,
137  const Params &params,
138  const pcContainerT &pc,
139  Scalar /*temperature*/)
140  {
141  std::cerr << "FluidMatrixInteractionBlackoil::S() is not implemented yet\n";
142  throw std::logic_error("Not implemented");
143  }
144 
145 
149  template <class krContainerT, class SatContainerT>
150  static void kr(krContainerT &kr,
151  const Params &params,
152  const SatContainerT &saturations,
153  Scalar /*temperature*/)
154  {
155  // Stone-II relative permeability model.
156  Scalar sw = saturations[Aqua];
157  Scalar sg = saturations[Vapour];
158  Scalar krw = params.krw_(sw);
159  Scalar krg = params.krg_(sg);
160  Scalar krow = params.krow_(sw);
161  Scalar krog = params.krog_(sg);
162  Scalar krocw = params.krocw_;
163  kr[Aqua] = krw;
164  kr[Vapour] = krg;
165  kr[Liquid] = krocw*((krow/krocw + krw)*(krog/krocw + krg) - krw - krg);
166  if (kr[Liquid] < 0.0) {
167  kr[Liquid] = 0.0;
168  }
169  }
170 
171 
175  template <class krContainerT, class SatContainerT>
176  static void dkr(krContainerT &dkr,
177  const Params &params,
178  const SatContainerT &saturations,
179  Scalar /*temperature*/)
180  {
181  for (int p1 = 0; p1 < numPhases; ++p1) {
182  for (int p2 = 0; p2 < numPhases; ++p2) {
183  dkr[p1][p2] = 0.0;
184  }
185  }
186  // Stone-II relative permeability model.
187  Scalar sw = saturations[Aqua];
188  Scalar sg = saturations[Vapour];
189  Scalar krw = params.krw_(sw);
190  Scalar dkrww = params.krw_.derivative(sw);
191  Scalar krg = params.krg_(sg);
192  Scalar dkrgg = params.krg_.derivative(sg);
193  Scalar krow = params.krow_(sw);
194  Scalar dkrow = params.krow_.derivative(sw);
195  Scalar krog = params.krog_(sg);
196  Scalar dkrog = params.krog_.derivative(sg);
197  Scalar krocw = params.krocw_;
198  dkr[Aqua][Aqua] = dkrww;
199  dkr[Vapour][Vapour] = dkrgg;
200  dkr[Liquid][Aqua] = krocw*((dkrow/krocw + dkrww)*(krog/krocw + krg) - dkrww);
201  dkr[Liquid][Vapour] = krocw*((krow/krocw + krw)*(dkrog/krocw + dkrgg) - dkrgg);
202  }
203 };
204 
205 } // namespace Opm
206 
207 
208 
209 
210 #endif // OPM_FLUIDMATRIXINTERACTIONBLACKOIL_HEADER_INCLUDED
Definition: BlackoilFluid.hpp:31
Capillary pressures and relative permeabilities for a black oil system.
Definition: FluidMatrixInteractionBlackoil.hpp:37
void init(Opm::DeckConstPtr deck)
Definition: FluidMatrixInteractionBlackoil.hpp:44
Definition: BlackoilDefs.hpp:34
Definition: FluidMatrixInteractionBlackoil.hpp:40
static void pC(pcContainerT &pc, const Params &params, const SatContainerT &saturations, Scalar)
The linear capillary pressure-saturation curve.
Definition: FluidMatrixInteractionBlackoil.hpp:112
static void kr(krContainerT &kr, const Params &params, const SatContainerT &saturations, Scalar)
The relative permeability of all phases.
Definition: FluidMatrixInteractionBlackoil.hpp:150
Definition: BlackoilDefs.hpp:37
Definition: BlackoilDefs.hpp:30
static void dkr(krContainerT &dkr, const Params &params, const SatContainerT &saturations, Scalar)
The saturation derivatives of relative permeability of all phases.
Definition: FluidMatrixInteractionBlackoil.hpp:176
Definition: BlackoilDefs.hpp:37
ScalarT Scalar
Definition: FluidMatrixInteractionBlackoil.hpp:43
static void S(SatContainerT &saturations, const Params &params, const pcContainerT &pc, Scalar)
The saturation-capillary pressure curve.
Definition: FluidMatrixInteractionBlackoil.hpp:136
Params::Scalar Scalar
Definition: FluidMatrixInteractionBlackoil.hpp:99
Definition: BlackoilDefs.hpp:37
ParamsT Params
Definition: FluidMatrixInteractionBlackoil.hpp:98