EclMultiplexerMaterial.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_ECL_MULTIPLEXER_MATERIAL_HPP
28 #define OPM_ECL_MULTIPLEXER_MATERIAL_HPP
29 
31 #include "EclDefaultMaterial.hpp"
32 #include "EclStone1Material.hpp"
33 #include "EclStone2Material.hpp"
34 #include "EclTwoPhaseMaterial.hpp"
35 
36 #include <opm/common/Valgrind.hpp>
38 #include <opm/common/Exceptions.hpp>
39 #include <opm/common/ErrorMacros.hpp>
40 
41 #include <algorithm>
42 
43 namespace Opm {
44 
51 template <class TraitsT,
52  class GasOilMaterialLawT,
53  class OilWaterMaterialLawT,
54  class ParamsT = EclMultiplexerMaterialParams<TraitsT,
55  GasOilMaterialLawT,
56  OilWaterMaterialLawT> >
57 class EclMultiplexerMaterial : public TraitsT
58 {
59 public:
60  typedef GasOilMaterialLawT GasOilMaterialLaw;
61  typedef OilWaterMaterialLawT OilWaterMaterialLaw;
62 
67 
68  // some safety checks
69  static_assert(TraitsT::numPhases == 3,
70  "The number of phases considered by this capillary pressure "
71  "law is always three!");
72  static_assert(GasOilMaterialLaw::numPhases == 2,
73  "The number of phases considered by the gas-oil capillary "
74  "pressure law must be two!");
75  static_assert(OilWaterMaterialLaw::numPhases == 2,
76  "The number of phases considered by the oil-water capillary "
77  "pressure law must be two!");
78  static_assert(std::is_same<typename GasOilMaterialLaw::Scalar,
79  typename OilWaterMaterialLaw::Scalar>::value,
80  "The two two-phase capillary pressure laws must use the same "
81  "type of floating point values.");
82 
83  typedef TraitsT Traits;
84  typedef ParamsT Params;
85  typedef typename Traits::Scalar Scalar;
86 
87  static const int numPhases = 3;
88  static const int waterPhaseIdx = Traits::wettingPhaseIdx;
89  static const int oilPhaseIdx = Traits::nonWettingPhaseIdx;
90  static const int gasPhaseIdx = Traits::gasPhaseIdx;
91 
94  static const bool implementsTwoPhaseApi = false;
95 
98  static const bool implementsTwoPhaseSatApi = false;
99 
102  static const bool isSaturationDependent = true;
103 
106  static const bool isPressureDependent = false;
107 
110  static const bool isTemperatureDependent = false;
111 
114  static const bool isCompositionDependent = false;
115 
130  template <class ContainerT, class FluidState>
131  static void capillaryPressures(ContainerT& values,
132  const Params& params,
133  const FluidState& fluidState)
134  {
135  switch (params.approach()) {
136  case EclStone1Approach:
138  params.template getRealParams<EclStone1Approach>(),
139  fluidState);
140  break;
141 
142  case EclStone2Approach:
144  params.template getRealParams<EclStone2Approach>(),
145  fluidState);
146  break;
147 
148  case EclDefaultApproach:
150  params.template getRealParams<EclDefaultApproach>(),
151  fluidState);
152  break;
153 
154  case EclTwoPhaseApproach:
156  params.template getRealParams<EclTwoPhaseApproach>(),
157  fluidState);
158  break;
159  }
160  }
161 
162  /*
163  * Hysteresis parameters for oil-water
164  * @see EclHysteresisTwoPhaseLawParams::pcSwMdc(...)
165  * @see EclHysteresisTwoPhaseLawParams::krnSwMdc(...)
166  * \param params Parameters
167  */
168  static void oilWaterHysteresisParams(Scalar& pcSwMdc,
169  Scalar& krnSwMdc,
170  const Params& params)
171  {
172  switch (params.approach()) {
173  case EclStone1Approach:
174  Stone1Material::oilWaterHysteresisParams(pcSwMdc, krnSwMdc,
175  params.template getRealParams<EclStone1Approach>());
176  break;
177 
178  case EclStone2Approach:
179  Stone2Material::oilWaterHysteresisParams(pcSwMdc, krnSwMdc,
180  params.template getRealParams<EclStone2Approach>());
181  break;
182 
183  case EclDefaultApproach:
184  DefaultMaterial::oilWaterHysteresisParams(pcSwMdc, krnSwMdc,
185  params.template getRealParams<EclDefaultApproach>());
186  break;
187 
188  case EclTwoPhaseApproach:
189  TwoPhaseMaterial::oilWaterHysteresisParams(pcSwMdc, krnSwMdc,
190  params.template getRealParams<EclTwoPhaseApproach>());
191  break;
192  }
193  }
194 
195  /*
196  * Hysteresis parameters for oil-water
197  * @see EclHysteresisTwoPhaseLawParams::pcSwMdc(...)
198  * @see EclHysteresisTwoPhaseLawParams::krnSwMdc(...)
199  * \param params Parameters
200  */
201  static void setOilWaterHysteresisParams(const Scalar& pcSwMdc,
202  const Scalar& krnSwMdc,
203  Params& params)
204  {
205  switch (params.approach()) {
206  case EclStone1Approach:
207  Stone1Material::setOilWaterHysteresisParams(pcSwMdc, krnSwMdc,
208  params.template getRealParams<EclStone1Approach>());
209  break;
210 
211  case EclStone2Approach:
212  Stone2Material::setOilWaterHysteresisParams(pcSwMdc, krnSwMdc,
213  params.template getRealParams<EclStone2Approach>());
214  break;
215 
216  case EclDefaultApproach:
217  DefaultMaterial::setOilWaterHysteresisParams(pcSwMdc, krnSwMdc,
218  params.template getRealParams<EclDefaultApproach>());
219  break;
220 
221  case EclTwoPhaseApproach:
222  TwoPhaseMaterial::setOilWaterHysteresisParams(pcSwMdc, krnSwMdc,
223  params.template getRealParams<EclTwoPhaseApproach>());
224  break;
225  }
226  }
227 
228  /*
229  * Hysteresis parameters for gas-oil
230  * @see EclHysteresisTwoPhaseLawParams::pcSwMdc(...)
231  * @see EclHysteresisTwoPhaseLawParams::krnSwMdc(...)
232  * \param params Parameters
233  */
234  static void gasOilHysteresisParams(Scalar& pcSwMdc,
235  Scalar& krnSwMdc,
236  const Params& params)
237  {
238  switch (params.approach()) {
239  case EclStone1Approach:
240  Stone1Material::gasOilHysteresisParams(pcSwMdc, krnSwMdc,
241  params.template getRealParams<EclStone1Approach>());
242  break;
243 
244  case EclStone2Approach:
245  Stone2Material::gasOilHysteresisParams(pcSwMdc, krnSwMdc,
246  params.template getRealParams<EclStone2Approach>());
247  break;
248 
249  case EclDefaultApproach:
250  DefaultMaterial::gasOilHysteresisParams(pcSwMdc, krnSwMdc,
251  params.template getRealParams<EclDefaultApproach>());
252  break;
253 
254  case EclTwoPhaseApproach:
255  TwoPhaseMaterial::gasOilHysteresisParams(pcSwMdc, krnSwMdc,
256  params.template getRealParams<EclTwoPhaseApproach>());
257  break;
258  }
259  }
260 
261  /*
262  * Hysteresis parameters for gas-oil
263  * @see EclHysteresisTwoPhaseLawParams::pcSwMdc(...)
264  * @see EclHysteresisTwoPhaseLawParams::krnSwMdc(...)
265  * \param params Parameters
266  */
267  static void setGasOilHysteresisParams(const Scalar& pcSwMdc,
268  const Scalar& krnSwMdc,
269  Params& params)
270  {
271  switch (params.approach()) {
272  case EclStone1Approach:
273  Stone1Material::setGasOilHysteresisParams(pcSwMdc, krnSwMdc,
274  params.template getRealParams<EclStone1Approach>());
275  break;
276 
277  case EclStone2Approach:
278  Stone2Material::setGasOilHysteresisParams(pcSwMdc, krnSwMdc,
279  params.template getRealParams<EclStone2Approach>());
280  break;
281 
282  case EclDefaultApproach:
283  DefaultMaterial::setGasOilHysteresisParams(pcSwMdc, krnSwMdc,
284  params.template getRealParams<EclDefaultApproach>());
285  break;
286 
287  case EclTwoPhaseApproach:
288  TwoPhaseMaterial::setGasOilHysteresisParams(pcSwMdc, krnSwMdc,
289  params.template getRealParams<EclTwoPhaseApproach>());
290  break;
291  }
292  }
293 
303  template <class FluidState, class Evaluation = typename FluidState::Scalar>
304  static Evaluation pcgn(const Params& /* params */,
305  const FluidState& /* fs */)
306  {
307  OPM_THROW(std::logic_error, "Not implemented: pcgn()");
308  }
309 
319  template <class FluidState, class Evaluation = typename FluidState::Scalar>
320  static Evaluation pcnw(const Params& /* params */,
321  const FluidState& /* fs */)
322  {
323  OPM_THROW(std::logic_error, "Not implemented: pcnw()");
324  }
325 
329  template <class ContainerT, class FluidState>
330  static void saturations(ContainerT& /* values */,
331  const Params& /* params */,
332  const FluidState& /* fs */)
333  {
334  OPM_THROW(std::logic_error, "Not implemented: saturations()");
335  }
336 
340  template <class FluidState, class Evaluation = typename FluidState::Scalar>
341  static Evaluation Sg(const Params& /* params */,
342  const FluidState& /* fluidState */)
343  {
344  OPM_THROW(std::logic_error, "Not implemented: Sg()");
345  }
346 
350  template <class FluidState, class Evaluation = typename FluidState::Scalar>
351  static Evaluation Sn(const Params& /* params */,
352  const FluidState& /* fluidState */)
353  {
354  OPM_THROW(std::logic_error, "Not implemented: Sn()");
355  }
356 
360  template <class FluidState, class Evaluation = typename FluidState::Scalar>
361  static Evaluation Sw(const Params& /* params */,
362  const FluidState& /* fluidState */)
363  {
364  OPM_THROW(std::logic_error, "Not implemented: Sw()");
365  }
366 
382  template <class ContainerT, class FluidState>
383  static void relativePermeabilities(ContainerT& values,
384  const Params& params,
385  const FluidState& fluidState)
386  {
387  switch (params.approach()) {
388  case EclStone1Approach:
390  params.template getRealParams<EclStone1Approach>(),
391  fluidState);
392  break;
393 
394  case EclStone2Approach:
396  params.template getRealParams<EclStone2Approach>(),
397  fluidState);
398  break;
399 
400  case EclDefaultApproach:
402  params.template getRealParams<EclDefaultApproach>(),
403  fluidState);
404  break;
405 
406  case EclTwoPhaseApproach:
408  params.template getRealParams<EclTwoPhaseApproach>(),
409  fluidState);
410  break;
411  }
412  }
413 
417  template <class FluidState, class Evaluation = typename FluidState::Scalar>
418  static Evaluation krg(const Params& /* params */,
419  const FluidState& /* fluidState */)
420  {
421  OPM_THROW(std::logic_error, "Not implemented: krg()");
422  }
423 
427  template <class FluidState, class Evaluation = typename FluidState::Scalar>
428  static Evaluation krw(const Params& /* params */,
429  const FluidState& /* fluidState */)
430  {
431  OPM_THROW(std::logic_error, "Not implemented: krw()");
432  }
433 
437  template <class FluidState, class Evaluation = typename FluidState::Scalar>
438  static Evaluation krn(const Params& /* params */,
439  const FluidState& /* fluidState */)
440  {
441  OPM_THROW(std::logic_error, "Not implemented: krn()");
442  }
443 
444 
452  template <class FluidState>
453  static void updateHysteresis(Params& params, const FluidState& fluidState)
454  {
455  switch (params.approach()) {
456  case EclStone1Approach:
457  Stone1Material::updateHysteresis(params.template getRealParams<EclStone1Approach>(),
458  fluidState);
459  break;
460 
461  case EclStone2Approach:
462  Stone2Material::updateHysteresis(params.template getRealParams<EclStone2Approach>(),
463  fluidState);
464  break;
465 
466  case EclDefaultApproach:
467  DefaultMaterial::updateHysteresis(params.template getRealParams<EclDefaultApproach>(),
468  fluidState);
469  break;
470 
471  case EclTwoPhaseApproach:
472  TwoPhaseMaterial::updateHysteresis(params.template getRealParams<EclTwoPhaseApproach>(),
473  fluidState);
474  break;
475  }
476  }
477 };
478 } // namespace Opm
479 
480 #endif
static const bool isCompositionDependent
Specify whether the quantities defined by this material law are dependent on the phase composition...
Definition: EclMultiplexerMaterial.hpp:114
Implements a multiplexer class that provides ECL saturation functions for twophase simulations...
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
static Evaluation krw(const Params &, const FluidState &)
The relative permeability of the wetting phase.
Definition: EclMultiplexerMaterial.hpp:428
static void capillaryPressures(ContainerT &values, const Params &params, const FluidState &state)
Implements the default three phase capillary pressure law used by the ECLipse simulator.
Definition: EclDefaultMaterial.hpp:137
static void updateHysteresis(Params &params, const FluidState &fluidState)
Update the hysteresis parameters after a time step.
Definition: EclStone2Material.hpp:367
static Evaluation krn(const Params &, const FluidState &)
The relative permeability of the non-wetting (i.e., oil) phase.
Definition: EclMultiplexerMaterial.hpp:438
static void capillaryPressures(ContainerT &values, const Params &params, const FluidState &fluidState)
Implements the multiplexer three phase capillary pressure law used by the ECLipse simulator...
Definition: EclMultiplexerMaterial.hpp:131
static Evaluation Sw(const Params &, const FluidState &)
The saturation of the wetting (i.e., water) phase.
Definition: EclMultiplexerMaterial.hpp:361
Implements the second phase capillary pressure/relperm law suggested by Stone as used by the ECLipse ...
static const bool isTemperatureDependent
Specify whether the quantities defined by this material law are temperature dependent.
Definition: EclMultiplexerMaterial.hpp:110
static const bool implementsTwoPhaseSatApi
Specify whether this material law implements the two-phase convenience API which only depends on the ...
Definition: EclMultiplexerMaterial.hpp:98
static void capillaryPressures(ContainerT &values, const Params &params, const FluidState &fluidState)
Implements the multiplexer three phase capillary pressure law used by the ECLipse simulator...
Definition: EclTwoPhaseMaterial.hpp:126
static void relativePermeabilities(ContainerT &values, const Params &params, const FluidState &fluidState)
The relative permeability of all phases.
Definition: EclMultiplexerMaterial.hpp:383
Implements the second phase capillary pressure/relperm law suggested by Stone as used by the ECLipse ...
static void updateHysteresis(Params &params, const FluidState &fluidState)
Update the hysteresis parameters after a time step.
Definition: EclMultiplexerMaterial.hpp:453
static void relativePermeabilities(ContainerT &values, const Params &params, const FluidState &fluidState)
The relative permeability of all phases.
Definition: EclStone2Material.hpp:306
Definition: Air_Mesitylene.hpp:33
static void capillaryPressures(ContainerT &values, const Params &params, const FluidState &state)
Implements the default three phase capillary pressure law used by the ECLipse simulator.
Definition: EclStone2Material.hpp:137
static Evaluation pcnw(const Params &, const FluidState &)
Capillary pressure between the non-wetting liquid (i.e., oil) and the wetting liquid (i...
Definition: EclMultiplexerMaterial.hpp:320
static const bool implementsTwoPhaseApi
Specify whether this material law implements the two-phase convenience API.
Definition: EclMultiplexerMaterial.hpp:94
static void relativePermeabilities(ContainerT &values, const Params &params, const FluidState &fluidState)
The relative permeability of all phases.
Definition: EclStone1Material.hpp:305
static void updateHysteresis(Params &params, const FluidState &fluidState)
Update the hysteresis parameters after a time step.
Definition: EclStone1Material.hpp:387
static void capillaryPressures(ContainerT &values, const Params &params, const FluidState &state)
Implements the default three phase capillary pressure law used by the ECLipse simulator.
Definition: EclStone1Material.hpp:136
Implements the second phase capillary pressure/relperm law suggested by Stone as used by the ECLipse ...
Definition: EclStone2Material.hpp:61
Implements the second phase capillary pressure/relperm law suggested by Stone as used by the ECLipse ...
Definition: EclStone1Material.hpp:60
Implements a multiplexer class that provides all three phase capillary pressure laws used by the ECLi...
Definition: EclMultiplexerMaterial.hpp:57
Multiplexer implementation for the parameters required by the multiplexed three-phase material law...
static void relativePermeabilities(ContainerT &values, const Params &params, const FluidState &fluidState)
The relative permeability of all phases.
Definition: EclDefaultMaterial.hpp:304
static const bool isPressureDependent
Specify whether the quantities defined by this material law are dependent on the absolute pressure...
Definition: EclMultiplexerMaterial.hpp:106
static Evaluation pcgn(const Params &, const FluidState &)
Capillary pressure between the gas and the non-wetting liquid (i.e., oil) phase.
Definition: EclMultiplexerMaterial.hpp:304
static void relativePermeabilities(ContainerT &values, const Params &params, const FluidState &fluidState)
The relative permeability of all phases.
Definition: EclTwoPhaseMaterial.hpp:316
static Evaluation Sg(const Params &, const FluidState &)
The saturation of the gas phase.
Definition: EclMultiplexerMaterial.hpp:341
static void saturations(ContainerT &, const Params &, const FluidState &)
The inverse of the capillary pressure.
Definition: EclMultiplexerMaterial.hpp:330
static void updateHysteresis(Params &params, const FluidState &fluidState)
Update the hysteresis parameters after a time step.
Definition: EclTwoPhaseMaterial.hpp:391
Implements the default three phase capillary pressure law used by the ECLipse simulator.
Definition: EclDefaultMaterial.hpp:61
static Evaluation Sn(const Params &, const FluidState &)
The saturation of the non-wetting (i.e., oil) phase.
Definition: EclMultiplexerMaterial.hpp:351
Implements a multiplexer class that provides ECL saturation functions for twophase simulations...
Definition: EclTwoPhaseMaterial.hpp:57
static const bool isSaturationDependent
Specify whether the quantities defined by this material law are saturation dependent.
Definition: EclMultiplexerMaterial.hpp:102
static void updateHysteresis(Params &params, const FluidState &fluidState)
Update the hysteresis parameters after a time step.
Definition: EclDefaultMaterial.hpp:382
Implements the default three phase capillary pressure law used by the ECLipse simulator.
static Evaluation krg(const Params &, const FluidState &)
The relative permeability of the gas phase.
Definition: EclMultiplexerMaterial.hpp:418