Loading...
Searching...
No Matches
SatCurveMultiplexer.hpp
Go to the documentation of this file.
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef OPM_SAT_CURVE_MULTIPLEXER_HPP
#define OPM_SAT_CURVE_MULTIPLEXER_HPP
#include "SatCurveMultiplexerParams.hpp"
#include <stdexcept>
namespace Opm {
template <class TraitsT, class ParamsT = SatCurveMultiplexerParams<TraitsT> >
class SatCurveMultiplexer : public TraitsT
{
public:
using Traits = TraitsT;
using Params = ParamsT;
using Scalar = typename Traits::Scalar;
using LETTwoPhaseLaw = TwoPhaseLETCurves<Traits>;
using PLTwoPhaseLaw = PiecewiseLinearTwoPhaseMaterial<Traits>;
using Traits::numPhases;
static_assert(numPhases == 2,
"The Brooks-Corey capillary pressure law only applies "
"to the case of two fluid phases");
static constexpr bool implementsTwoPhaseApi = true;
static constexpr bool implementsTwoPhaseSatApi = true;
static constexpr bool isSaturationDependent = true;
static constexpr bool isPressureDependent = false;
static constexpr bool isTemperatureDependent = false;
static constexpr bool isCompositionDependent = false;
static_assert(Traits::numPhases == 2,
"The number of fluid phases must be two if you want to use "
"this material law!");
template <class Container, class FluidState>
static void capillaryPressures(Container& values, const Params& params, const FluidState& fluidState)
{
switch (params.approach()) {
case SatCurveMultiplexerApproach::LET:
LETTwoPhaseLaw::capillaryPressures(values,
params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
fluidState);
break;
case SatCurveMultiplexerApproach::PiecewiseLinear:
PLTwoPhaseLaw::capillaryPressures(values,
params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
fluidState);
break;
}
}
template <class Container, class FluidState>
static void saturations(Container& values, const Params& params, const FluidState& fluidState)
{
switch (params.approach()) {
case SatCurveMultiplexerApproach::LET:
LETTwoPhaseLaw::saturations(values,
params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
fluidState);
break;
case SatCurveMultiplexerApproach::PiecewiseLinear:
PLTwoPhaseLaw::saturations(values,
params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
fluidState);
break;
}
}
template <class Container, class FluidState>
static void relativePermeabilities(Container& values, const Params& params, const FluidState& fluidState)
{
switch (params.approach()) {
case SatCurveMultiplexerApproach::LET:
LETTwoPhaseLaw::relativePermeabilities(values,
params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
fluidState);
break;
case SatCurveMultiplexerApproach::PiecewiseLinear:
PLTwoPhaseLaw::relativePermeabilities(values,
params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
fluidState);
break;
}
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation pcnw(const Params& params, const FluidState& fluidState)
{
switch (params.approach()) {
case SatCurveMultiplexerApproach::LET:
return LETTwoPhaseLaw::pcnw(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
fluidState);
break;
case SatCurveMultiplexerApproach::PiecewiseLinear:
return PLTwoPhaseLaw::pcnw(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
fluidState);
break;
}
return 0.0;
}
template <class Evaluation>
static Evaluation twoPhaseSatPcnw(const Params& params, const Evaluation& Sw)
{
switch (params.approach()) {
case SatCurveMultiplexerApproach::LET:
return LETTwoPhaseLaw::twoPhaseSatPcnw(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
Sw);
break;
case SatCurveMultiplexerApproach::PiecewiseLinear:
return PLTwoPhaseLaw::twoPhaseSatPcnw(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
Sw);
break;
}
return 0.0;
}
template <class Evaluation>
static Evaluation twoPhaseSatPcnwInv(const Params&, const Evaluation&)
{
throw std::logic_error("SatCurveMultiplexer::twoPhaseSatPcnwInv"
" not implemented!");
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation Sw(const Params& params, const FluidState& fluidstate)
{
switch (params.approach()) {
case SatCurveMultiplexerApproach::LET:
return LETTwoPhaseLaw::Sw(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
fluidstate);
break;
case SatCurveMultiplexerApproach::PiecewiseLinear:
return PLTwoPhaseLaw::Sw(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
fluidstate);
break;
}
return 0.0;
}
template <class Evaluation>
static Evaluation twoPhaseSatSw(const Params&, const Evaluation&)
{
throw std::logic_error("SatCurveMultiplexer::twoPhaseSatSw"
" not implemented!");
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation Sn(const Params& params, const FluidState& fluidstate)
{
switch (params.approach()) {
case SatCurveMultiplexerApproach::LET:
return LETTwoPhaseLaw::Sn(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
fluidstate);
break;
case SatCurveMultiplexerApproach::PiecewiseLinear:
return PLTwoPhaseLaw::Sn(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
fluidstate);
break;
}
return 0.0;
}
template <class Evaluation>
static Evaluation twoPhaseSatSn(const Params& params, const Evaluation& pc)
{
switch (params.approach()) {
case SatCurveMultiplexerApproach::LET:
return LETTwoPhaseLaw::twoPhaseSatSn(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
pc);
break;
case SatCurveMultiplexerApproach::PiecewiseLinear:
return PLTwoPhaseLaw::twoPhaseSatSn(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
pc);
break;
}
return 0.0;
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation krw(const Params& params, const FluidState& fluidstate)
{
switch (params.approach()) {
case SatCurveMultiplexerApproach::LET:
return LETTwoPhaseLaw::krw(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
fluidstate);
break;
case SatCurveMultiplexerApproach::PiecewiseLinear:
return PLTwoPhaseLaw::krw(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
fluidstate);
break;
}
return 0.0;
}
template <class Evaluation>
static Evaluation twoPhaseSatKrw(const Params& params, const Evaluation& Sw)
{
switch (params.approach()) {
case SatCurveMultiplexerApproach::LET:
return LETTwoPhaseLaw::twoPhaseSatKrw(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
Sw);
break;
case SatCurveMultiplexerApproach::PiecewiseLinear:
return PLTwoPhaseLaw::twoPhaseSatKrw(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
Sw);
break;
}
return 0.0;
}
template <class Evaluation>
static Evaluation twoPhaseSatKrwInv(const Params& params, const Evaluation& krw)
{
switch (params.approach()) {
case SatCurveMultiplexerApproach::LET:
return LETTwoPhaseLaw::twoPhaseSatKrwInv(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
krw);
break;
case SatCurveMultiplexerApproach::PiecewiseLinear:
return PLTwoPhaseLaw::twoPhaseSatKrwInv(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
krw);
break;
}
return 0.0;
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation krn(const Params& params, const FluidState& fluidstate)
{
switch (params.approach()) {
case SatCurveMultiplexerApproach::LET:
return LETTwoPhaseLaw::krn(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
fluidstate);
break;
case SatCurveMultiplexerApproach::PiecewiseLinear:
return PLTwoPhaseLaw::krn(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
fluidstate);
break;
}
return 0.0;
}
template <class Evaluation>
static Evaluation twoPhaseSatKrn(const Params& params, const Evaluation& Sw)
{
switch (params.approach()) {
case SatCurveMultiplexerApproach::LET:
return LETTwoPhaseLaw::twoPhaseSatKrn(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
Sw);
break;
case SatCurveMultiplexerApproach::PiecewiseLinear:
return PLTwoPhaseLaw::twoPhaseSatKrn(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
Sw);
break;
}
return 0.0;
}
template <class Evaluation>
static Evaluation twoPhaseSatKrnInv(const Params& params, const Evaluation& krn)
{
switch (params.approach()) {
case SatCurveMultiplexerApproach::LET:
return LETTwoPhaseLaw::twoPhaseSatKrnInv(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
krn);
break;
case SatCurveMultiplexerApproach::PiecewiseLinear:
return PLTwoPhaseLaw::twoPhaseSatKrnInv(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
krn);
break;
}
return 0.0;
}
};
} // namespace Opm
#endif // OPM_SAT_CURVE_MULTIPLEXER_HPP
SatCurveMultiplexerParams.hpp
Specification of the material parameters for the saturation function multiplexer.
Opm::PiecewiseLinearTwoPhaseMaterial
Implementation of a tabulated, piecewise linear capillary pressure law.
Definition PiecewiseLinearTwoPhaseMaterial.hpp:53
Opm::PiecewiseLinearTwoPhaseMaterial::capillaryPressures
static OPM_HOST_DEVICE void capillaryPressures(Container &values, const Params &params, const FluidState &fs)
The capillary pressure-saturation curve.
Definition PiecewiseLinearTwoPhaseMaterial.hpp:100
Opm::PiecewiseLinearTwoPhaseMaterial::Sn
static OPM_HOST_DEVICE Evaluation Sn(const Params &params, const FluidState &fs)
Calculate the non-wetting phase saturations depending on the phase pressures.
Definition PiecewiseLinearTwoPhaseMaterial.hpp:173
Opm::PiecewiseLinearTwoPhaseMaterial::relativePermeabilities
static OPM_HOST_DEVICE void relativePermeabilities(Container &values, const Params &params, const FluidState &fs)
The relative permeabilities.
Definition PiecewiseLinearTwoPhaseMaterial.hpp:121
Opm::PiecewiseLinearTwoPhaseMaterial::twoPhaseSatPcnw
static OPM_HOST_DEVICE Evaluation twoPhaseSatPcnw(const Params &params, const Evaluation &Sw)
The saturation-capillary pressure curve.
Definition PiecewiseLinearTwoPhaseMaterial.hpp:147
Opm::PiecewiseLinearTwoPhaseMaterial::krw
static OPM_HOST_DEVICE Evaluation krw(const Params &params, const FluidState &fs)
The relative permeability for the wetting phase of the porous medium.
Definition PiecewiseLinearTwoPhaseMaterial.hpp:185
Opm::PiecewiseLinearTwoPhaseMaterial::saturations
static OPM_HOST_DEVICE void saturations(Container &, const Params &, const FluidState &)
The saturations of the fluid phases starting from their pressure differences.
Definition PiecewiseLinearTwoPhaseMaterial.hpp:114
Opm::PiecewiseLinearTwoPhaseMaterial::krn
static OPM_HOST_DEVICE Evaluation krn(const Params &params, const FluidState &fs)
The relative permeability for the non-wetting phase of the porous medium.
Definition PiecewiseLinearTwoPhaseMaterial.hpp:213
Opm::PiecewiseLinearTwoPhaseMaterial::Sw
static OPM_HOST_DEVICE Evaluation Sw(const Params &, const FluidState &)
The saturation-capillary pressure curve.
Definition PiecewiseLinearTwoPhaseMaterial.hpp:161
Opm::PiecewiseLinearTwoPhaseMaterial::pcnw
static OPM_HOST_DEVICE Evaluation pcnw(const Params &params, const FluidState &fs)
The capillary pressure-saturation curve.
Definition PiecewiseLinearTwoPhaseMaterial.hpp:134
Opm::SatCurveMultiplexer
Implements a multiplexer class that provides LET curves and piecewise linear saturation functions.
Definition SatCurveMultiplexer.hpp:44
Opm::SatCurveMultiplexer::Sw
static Evaluation Sw(const Params &params, const FluidState &fluidstate)
The saturation-capillary pressure curve.
Definition SatCurveMultiplexer.hpp:208
Opm::SatCurveMultiplexer::krn
static Evaluation krn(const Params &params, const FluidState &fluidstate)
The relative permeability for the non-wetting phase of the medium.
Definition SatCurveMultiplexer.hpp:335
Opm::SatCurveMultiplexer::krw
static Evaluation krw(const Params &params, const FluidState &fluidstate)
The relative permeability for the wetting phase of the medium.
Definition SatCurveMultiplexer.hpp:277
Opm::SatCurveMultiplexer::isPressureDependent
static constexpr bool isPressureDependent
Specify whether the quantities defined by this material law are dependent on the absolute pressure.
Definition SatCurveMultiplexer.hpp:73
Opm::SatCurveMultiplexer::saturations
static void saturations(Container &values, const Params &params, const FluidState &fluidState)
Calculate the saturations of the phases starting from their pressure differences.
Definition SatCurveMultiplexer.hpp:113
Opm::SatCurveMultiplexer::implementsTwoPhaseSatApi
static constexpr bool implementsTwoPhaseSatApi
Specify whether this material law implements the two-phase convenience API which only depends on the ...
Definition SatCurveMultiplexer.hpp:65
Opm::SatCurveMultiplexer::isTemperatureDependent
static constexpr bool isTemperatureDependent
Specify whether the quantities defined by this material law are temperature dependent.
Definition SatCurveMultiplexer.hpp:77
Opm::SatCurveMultiplexer::isCompositionDependent
static constexpr bool isCompositionDependent
Specify whether the quantities defined by this material law are dependent on the phase composition.
Definition SatCurveMultiplexer.hpp:81
Opm::SatCurveMultiplexer::capillaryPressures
static void capillaryPressures(Container &values, const Params &params, const FluidState &fluidState)
The capillary pressure-saturation curves.
Definition SatCurveMultiplexer.hpp:91
Opm::SatCurveMultiplexer::Sn
static Evaluation Sn(const Params &params, const FluidState &fluidstate)
Calculate the non-wetting phase saturations depending on the phase pressures.
Definition SatCurveMultiplexer.hpp:237
Opm::SatCurveMultiplexer::relativePermeabilities
static void relativePermeabilities(Container &values, const Params &params, const FluidState &fluidState)
The relative permeability-saturation curves.
Definition SatCurveMultiplexer.hpp:141
Opm::SatCurveMultiplexer::implementsTwoPhaseApi
static constexpr bool implementsTwoPhaseApi
Specify whether this material law implements the two-phase convenience API.
Definition SatCurveMultiplexer.hpp:61
Opm::SatCurveMultiplexer::isSaturationDependent
static constexpr bool isSaturationDependent
Specify whether the quantities defined by this material law are saturation dependent.
Definition SatCurveMultiplexer.hpp:69
Opm::SatCurveMultiplexer::pcnw
static Evaluation pcnw(const Params &params, const FluidState &fluidState)
The capillary pressure-saturation curve.
Definition SatCurveMultiplexer.hpp:162
Opm::TwoPhaseLETCurves
Implementation of the LET curve saturation functions.
Definition TwoPhaseLETCurves.hpp:50
Opm::TwoPhaseLETCurves::krn
static Evaluation krn(const Params &, const FluidState &)
The relative permeability for the non-wetting phase of the medium as implied by the LET parameterizat...
Definition TwoPhaseLETCurves.hpp:237
Opm::TwoPhaseLETCurves::pcnw
static Evaluation pcnw(const Params &, const FluidState &)
The capillary pressure-saturation curve.
Definition TwoPhaseLETCurves.hpp:130
Opm::TwoPhaseLETCurves::krw
static Evaluation krw(const Params &, const FluidState &)
The relative permeability for the wetting phase of the medium implied by the LET parameterization.
Definition TwoPhaseLETCurves.hpp:193
Opm::TwoPhaseLETCurves::saturations
static void saturations(Container &, const Params &, const FluidState &)
Calculate the saturations of the phases starting from their pressure differences.
Definition TwoPhaseLETCurves.hpp:103
Opm::TwoPhaseLETCurves::capillaryPressures
static void capillaryPressures(Container &, const Params &, const FluidState &)
The capillary pressure-saturation curves.
Definition TwoPhaseLETCurves.hpp:93
Opm::TwoPhaseLETCurves::relativePermeabilities
static void relativePermeabilities(Container &, const Params &, const FluidState &)
The relative permeability-saturation curves.
Definition TwoPhaseLETCurves.hpp:119
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30