Loading...
Searching...
No Matches
ThreePhaseParkerVanGenuchten.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 2 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_THREE_PHASE_PARKER_VAN_GENUCHTEN_HPP
#define OPM_THREE_PHASE_PARKER_VAN_GENUCHTEN_HPP
#include "ThreePhaseParkerVanGenuchtenParams.hpp"
#include <opm/material/common/MathToolbox.hpp>
#include <algorithm>
namespace Opm {
template <class TraitsT,
class ParamsT = ThreePhaseParkerVanGenuchtenParams<TraitsT> >
class ThreePhaseParkerVanGenuchten
{
public:
static_assert(TraitsT::numPhases == 3,
"The number of phases considered by this capillary pressure "
"law is always three!");
typedef TraitsT Traits;
typedef ParamsT Params;
typedef typename Traits::Scalar Scalar;
static const int numPhases = 3;
static const int wettingPhaseIdx = Traits::wettingPhaseIdx;
static const int nonWettingPhaseIdx = Traits::nonWettingPhaseIdx;
static const int gasPhaseIdx = Traits::gasPhaseIdx;
static const bool implementsTwoPhaseApi = false;
static const bool implementsTwoPhaseSatApi = false;
static const bool isSaturationDependent = true;
static const bool isPressureDependent = false;
static const bool isTemperatureDependent = false;
static const bool isCompositionDependent = false;
template <class ContainerT, class FluidState>
static void capillaryPressures(ContainerT& values,
const Params& params,
const FluidState& fluidState)
{
typedef typename std::remove_reference<decltype(values[0])>::type Evaluation;
values[gasPhaseIdx] = pcgn<FluidState, Evaluation>(params, fluidState);
values[nonWettingPhaseIdx] = 0;
values[wettingPhaseIdx] = - pcnw<FluidState, Evaluation>(params, fluidState);
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation pcgn(const Params& params, const FluidState& fluidState)
{
Scalar PC_VG_REG = 0.01;
// sum of liquid saturations
const auto& St =
decay<Evaluation>(fluidState.saturation(wettingPhaseIdx))
+ decay<Evaluation>(fluidState.saturation(nonWettingPhaseIdx));
Evaluation Se = (St - params.Swrx())/(1. - params.Swrx());
// regularization
if (Se < 0.0)
Se=0.0;
if (Se > 1.0)
Se=1.0;
if (Se>PC_VG_REG && Se<1-PC_VG_REG)
{
const Evaluation& x = pow(Se,-1/params.vgM()) - 1;
return pow(x, 1.0 - params.vgM())/params.vgAlpha();
}
// value and derivative at regularization point
Scalar Se_regu;
if (Se<=PC_VG_REG)
Se_regu = PC_VG_REG;
else
Se_regu = 1-PC_VG_REG;
const Evaluation& x = std::pow(Se_regu,-1/params.vgM())-1;
const Evaluation& pc = pow(x, 1.0/params.vgN())/params.vgAlpha();
const Evaluation& pc_prime =
pow(x, 1/params.vgN()-1)
* std::pow(Se_regu,-1/params.vgM()-1)
/ (-params.vgM())
/ params.vgAlpha()
/ (1 - params.Sgr() - params.Swrx())
/ params.vgN();
// evaluate tangential
return ((Se-Se_regu)*pc_prime + pc)/params.betaGN();
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation pcnw(const Params& params, const FluidState& fluidState)
{
const Evaluation& Sw =
decay<Evaluation>(fluidState.saturation(wettingPhaseIdx));
Evaluation Se = (Sw-params.Swr())/(1.-params.Snr());
Scalar PC_VG_REG = 0.01;
// regularization
if (Se<0.0)
Se=0.0;
if (Se>1.0)
Se=1.0;
if (Se>PC_VG_REG && Se<1-PC_VG_REG) {
Evaluation x = pow(Se,-1/params.vgM()) - 1.0;
x = pow(x, 1 - params.vgM());
return x/params.vgAlpha();
}
// value and derivative at regularization point
Scalar Se_regu;
if (Se<=PC_VG_REG)
Se_regu = PC_VG_REG;
else
Se_regu = 1.0 - PC_VG_REG;
const Evaluation& x = std::pow(Se_regu,-1/params.vgM())-1;
const Evaluation& pc = pow(x, 1/params.vgN())/params.vgAlpha();
const Evaluation& pc_prime =
pow(x,1/params.vgN()-1)
* std::pow(Se_regu, -1.0/params.vgM() - 1)
/ (-params.vgM())
/ params.vgAlpha()
/ (1-params.Snr()-params.Swr())
/ params.vgN();
// evaluate tangential
return ((Se-Se_regu)*pc_prime + pc)/params.betaNW();
}
template <class ContainerT, class FluidState>
static void saturations(ContainerT& /*values*/,
const Params& /*params*/,
const FluidState& /*fluidState*/)
{ throw std::logic_error("Not implemented: inverse capillary pressures"); }
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation Sg(const Params& /*params*/, const FluidState& /*fluidState*/)
{ throw std::logic_error("Not implemented: Sg()"); }
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation Sn(const Params& /*params*/, const FluidState& /*fluidState*/)
{ throw std::logic_error("Not implemented: Sn()"); }
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation Sw(const Params& /*params*/, const FluidState& /*fluidState*/)
{ throw std::logic_error("Not implemented: Sw()"); }
template <class ContainerT, class FluidState>
static void relativePermeabilities(ContainerT& values,
const Params& params,
const FluidState& fluidState)
{
typedef typename std::remove_reference<decltype(values[0])>::type Evaluation;
values[wettingPhaseIdx] = krw<FluidState, Evaluation>(params, fluidState);
values[nonWettingPhaseIdx] = krn<FluidState, Evaluation>(params, fluidState);
values[gasPhaseIdx] = krg<FluidState, Evaluation>(params, fluidState);
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation krw(const Params& params, const FluidState& fluidState)
{
const Evaluation& Sw =
decay<Evaluation>(fluidState.saturation(wettingPhaseIdx));
// transformation to effective saturation
const Evaluation& Se = (Sw - params.Swr()) / (1-params.Swr());
// regularization
if(Se > 1.0) return 1.;
if(Se < 0.0) return 0.;
const Evaluation& r = 1. - pow(1 - pow(Se, 1/params.vgM()), params.vgM());
return sqrt(Se)*r*r;
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation krn(const Params& params, const FluidState& fluidState)
{
const Evaluation& Sn =
decay<Evaluation>(fluidState.saturation(nonWettingPhaseIdx));
const Evaluation& Sw =
decay<Evaluation>(fluidState.saturation(wettingPhaseIdx));
Evaluation Swe = min((Sw - params.Swr()) / (1 - params.Swr()), 1.);
Evaluation Ste = min((Sw + Sn - params.Swr()) / (1 - params.Swr()), 1.);
// regularization
if(Swe <= 0.0) Swe = 0.;
if(Ste <= 0.0) Ste = 0.;
if(Ste - Swe <= 0.0) return 0.;
Evaluation krn_;
krn_ = pow(1 - pow(Swe, 1/params.vgM()), params.vgM());
krn_ -= pow(1 - pow(Ste, 1/params.vgM()), params.vgM());
krn_ *= krn_;
if (params.krRegardsSnr())
{
// regard Snr in the permeability of the non-wetting
// phase, see Helmig1997
const Evaluation& resIncluded =
max(min(Sw - params.Snr() / (1-params.Swr()), 1.0), 0.0);
krn_ *= sqrt(resIncluded );
}
else
krn_ *= sqrt(Sn / (1 - params.Swr()));
return krn_;
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation krg(const Params& params, const FluidState& fluidState)
{
const Evaluation& Sg =
decay<Evaluation>(fluidState.saturation(gasPhaseIdx));
const Evaluation& Se = min(((1-Sg) - params.Sgr()) / (1 - params.Sgr()), 1.);
// regularization
if(Se > 1.0)
return 0.0;
if(Se < 0.0)
return 1.0;
Evaluation scaleFactor = 1.;
if (Sg<=0.1) {
scaleFactor = (Sg - params.Sgr())/(0.1 - params.Sgr());
if (scaleFactor < 0.)
return 0.0;
}
return scaleFactor
* pow(1 - Se, 1.0/3.)
* pow(1 - pow(Se, 1/params.vgM()), 2*params.vgM());
}
};
} // namespace Opm
#endif
MathToolbox.hpp
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
ThreePhaseParkerVanGenuchtenParams.hpp
Specification of the material params for the three-phase van Genuchten capillary pressure model.
Opm::ThreePhaseParkerVanGenuchtenParams
Specification of the material params for the three-phase van Genuchten capillary pressure model.
Definition ThreePhaseParkerVanGenuchtenParams.hpp:48
Opm::ThreePhaseParkerVanGenuchten
Implementation of three-phase capillary pressure and relative permeability relations proposed by Park...
Definition ThreePhaseParkerVanGenuchten.hpp:51
Opm::ThreePhaseParkerVanGenuchten::Sn
static Evaluation Sn(const Params &, const FluidState &)
The saturation of the non-wetting (i.e., oil) phase.
Definition ThreePhaseParkerVanGenuchten.hpp:238
Opm::ThreePhaseParkerVanGenuchten::capillaryPressures
static void capillaryPressures(ContainerT &values, const Params &params, const FluidState &fluidState)
Implements the three phase capillary pressure law proposed by Parker and van Genuchten.
Definition ThreePhaseParkerVanGenuchten.hpp:102
Opm::ThreePhaseParkerVanGenuchten::isCompositionDependent
static const bool isCompositionDependent
Specify whether the quantities defined by this material law are dependent on the phase composition.
Definition ThreePhaseParkerVanGenuchten.hpp:88
Opm::ThreePhaseParkerVanGenuchten::relativePermeabilities
static void relativePermeabilities(ContainerT &values, const Params &params, const FluidState &fluidState)
The relative permeability of all phases.
Definition ThreePhaseParkerVanGenuchten.hpp:252
Opm::ThreePhaseParkerVanGenuchten::Sg
static Evaluation Sg(const Params &, const FluidState &)
The saturation of the gas phase.
Definition ThreePhaseParkerVanGenuchten.hpp:231
Opm::ThreePhaseParkerVanGenuchten::isPressureDependent
static const bool isPressureDependent
Specify whether the quantities defined by this material law are dependent on the absolute pressure.
Definition ThreePhaseParkerVanGenuchten.hpp:80
Opm::ThreePhaseParkerVanGenuchten::Sw
static Evaluation Sw(const Params &, const FluidState &)
The saturation of the wetting (i.e., water) phase.
Definition ThreePhaseParkerVanGenuchten.hpp:245
Opm::ThreePhaseParkerVanGenuchten::implementsTwoPhaseSatApi
static const bool implementsTwoPhaseSatApi
Specify whether this material law implements the two-phase convenience API which only depends on the ...
Definition ThreePhaseParkerVanGenuchten.hpp:72
Opm::ThreePhaseParkerVanGenuchten::saturations
static void saturations(ContainerT &, const Params &, const FluidState &)
The saturation-capillary pressure curve.
Definition ThreePhaseParkerVanGenuchten.hpp:222
Opm::ThreePhaseParkerVanGenuchten::isSaturationDependent
static const bool isSaturationDependent
Specify whether the quantities defined by this material law are saturation dependent.
Definition ThreePhaseParkerVanGenuchten.hpp:76
Opm::ThreePhaseParkerVanGenuchten::pcnw
static Evaluation pcnw(const Params &params, const FluidState &fluidState)
Capillary pressure between the non-wetting liquid (i.e., oil) and the wetting liquid (i....
Definition ThreePhaseParkerVanGenuchten.hpp:176
Opm::ThreePhaseParkerVanGenuchten::krg
static Evaluation krg(const Params &params, const FluidState &fluidState)
The relative permeability for the non-wetting phase of the medium implied by van Genuchten's paramete...
Definition ThreePhaseParkerVanGenuchten.hpp:345
Opm::ThreePhaseParkerVanGenuchten::pcgn
static Evaluation pcgn(const Params &params, const FluidState &fluidState)
Capillary pressure between the gas and the non-wetting liquid (i.e., oil) phase.
Definition ThreePhaseParkerVanGenuchten.hpp:123
Opm::ThreePhaseParkerVanGenuchten::krw
static Evaluation krw(const Params &params, const FluidState &fluidState)
The relative permeability for the wetting phase of the medium implied by van Genuchten's parameteriza...
Definition ThreePhaseParkerVanGenuchten.hpp:272
Opm::ThreePhaseParkerVanGenuchten::krn
static Evaluation krn(const Params &params, const FluidState &fluidState)
The relative permeability for the non-wetting phase due to the model of Parker et al.
Definition ThreePhaseParkerVanGenuchten.hpp:300
Opm::ThreePhaseParkerVanGenuchten::isTemperatureDependent
static const bool isTemperatureDependent
Specify whether the quantities defined by this material law are temperature dependent.
Definition ThreePhaseParkerVanGenuchten.hpp:84
Opm::ThreePhaseParkerVanGenuchten::implementsTwoPhaseApi
static const bool implementsTwoPhaseApi
Specify whether this material law implements the two-phase convenience API.
Definition ThreePhaseParkerVanGenuchten.hpp:68
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30