Loading...
Searching...
No Matches
NullMaterial.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_NULL_MATERIAL_HPP
#define OPM_NULL_MATERIAL_HPP
#include "NullMaterialParams.hpp"
#include <opm/material/common/MathToolbox.hpp>
#include <algorithm>
namespace Opm
{
template <class TraitsT>
class NullMaterial : public TraitsT
{
public:
typedef TraitsT Traits;
typedef NullMaterialParams<TraitsT> Params;
typedef typename Traits::Scalar Scalar;
static const unsigned numPhases = Traits::numPhases;
static const bool implementsTwoPhaseApi = (numPhases == 2);
static const bool implementsTwoPhaseSatApi = (numPhases == 2);
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*/)
{
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
values[phaseIdx] = 0.0;
}
template <class ContainerT, class FluidState>
static void saturations(ContainerT& /*values*/,
const Params& /*params*/,
const FluidState& /*fluidState*/)
{ throw std::logic_error("Not defined: NullMaterial::saturations()"); }
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;
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
const Evaluation& S =
decay<Evaluation>(fluidState.saturation(phaseIdx));
values[phaseIdx] = max(min(S, 1.0), 0.0);
}
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static typename std::enable_if<(numPhases > 1), Evaluation>::type
pcnw(const Params& /*params*/, const FluidState& /*fluidState*/)
{ return 0; }
template <class Evaluation>
static typename std::enable_if<numPhases == 2, Evaluation>::type
twoPhaseSatPcnw(const Params& /*params*/, const Evaluation& /*Sw*/)
{ return 0; }
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Scalar Sw(const Params& /*params*/, const FluidState& /*fluidState*/)
{ throw std::logic_error("Not defined: Sw()"); }
template <class Evaluation>
static typename std::enable_if<numPhases == 2, Evaluation>::type
twoPhaseSatSw(const Params& /*params*/, const Evaluation& /*pcnw*/)
{ throw std::logic_error("Not defined: twoPhaseSatSw()"); }
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static Scalar Sn(const Params& /*params*/, const FluidState& /*fluidState*/)
{ throw std::logic_error("Not defined: Sn()"); }
template <class Evaluation>
static typename std::enable_if<numPhases == 2, Evaluation>::type
twoPhaseSatSn(const Params& /*params*/, const Evaluation& /*pcnw*/)
{ throw std::logic_error("Not defined: twoPhaseSatSn()"); }
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static typename std::enable_if< (numPhases > 2), Evaluation>::type
Sg(const Params& /*params*/, const FluidState& /*fluidState*/)
{ throw std::logic_error("Not defined: Sg()"); }
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static typename std::enable_if<(numPhases > 1), Evaluation>::type
krw(const Params& /*params*/, const FluidState& fluidState)
{
const Evaluation& sw =
decay<Evaluation>(fluidState.saturation(Traits::wettingPhaseIdx));
return max(0.0, min(1.0, sw));
}
template <class Evaluation>
static typename std::enable_if<numPhases == 2, Evaluation>::type
twoPhaseSatKrw(const Params& /*params*/, const Evaluation& Sw)
{ return max(0.0, min(1.0, Sw)); }
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static typename std::enable_if<(numPhases > 1), Evaluation>::type
krn(const Params& /*params*/, const FluidState& fluidState)
{
const Evaluation& sn =
decay<Evaluation>(fluidState.saturation(Traits::nonWettingPhaseIdx));
return max(0.0, min(1.0, sn));
}
template <class Evaluation>
static typename std::enable_if<numPhases == 2, Evaluation>::type
twoPhaseSatKrn(const Params& /*params*/, const Evaluation& Sw)
{
return max(0.0, min(1.0, 1.0 - decay<Evaluation>(Sw)));
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static typename std::enable_if< (numPhases > 2), Evaluation>::type
krg(const Params& /*params*/, const FluidState& fluidState)
{
const Evaluation& sg =
decay<Evaluation>(fluidState.saturation(Traits::gasPhaseIdx));
return max(0.0, min(1.0, sg));
}
template <class FluidState, class Evaluation = typename FluidState::Scalar>
static typename std::enable_if< (Traits::numPhases > 2), Evaluation>::type
pcgn(const Params& /*params*/, const FluidState& /*fluidState*/)
{ return 0.0; }
};
} // namespace Opm
#endif
MathToolbox.hpp
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
NullMaterialParams.hpp
Reference implementation of params for the linear M-phase material material.
Opm::NullMaterialParams
Reference implementation of params for the linear M-phase material material.
Definition NullMaterialParams.hpp:37
Opm::NullMaterial
Implements a dummy linear saturation-capillary pressure relation which just disables capillary pressu...
Definition NullMaterial.hpp:46
Opm::NullMaterial::isTemperatureDependent
static const bool isTemperatureDependent
Specify whether the quantities defined by this material law are temperature dependent.
Definition NullMaterial.hpp:76
Opm::NullMaterial::pcnw
static std::enable_if<(numPhases >1), Evaluation >::type pcnw(const Params &, const FluidState &)
The difference between the pressures of the non-wetting and wetting phase.
Definition NullMaterial.hpp:129
Opm::NullMaterial::Sn
static Scalar Sn(const Params &, const FluidState &)
Calculate non-wetting phase saturation given that the rest of the fluid state has been initialized.
Definition NullMaterial.hpp:155
Opm::NullMaterial::Sw
static Scalar Sw(const Params &, const FluidState &)
Calculate wetting phase saturation given that the rest of the fluid state has been initialized.
Definition NullMaterial.hpp:142
Opm::NullMaterial::krn
static std::enable_if<(numPhases >1), Evaluation >::type krn(const Params &, const FluidState &fluidState)
The relative permability of the liquid non-wetting phase.
Definition NullMaterial.hpp:197
Opm::NullMaterial::numPhases
static const unsigned numPhases
The number of fluid phases.
Definition NullMaterial.hpp:53
Opm::NullMaterial::implementsTwoPhaseSatApi
static const bool implementsTwoPhaseSatApi
Specify whether this material law implements the two-phase convenience API which only depends on the ...
Definition NullMaterial.hpp:61
Opm::NullMaterial::isSaturationDependent
static const bool isSaturationDependent
Specify whether the quantities defined by this material law are saturation dependent.
Definition NullMaterial.hpp:68
Opm::NullMaterial::saturations
static void saturations(ContainerT &, const Params &, const FluidState &)
The inverse of the capillary pressure.
Definition NullMaterial.hpp:102
Opm::NullMaterial::capillaryPressures
static void capillaryPressures(ContainerT &values, const Params &, const FluidState &)
Returns constant 0 for all phases.
Definition NullMaterial.hpp:90
Opm::NullMaterial::pcgn
static std::enable_if<(Traits::numPhases >2), Evaluation >::type pcgn(const Params &, const FluidState &)
The difference between the pressures of the gas and the non-wetting phase.
Definition NullMaterial.hpp:234
Opm::NullMaterial::implementsTwoPhaseApi
static const bool implementsTwoPhaseApi
Specify whether this material law implements the two-phase convenience API.
Definition NullMaterial.hpp:57
Opm::NullMaterial::relativePermeabilities
static void relativePermeabilities(ContainerT &values, const Params &, const FluidState &fluidState)
The relative permeability of all phases.
Definition NullMaterial.hpp:111
Opm::NullMaterial::isCompositionDependent
static const bool isCompositionDependent
Specify whether the quantities defined by this material law are dependent on the phase composition.
Definition NullMaterial.hpp:80
Opm::NullMaterial::isPressureDependent
static const bool isPressureDependent
Specify whether the quantities defined by this material law are dependent on the absolute pressure.
Definition NullMaterial.hpp:72
Opm::NullMaterial::Sg
static std::enable_if<(numPhases >2), Evaluation >::type Sg(const Params &, const FluidState &)
Calculate gas phase saturation given that the rest of the fluid state has been initialized.
Definition NullMaterial.hpp:171
Opm::NullMaterial::krg
static std::enable_if<(numPhases >2), Evaluation >::type krg(const Params &, const FluidState &fluidState)
The relative permability of the gas phase.
Definition NullMaterial.hpp:219
Opm::NullMaterial::krw
static std::enable_if<(numPhases >1), Evaluation >::type krw(const Params &, const FluidState &fluidState)
The relative permability of the wetting phase.
Definition NullMaterial.hpp:179
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30