My Project
EclHysteresisTwoPhaseLaw.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_HYSTERESIS_TWO_PHASE_LAW_HPP
28 #define OPM_ECL_HYSTERESIS_TWO_PHASE_LAW_HPP
29 
31 
32 namespace Opm {
38 template <class EffectiveLawT,
39  class ParamsT = EclHysteresisTwoPhaseLawParams<EffectiveLawT> >
40 class EclHysteresisTwoPhaseLaw : public EffectiveLawT::Traits
41 {
42 public:
43  typedef EffectiveLawT EffectiveLaw;
44  typedef typename EffectiveLaw::Params EffectiveLawParams;
45 
46  typedef typename EffectiveLaw::Traits Traits;
47  typedef ParamsT Params;
48  typedef typename EffectiveLaw::Scalar Scalar;
49 
50  enum { wettingPhaseIdx = Traits::wettingPhaseIdx };
51  enum { nonWettingPhaseIdx = Traits::nonWettingPhaseIdx };
52 
54  static const int numPhases = EffectiveLaw::numPhases;
55  static_assert(numPhases == 2,
56  "The endpoint scaling applies to the nested twophase laws, not to "
57  "the threephase one!");
58 
61  static const bool implementsTwoPhaseApi = true;
62 
63  static_assert(EffectiveLaw::implementsTwoPhaseApi,
64  "The material laws put into EclEpsTwoPhaseLaw must implement the "
65  "two-phase material law API!");
66 
69  static const bool implementsTwoPhaseSatApi = true;
70 
71  static_assert(EffectiveLaw::implementsTwoPhaseSatApi,
72  "The material laws put into EclEpsTwoPhaseLaw must implement the "
73  "two-phase material law saturation API!");
74 
77  static const bool isSaturationDependent = true;
78 
81  static const bool isPressureDependent = false;
82 
85  static const bool isTemperatureDependent = false;
86 
89  static const bool isCompositionDependent = false;
90 
101  template <class Container, class FluidState>
102  static void capillaryPressures(Container& /* values */,
103  const Params& /* params */,
104  const FluidState& /* fs */)
105  {
106  throw std::invalid_argument("The capillaryPressures(fs) method is not yet implemented");
107  }
108 
119  template <class Container, class FluidState>
120  static void relativePermeabilities(Container& /* values */,
121  const Params& /* params */,
122  const FluidState& /* fs */)
123  {
124  throw std::invalid_argument("The pcnw(fs) method is not yet implemented");
125  }
126 
138  template <class FluidState, class Evaluation = typename FluidState::Scalar>
139  static Evaluation pcnw(const Params& /* params */,
140  const FluidState& /* fs */)
141  {
142  throw std::invalid_argument("The pcnw(fs) method is not yet implemented");
143  }
144 
145  template <class Evaluation>
146  static Evaluation twoPhaseSatPcnw(const Params& params, const Evaluation& Sw)
147  {
148  // TODO: capillary pressure hysteresis
149  return EffectiveLaw::twoPhaseSatPcnw(params.drainageParams(), Sw);
150 /*
151  if (!params.config().enableHysteresis() || params.config().pcHysteresisModel() < 0)
152  return EffectiveLaw::twoPhaseSatPcnw(params.drainageParams(), Sw);
153 
154  if (Sw < params.SwMdc())
155  return EffectiveLaw::twoPhaseSatPcnw(params.drainageParams(), Sw);
156 
157  const Evaluation& SwEff = Sw;
158 
159  //return EffectiveLaw::twoPhaseSatPcnw(params.imbibitionParams(), SwEff);
160  return EffectiveLaw::twoPhaseSatPcnw(params.drainageParams(), SwEff);
161 */
162  }
163 
167  template <class Container, class FluidState>
168  static void saturations(Container& /* values */,
169  const Params& /* params */,
170  const FluidState& /* fs */)
171  {
172  throw std::invalid_argument("The saturations(fs) method is not yet implemented");
173  }
174 
179  template <class FluidState, class Evaluation = typename FluidState::Scalar>
180  static Evaluation Sw(const Params& /* params */,
181  const FluidState& /* fs */)
182  {
183  throw std::invalid_argument("The Sw(fs) method is not yet implemented");
184  }
185 
186  template <class Evaluation>
187  static Evaluation twoPhaseSatSw(const Params& /* params */,
188  const Evaluation& /* pc */)
189  {
190  throw std::invalid_argument("The twoPhaseSatSw(pc) method is not yet implemented");
191  }
192 
197  template <class FluidState, class Evaluation = typename FluidState::Scalar>
198  static Evaluation Sn(const Params& /* params */,
199  const FluidState& /* fs */)
200  {
201  throw std::invalid_argument("The Sn(pc) method is not yet implemented");
202  }
203 
204  template <class Evaluation>
205  static Evaluation twoPhaseSatSn(const Params& /* params */,
206  const Evaluation& /* pc */)
207  {
208  throw std::invalid_argument("The twoPhaseSatSn(pc) method is not yet implemented");
209  }
210 
220  template <class FluidState, class Evaluation = typename FluidState::Scalar>
221  static Evaluation krw(const Params& /* params */,
222  const FluidState& /* fs */)
223  {
224  throw std::invalid_argument("The krw(fs) method is not yet implemented");
225  }
226 
227  template <class Evaluation>
228  static Evaluation twoPhaseSatKrw(const Params& params, const Evaluation& Sw)
229  {
230  // if no relperm hysteresis is enabled, use the drainage curve
231  if (!params.config().enableHysteresis() || params.config().krHysteresisModel() < 0)
232  return EffectiveLaw::twoPhaseSatKrw(params.drainageParams(), Sw);
233 
234  if (params.config().krHysteresisModel() == 0)
235  // use drainage curve for wetting phase
236  return EffectiveLaw::twoPhaseSatKrw(params.drainageParams(), Sw);
237 
238  // use imbibition curve for wetting phase
239  assert(params.config().krHysteresisModel() == 1);
240  return EffectiveLaw::twoPhaseSatKrw(params.imbibitionParams(), Sw);
241  }
242 
246  template <class FluidState, class Evaluation = typename FluidState::Scalar>
247  static Evaluation krn(const Params& /* params */,
248  const FluidState& /* fs */)
249  {
250  throw std::invalid_argument("The krn(fs) method is not yet implemented");
251  }
252 
253  template <class Evaluation>
254  static Evaluation twoPhaseSatKrn(const Params& params, const Evaluation& Sw)
255  {
256  // if no relperm hysteresis is enabled, use the drainage curve
257  if (!params.config().enableHysteresis() || params.config().krHysteresisModel() < 0)
258  return EffectiveLaw::twoPhaseSatKrn(params.drainageParams(), Sw);
259 
260  // if it is enabled, use either the drainage or the imbibition curve. if the
261  // imbibition curve is used, the saturation must be shifted.
262  if (Sw <= params.krnSwMdc())
263  return EffectiveLaw::twoPhaseSatKrn(params.drainageParams(), Sw);
264 
265  return EffectiveLaw::twoPhaseSatKrn(params.imbibitionParams(),
266  Sw + params.deltaSwImbKrn());
267  }
268 };
269 } // namespace Opm
270 
271 #endif
A default implementation of the parameters for the material law which implements the ECL relative per...
This material law implements the hysteresis model of the ECL file format.
Definition: EclHysteresisTwoPhaseLaw.hpp:41
static const bool isSaturationDependent
Specify whether the quantities defined by this material law are saturation dependent.
Definition: EclHysteresisTwoPhaseLaw.hpp:77
static Evaluation krn(const Params &, const FluidState &)
The relative permeability of the non-wetting phase.
Definition: EclHysteresisTwoPhaseLaw.hpp:247
static void capillaryPressures(Container &, const Params &, const FluidState &)
The capillary pressure-saturation curves depending on absolute saturations.
Definition: EclHysteresisTwoPhaseLaw.hpp:102
static Evaluation Sw(const Params &, const FluidState &)
Calculate wetting liquid phase saturation given that the rest of the fluid state has been initialized...
Definition: EclHysteresisTwoPhaseLaw.hpp:180
static const bool isCompositionDependent
Specify whether the quantities defined by this material law are dependent on the phase composition.
Definition: EclHysteresisTwoPhaseLaw.hpp:89
static const bool isPressureDependent
Specify whether the quantities defined by this material law are dependent on the absolute pressure.
Definition: EclHysteresisTwoPhaseLaw.hpp:81
static const bool implementsTwoPhaseApi
Specify whether this material law implements the two-phase convenience API.
Definition: EclHysteresisTwoPhaseLaw.hpp:61
static Evaluation Sn(const Params &, const FluidState &)
Calculate non-wetting liquid phase saturation given that the rest of the fluid state has been initial...
Definition: EclHysteresisTwoPhaseLaw.hpp:198
static void saturations(Container &, const Params &, const FluidState &)
The saturation-capillary pressure curves.
Definition: EclHysteresisTwoPhaseLaw.hpp:168
static Evaluation krw(const Params &, const FluidState &)
The relative permeability for the wetting phase.
Definition: EclHysteresisTwoPhaseLaw.hpp:221
static const int numPhases
The number of fluid phases.
Definition: EclHysteresisTwoPhaseLaw.hpp:54
static Evaluation pcnw(const Params &, const FluidState &)
The capillary pressure-saturation curve.
Definition: EclHysteresisTwoPhaseLaw.hpp:139
static const bool implementsTwoPhaseSatApi
Specify whether this material law implements the two-phase convenience API which only depends on the ...
Definition: EclHysteresisTwoPhaseLaw.hpp:69
static const bool isTemperatureDependent
Specify whether the quantities defined by this material law are temperature dependent.
Definition: EclHysteresisTwoPhaseLaw.hpp:85
static void relativePermeabilities(Container &, const Params &, const FluidState &)
The relative permeability-saturation curves depending on absolute saturations.
Definition: EclHysteresisTwoPhaseLaw.hpp:120