3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
efftoabsdefaultpolicy.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*****************************************************************************
4 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
26#ifndef DUMUX_MATERIAL_FLUIDMATRIX_TWOP_EFF_TO_ABS_DEFAULT_POLICY_HH
27#define DUMUX_MATERIAL_FLUIDMATRIX_TWOP_EFF_TO_ABS_DEFAULT_POLICY_HH
28
29#include <dune/common/float_cmp.hh>
31
32namespace Dumux::FluidMatrix {
33
46{
47public:
54 template<class Scalar>
55 struct Params
56 {
57 Params(const Scalar swr = 0.0, const Scalar snr = 0.0)
58 : swr_(swr), snr_(snr)
59 {}
60
64 Scalar swr() const
65 { return swr_; }
66
70 void setSwr(Scalar v)
71 { swr_ = v; }
72
76 Scalar snr() const
77 { return snr_; }
78
82 void setSnr(Scalar v)
83 { snr_ = v; }
84
85 bool operator== (const Params& p) const
86 {
87 return Dune::FloatCmp::eq(swr(), p.swr(), 1e-6)
88 && Dune::FloatCmp::eq(snr(), p.snr(), 1e-6);
89 }
90 private:
91 Scalar swr_;
92 Scalar snr_;
93 };
94
99 template<class Scalar>
100 static Params<Scalar> makeParams(const std::string& paramGroup)
101 {
102 Params<Scalar> params;
103 params.setSwr(getParamFromGroup<Scalar>(paramGroup, "Swr", 0.0));
104 params.setSnr(getParamFromGroup<Scalar>(paramGroup, "Snr", 0.0));
105 return params;
106 }
107
117 template<class Scalar>
118 static Scalar swToSwe(const Scalar sw, const Params<Scalar>& params)
119 {
120 return (sw - params.swr())/(1.0 - params.swr() - params.snr());
121 }
122
132 template<class Scalar>
133 static Scalar sweToSw(const Scalar swe, const Params<Scalar>& params)
134 {
135 return swe*(1.0 - params.swr() - params.snr()) + params.swr();
136 }
137
146 template<class Scalar>
147 static Scalar dswe_dsw(const Params<Scalar>& params)
148 {
149 return 1.0/(1.0 - params.swr() - params.snr());
150 }
151
160 template<class Scalar>
161 static Scalar dsw_dswe(const Params<Scalar>& params)
162 {
163 return 1.0 - params.swr() - params.snr();
164 }
165};
166
167} // end namespace Dumux::FluidMatrix
168
169#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Definition: brookscorey.hh:35
This is a policy for 2p material laws how to convert absolute to relative saturations and vice versa.
Definition: efftoabsdefaultpolicy.hh:46
static Scalar swToSwe(const Scalar sw, const Params< Scalar > &params)
Convert an absolute wetting saturation to an effective one.
Definition: efftoabsdefaultpolicy.hh:118
static Scalar sweToSw(const Scalar swe, const Params< Scalar > &params)
Convert an effective wetting saturation to an absolute one.
Definition: efftoabsdefaultpolicy.hh:133
static Scalar dswe_dsw(const Params< Scalar > &params)
Derivative of the effective saturation w.r.t. the absolute saturation.
Definition: efftoabsdefaultpolicy.hh:147
static Scalar dsw_dswe(const Params< Scalar > &params)
Derivative of the absolute saturation w.r.t. the effective saturation.
Definition: efftoabsdefaultpolicy.hh:161
static Params< Scalar > makeParams(const std::string &paramGroup)
Construct from a subgroup from the global parameter tree.
Definition: efftoabsdefaultpolicy.hh:100
The parameter type.
Definition: efftoabsdefaultpolicy.hh:56
bool operator==(const Params &p) const
Definition: efftoabsdefaultpolicy.hh:85
void setSwr(Scalar v)
Set the residual wetting saturation.
Definition: efftoabsdefaultpolicy.hh:70
void setSnr(Scalar v)
Set the residual non-wetting saturation.
Definition: efftoabsdefaultpolicy.hh:82
Scalar snr() const
Return the residual non-wetting saturation.
Definition: efftoabsdefaultpolicy.hh:76
Params(const Scalar swr=0.0, const Scalar snr=0.0)
Definition: efftoabsdefaultpolicy.hh:57
Scalar swr() const
Return the residual wetting saturation.
Definition: efftoabsdefaultpolicy.hh:64