Loading...
Searching...
No Matches
VanGenuchten.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_VAN_GENUCHTEN_HPP
#define OPM_VAN_GENUCHTEN_HPP
#include "VanGenuchtenParams.hpp"
#include <opm/material/common/MathToolbox.hpp>
#include <algorithm>
#include <cmath>
#include <cassert>
namespace Opm {
template <class TraitsT, class ParamsT = VanGenuchtenParams<TraitsT> >
class VanGenuchten : public TraitsT
{
public:
typedef TraitsT Traits;
typedef ParamsT Params;
typedef typename Traits::Scalar Scalar;
static const int numPhases = Traits::numPhases;
static_assert(numPhases == 2,
"The van Genuchten capillary pressure law only "
"applies to the case of two fluid phases");
static const bool implementsTwoPhaseApi = true;
static const bool implementsTwoPhaseSatApi = true;
static const bool isSaturationDependent = true;
static const bool isPressureDependent = false;
static const bool isTemperatureDependent = false;
static const bool isCompositionDependent = false;
template <class Container, class FluidState>
static void capillaryPressures(Container& values, const Params& params, const FluidState& fs)
{
typedef typename std::remove_reference<decltype(values[0])>::type Evaluation;
values[Traits::wettingPhaseIdx] = 0.0; // reference phase
values[Traits::nonWettingPhaseIdx] = pcnw<FluidState, Evaluation>(params, fs);
}
template <class Container, class FluidState>
static void saturations(Container& values, const Params& params, const FluidState& fs)
{
typedef typename std::remove_reference<decltype(values[0])>::type Evaluation;
values[Traits::wettingPhaseIdx] = Sw<FluidState, Evaluation>(params, fs);
values[Traits::nonWettingPhaseIdx] = 1 - values[Traits::wettingPhaseIdx];
}
template <class Container, class FluidState>
static void relativePermeabilities(Container& values, const Params& params, const FluidState& fs)
{
typedef typename std::remove_reference<decltype(values[0])>::type Evaluation;
values[Traits::wettingPhaseIdx] = krw<FluidState, Evaluation>(params, fs);
values[Traits::nonWettingPhaseIdx] = krn<FluidState, Evaluation>(params, fs);
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation pcnw(const Params& params, const FluidState& fs)
{
const Evaluation& Sw =
decay<Evaluation>(fs.saturation(Traits::wettingPhaseIdx));
assert(0 <= Sw && Sw <= 1);
return twoPhaseSatPcnw(params, Sw);
}
template <class Evaluation>
static Evaluation twoPhaseSatPcnw(const Params& params, const Evaluation& Sw)
{
return pow(pow(Sw, -1.0/params.vgM()) - 1, 1.0/params.vgN())/params.vgAlpha();
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation Sw(const Params& params, const FluidState& fs)
{
Evaluation pC =
decay<Evaluation>(fs.pressure(Traits::nonWettingPhaseIdx))
- decay<Evaluation>(fs.pressure(Traits::wettingPhaseIdx));
return twoPhaseSatSw(params, pC);
}
template <class Evaluation>
static Evaluation twoPhaseSatSw(const Params& params, const Evaluation& pC)
{
assert(pC >= 0);
return pow(pow(params.vgAlpha()*pC, params.vgN()) + 1, -params.vgM());
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation Sn(const Params& params, const FluidState& fs)
{ return 1 - Sw<FluidState, Evaluation>(params, fs); }
template <class Evaluation>
static Evaluation twoPhaseSatSn(const Params& params, const Evaluation& pC)
{ return 1 - twoPhaseSatSw(params, pC); }
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation krw(const Params& params, const FluidState& fs)
{
const Evaluation& Sw =
decay<Evaluation>(fs.saturation(Traits::wettingPhaseIdx));
return twoPhaseSatKrw(params, Sw);
}
template <class Evaluation>
static Evaluation twoPhaseSatKrw(const Params& params, const Evaluation& Sw)
{
assert(0.0 <= Sw && Sw <= 1.0);
Evaluation r = 1.0 - pow(1.0 - pow(Sw, 1/params.vgM()), params.vgM());
return sqrt(Sw)*r*r;
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Evaluation krn(const Params& params, const FluidState& fs)
{
const Evaluation& Sw =
1.0 - decay<Evaluation>(fs.saturation(Traits::nonWettingPhaseIdx));
return twoPhaseSatKrn(params, Sw);
}
template <class Evaluation>
static Evaluation twoPhaseSatKrn(const Params& params, Evaluation Sw)
{
assert(0 <= Sw && Sw <= 1);
return
pow(1 - Sw, 1.0/3) *
pow(1 - pow(Sw, 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...
VanGenuchtenParams.hpp
Specification of the material parameters for the van Genuchten constitutive relations.
Opm::VanGenuchten
Implementation of the van Genuchten capillary pressure - saturation relation.
Definition VanGenuchten.hpp:56
Opm::VanGenuchten< TraitsT, ParamsT >::numPhases
static const int numPhases
Definition VanGenuchten.hpp:68
Opm::VanGenuchten::Sw
static Evaluation Sw(const Params &params, const FluidState &fs)
The saturation-capillary pressure curve according to van Genuchten.
Definition VanGenuchten.hpp:212
Opm::VanGenuchten< TraitsT, ParamsT >::Params
ParamsT Params
Definition VanGenuchten.hpp:62
Opm::VanGenuchten< TraitsT, ParamsT >::isSaturationDependent
static const bool isSaturationDependent
Definition VanGenuchten.hpp:83
Opm::VanGenuchten::twoPhaseSatPcnw
static Evaluation twoPhaseSatPcnw(const Params &params, const Evaluation &Sw)
The saturation-capillary pressure curve according to van Genuchten using a material law specific API.
Definition VanGenuchten.hpp:194
Opm::VanGenuchten::pcnw
static Evaluation pcnw(const Params &params, const FluidState &fs)
The capillary pressure-saturation curve according to van Genuchten.
Definition VanGenuchten.hpp:169
Opm::VanGenuchten::saturations
static void saturations(Container &values, const Params &params, const FluidState &fs)
Calculate the saturations of the phases starting from their pressure differences.
Definition VanGenuchten.hpp:127
Opm::VanGenuchten< TraitsT, ParamsT >::implementsTwoPhaseSatApi
static const bool implementsTwoPhaseSatApi
Definition VanGenuchten.hpp:79
Opm::VanGenuchten::Sn
static Evaluation Sn(const Params &params, const FluidState &fs)
Calculate the non-wetting phase saturations depending on the phase pressures.
Definition VanGenuchten.hpp:233
Opm::VanGenuchten< TraitsT, ParamsT >::isPressureDependent
static const bool isPressureDependent
Definition VanGenuchten.hpp:87
Opm::VanGenuchten< TraitsT, ParamsT >::Scalar
Traits::Scalar Scalar
Definition VanGenuchten.hpp:65
Opm::VanGenuchten::capillaryPressures
static void capillaryPressures(Container &values, const Params &params, const FluidState &fs)
The capillary pressure-saturation curves according to van Genuchten.
Definition VanGenuchten.hpp:114
Opm::VanGenuchten< TraitsT, ParamsT >::isCompositionDependent
static const bool isCompositionDependent
Definition VanGenuchten.hpp:95
Opm::VanGenuchten::krn
static Evaluation krn(const Params &params, const FluidState &fs)
The relative permeability for the non-wetting phase of the medium according to van Genuchten.
Definition VanGenuchten.hpp:278
Opm::VanGenuchten::relativePermeabilities
static void relativePermeabilities(Container &values, const Params &params, const FluidState &fs)
The relative permeability-saturation curves according to van Genuchten.
Definition VanGenuchten.hpp:146
Opm::VanGenuchten::krw
static Evaluation krw(const Params &params, const FluidState &fs)
The relative permeability for the wetting phase of the medium according to van Genuchten's curve with...
Definition VanGenuchten.hpp:251
Opm::VanGenuchten< TraitsT, ParamsT >::isTemperatureDependent
static const bool isTemperatureDependent
Definition VanGenuchten.hpp:91
Opm::VanGenuchten< TraitsT, ParamsT >::Traits
TraitsT Traits
Definition VanGenuchten.hpp:59
Opm::VanGenuchten< TraitsT, ParamsT >::implementsTwoPhaseApi
static const bool implementsTwoPhaseApi
Definition VanGenuchten.hpp:75
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30