3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
pcmax.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 3 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 *****************************************************************************/
28#ifndef DUMUX_MATERIAL_FLUIDMATRIX_TWO_P_INTERFACIAL_AREA_PC_MAX
29#define DUMUX_MATERIAL_FLUIDMATRIX_TWO_P_INTERFACIAL_AREA_PC_MAX
30
31#include <cmath>
32#include <dune/common/exceptions.hh>
33#include <dune/common/float_cmp.hh>
35
36namespace Dumux::FluidMatrix {
37
44{
45public:
46
47 template<class Scalar>
48 struct Params
49 {
50 Params(Scalar pcMax = 0, Scalar a1 = 0, Scalar a2 = 0, Scalar a3 = 0)
51 : pcMax_(pcMax), a1_(a1), a2_(a2), a3_(a3) {}
52
53 Scalar pcMax() const { return pcMax_; }
54 void setPcMax(Scalar pcMax) { pcMax_ = pcMax; }
55
56 Scalar a1() const { return a1_; }
57 void setA1(Scalar a1) { a1_ = a1; }
58
59 Scalar a2() const { return a2_; }
60 void setA2(Scalar a2) { a2_ = a2; }
61
62 Scalar a3() const { return a3_; }
63 void setA3(Scalar a3) { a3_ = a3; }
64
65 bool operator== (const Params& p) const
66 {
67 return Dune::FloatCmp::eq(pcMax(), p.pcMax(), 1e-6)
68 && Dune::FloatCmp::eq(a1(), p.a1(), 1e-6)
69 && Dune::FloatCmp::eq(a2(), p.a2(), 1e-6)
70 && Dune::FloatCmp::eq(a3(), p.a3(), 1e-6);
71 }
72
73 private:
74 Scalar pcMax_, a1_, a2_, a3_;
75 };
76
81 template<class Scalar = double>
82 static Params<Scalar> makeParams(const std::string& paramGroup)
83 {
84 const auto pcMax = getParamFromGroup<Scalar>(paramGroup, "PcMax");
85 const auto a1 = getParamFromGroup<Scalar>(paramGroup, "A1");
86 const auto a2 = getParamFromGroup<Scalar>(paramGroup, "A2");
87 const auto a3 = getParamFromGroup<Scalar>(paramGroup, "A3");
88 return {pcMax, a1, a2, a3};
89 }
90
102 template<class Scalar>
103 static Scalar area(const Scalar swe, const Scalar pc, const Params<Scalar>& params)
104 {
105 const Scalar a1 = params.a1();
106 const Scalar a2 = params.a2();
107 const Scalar a3 = params.a3();
108 const Scalar pcMax = params.pcMax();
109 return a1 * (pcMax-pc) * (1.0-swe) + a2*(pcMax-pc)*(pcMax-pc) * (1.-swe) + a3 * (pcMax-pc)*(1-swe)*(1-swe);
110 }
111};
112
113} // namespace Dumux::FluidMatrix
114
115#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Definition: brookscorey.hh:35
Implementation of the polynomial of second order relating specific interfacial area to wetting phase ...
Definition: pcmax.hh:44
static Scalar area(const Scalar swe, const Scalar pc, const Params< Scalar > &params)
The interfacial area.
Definition: pcmax.hh:103
static Params< Scalar > makeParams(const std::string &paramGroup)
Construct from a subgroup from the global parameter tree.
Definition: pcmax.hh:82
Scalar a2() const
Definition: pcmax.hh:59
void setA1(Scalar a1)
Definition: pcmax.hh:57
Params(Scalar pcMax=0, Scalar a1=0, Scalar a2=0, Scalar a3=0)
Definition: pcmax.hh:50
void setA3(Scalar a3)
Definition: pcmax.hh:63
Scalar a3() const
Definition: pcmax.hh:62
bool operator==(const Params &p) const
Definition: pcmax.hh:65
Scalar a1() const
Definition: pcmax.hh:56
void setA2(Scalar a2)
Definition: pcmax.hh:60
void setPcMax(Scalar pcMax)
Definition: pcmax.hh:54
Scalar pcMax() const
Definition: pcmax.hh:53