Loading...
Searching...
No Matches
RegularizedVanGenuchtenParams.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_REGULARIZED_VAN_GENUCHTEN_PARAMS_HPP
#define OPM_REGULARIZED_VAN_GENUCHTEN_PARAMS_HPP
#include "VanGenuchten.hpp"
#include "VanGenuchtenParams.hpp"
#include <opm/material/common/Spline.hpp>
#include <cassert>
namespace Opm {
template<class TraitsT>
class RegularizedVanGenuchtenParams : public VanGenuchtenParams<TraitsT>
{
typedef typename TraitsT::Scalar Scalar;
typedef VanGenuchtenParams<TraitsT> Parent;
typedef ::Opm::VanGenuchten<TraitsT> VanGenuchten;
public:
using Parent :: finalize;
typedef TraitsT Traits;
RegularizedVanGenuchtenParams()
: pcnwLowSw_(0.01)
, pcnwHighSw_(0.99)
{}
RegularizedVanGenuchtenParams(Scalar vgAlpha, Scalar vgN)
: Parent(vgAlpha, vgN)
, pcnwLowSw_(0.01)
, pcnwHighSw_(0.99)
{
finalize();
}
void finalize()
{
Parent::finalize();
pcnwLow_ = VanGenuchten::twoPhaseSatPcnw(*this, pcnwLowSw_);
pcnwSlopeLow_ = dPcnw_dSw_(pcnwLowSw_);
pcnwHigh_ = VanGenuchten::twoPhaseSatPcnw(*this, pcnwHighSw_);
pcnwSlopeHigh_ = 2*(0.0 - pcnwHigh_)/(1.0 - pcnwHighSw_);
Scalar mThreshold = dPcnw_dSw_(pcnwHighSw_);
pcnwHighSpline_.set(pcnwHighSw_, 1.0, // x0, x1
pcnwHigh_, 0, // y0, y1
mThreshold, pcnwSlopeHigh_); // m0, m1
}
Scalar pcnwLowSw() const
{ EnsureFinalized::check(); return pcnwLowSw_; }
Scalar pcnwLow() const
{ EnsureFinalized::check(); return pcnwLow_; }
Scalar pcnwSlopeLow() const
{ EnsureFinalized::check(); return pcnwSlopeLow_; }
void setPCLowSw(Scalar value)
{ pcnwLowSw_ = value; }
Scalar pcnwHighSw() const
{ EnsureFinalized::check(); return pcnwHighSw_; }
Scalar pcnwHigh() const
{ EnsureFinalized::check(); return pcnwHigh_; }
const Spline<Scalar>& pcnwHighSpline() const
{ EnsureFinalized::check(); return pcnwHighSpline_; }
Scalar pcnwSlopeHigh() const
{ EnsureFinalized::check(); return pcnwSlopeHigh_; }
void setPCHighSw(Scalar value)
{ pcnwHighSw_ = value; }
private:
Scalar dPcnw_dSw_(Scalar Sw) const
{
// use finite differences to calculate the derivative w.r.t. Sw of the
// unregularized curve's capillary pressure.
const Scalar eps = 1e-7;
Scalar pc1 = VanGenuchten::twoPhaseSatPcnw(*this, Sw - eps);
Scalar pc2 = VanGenuchten::twoPhaseSatPcnw(*this, Sw + eps);
return (pc2 - pc1)/(2*eps);
}
Scalar pcnwLowSw_;
Scalar pcnwHighSw_;
Scalar pcnwLow_;
Scalar pcnwHigh_;
Scalar pcnwSlopeLow_;
Scalar pcnwSlopeHigh_;
Spline<Scalar> pcnwHighSpline_;
};
} // namespace Opm
#endif
Spline.hpp
Class implementing cubic splines.
VanGenuchtenParams.hpp
Specification of the material parameters for the van Genuchten constitutive relations.
VanGenuchten.hpp
Implementation of the van Genuchten capillary pressure - saturation relation.
Opm::EnsureFinalized::finalize
OPM_HOST_DEVICE void finalize()
Mark the object as finalized.
Definition EnsureFinalized.hpp:82
Opm::RegularizedVanGenuchtenParams::pcnwHigh
Scalar pcnwHigh() const
Return the capillary pressure at the high threshold saturation of the wetting phase.
Definition RegularizedVanGenuchtenParams.hpp:131
Opm::RegularizedVanGenuchtenParams::pcnwHighSw
Scalar pcnwHighSw() const
Return the threshold saturation below which the capillary pressure is regularized.
Definition RegularizedVanGenuchtenParams.hpp:124
Opm::RegularizedVanGenuchtenParams::finalize
void finalize()
Calculate all dependent quantities once the independent quantities of the parameter object have been ...
Definition RegularizedVanGenuchtenParams.hpp:74
Opm::RegularizedVanGenuchtenParams::pcnwLow
Scalar pcnwLow() const
Return the capillary pressure at the low threshold saturation of the wetting phase.
Definition RegularizedVanGenuchtenParams.hpp:101
Opm::RegularizedVanGenuchtenParams::pcnwLowSw
Scalar pcnwLowSw() const
Return the threshold saturation below which the capillary pressure is regularized.
Definition RegularizedVanGenuchtenParams.hpp:94
Opm::RegularizedVanGenuchtenParams::setPCLowSw
void setPCLowSw(Scalar value)
Set the threshold saturation below which the capillary pressure is regularized.
Definition RegularizedVanGenuchtenParams.hpp:117
Opm::RegularizedVanGenuchtenParams::pcnwHighSpline
const Spline< Scalar > & pcnwHighSpline() const
Return the spline curve which ought to be used between the upper threshold saturation and 1.
Definition RegularizedVanGenuchtenParams.hpp:138
Opm::RegularizedVanGenuchtenParams::setPCHighSw
void setPCHighSw(Scalar value)
Set the threshold saturation below which the capillary pressure is regularized.
Definition RegularizedVanGenuchtenParams.hpp:154
Opm::RegularizedVanGenuchtenParams::pcnwSlopeLow
Scalar pcnwSlopeLow() const
Return the slope capillary pressure curve if Sw is smaller or equal to the low threshold saturation.
Definition RegularizedVanGenuchtenParams.hpp:110
Opm::RegularizedVanGenuchtenParams::pcnwSlopeHigh
Scalar pcnwSlopeHigh() const
Return the slope capillary pressure curve if Sw is larger or equal to 1.
Definition RegularizedVanGenuchtenParams.hpp:147
Opm::Spline
Class implementing cubic splines.
Definition Spline.hpp:91
Opm::VanGenuchtenParams::vgN
Scalar vgN() const
Return the shape parameter of van Genuchten's curve.
Definition VanGenuchtenParams.hpp:98
Opm::VanGenuchtenParams::vgAlpha
Scalar vgAlpha() const
Return the shape parameter of van Genuchten's curve.
Definition VanGenuchtenParams.hpp:68
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
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30