version 3.10-dev
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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
14#ifndef DUMUX_MATERIAL_FLUIDMATRIX_TWOP_EFF_TO_ABS_DEFAULT_POLICY_HH
15#define DUMUX_MATERIAL_FLUIDMATRIX_TWOP_EFF_TO_ABS_DEFAULT_POLICY_HH
16
17#include <dune/common/float_cmp.hh>
19
20namespace Dumux::FluidMatrix {
21
34{
35public:
42 template<class Scalar>
43 struct Params
44 {
45 Params(const Scalar swr = 0.0, const Scalar snr = 0.0)
46 : swr_(swr), snr_(snr)
47 {}
48
52 Scalar swr() const
53 { return swr_; }
54
58 void setSwr(Scalar v)
59 { swr_ = v; }
60
64 Scalar snr() const
65 { return snr_; }
66
70 void setSnr(Scalar v)
71 { snr_ = v; }
72
73 bool operator== (const Params& p) const
74 {
75 return Dune::FloatCmp::eq(swr(), p.swr(), 1e-6)
76 && Dune::FloatCmp::eq(snr(), p.snr(), 1e-6);
77 }
78 private:
79 Scalar swr_;
80 Scalar snr_;
81 };
82
87 template<class Scalar>
88 static Params<Scalar> makeParams(const std::string& paramGroup)
89 {
90 Params<Scalar> params;
91 params.setSwr(getParamFromGroup<Scalar>(paramGroup, "Swr", 0.0));
92 params.setSnr(getParamFromGroup<Scalar>(paramGroup, "Snr", 0.0));
93 return params;
94 }
95
105 template<class Scalar>
106 static Scalar swToSwe(const Scalar sw, const Params<Scalar>& params)
107 {
108 return (sw - params.swr())/(1.0 - params.swr() - params.snr());
109 }
110
120 template<class Scalar>
121 static Scalar sweToSw(const Scalar swe, const Params<Scalar>& params)
122 {
123 return swe*(1.0 - params.swr() - params.snr()) + params.swr();
124 }
125
134 template<class Scalar>
135 static Scalar dswe_dsw(const Params<Scalar>& params)
136 {
137 return 1.0/(1.0 - params.swr() - params.snr());
138 }
139
148 template<class Scalar>
149 static Scalar dsw_dswe(const Params<Scalar>& params)
150 {
151 return 1.0 - params.swr() - params.snr();
152 }
153};
154
155} // end namespace Dumux::FluidMatrix
156
157#endif
This is a policy for 2p material laws how to convert absolute to relative saturations and vice versa.
Definition: efftoabsdefaultpolicy.hh:34
static Scalar swToSwe(const Scalar sw, const Params< Scalar > &params)
Convert an absolute wetting saturation to an effective one.
Definition: efftoabsdefaultpolicy.hh:106
static Scalar sweToSw(const Scalar swe, const Params< Scalar > &params)
Convert an effective wetting saturation to an absolute one.
Definition: efftoabsdefaultpolicy.hh:121
static Scalar dswe_dsw(const Params< Scalar > &params)
Derivative of the effective saturation w.r.t. the absolute saturation.
Definition: efftoabsdefaultpolicy.hh:135
static Scalar dsw_dswe(const Params< Scalar > &params)
Derivative of the absolute saturation w.r.t. the effective saturation.
Definition: efftoabsdefaultpolicy.hh:149
static Params< Scalar > makeParams(const std::string &paramGroup)
Construct from a subgroup from the global parameter tree.
Definition: efftoabsdefaultpolicy.hh:88
Definition: brookscorey.hh:23
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
The parameter type.
Definition: efftoabsdefaultpolicy.hh:44
bool operator==(const Params &p) const
Definition: efftoabsdefaultpolicy.hh:73
void setSwr(Scalar v)
Set the residual wetting saturation.
Definition: efftoabsdefaultpolicy.hh:58
void setSnr(Scalar v)
Set the residual non-wetting saturation.
Definition: efftoabsdefaultpolicy.hh:70
Scalar snr() const
Return the residual non-wetting saturation.
Definition: efftoabsdefaultpolicy.hh:64
Params(const Scalar swr=0.0, const Scalar snr=0.0)
Definition: efftoabsdefaultpolicy.hh:45
Scalar swr() const
Return the residual wetting saturation.
Definition: efftoabsdefaultpolicy.hh:52