GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/material/fluidmatrixinteractions/2p/interfacialarea/exponentialcubic.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 9 12 75.0%
Functions: 0 6 0.0%
Branches: 4 8 50.0%

Line Branch Exec Source
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 //
7 /*!
8 * \file
9 * \ingroup Fluidmatrixinteractions
10 * \brief Specification of a function relating volume specific interfacial area to capillary pressure and saturation.
11 * This function is of third order in pc.
12 * \note It is used for calculating the interfacial area between the nonwetting and solid phase
13 * by Nuske 2014 (https://elib.uni-stuttgart.de/handle/11682/614, page 62) \cite nuske2014.
14 *
15 */
16 #ifndef DUMUX_MATERIAL_FLUIDMATRIX_TWO_P_INTERFACIAL_AREA_EXPONENTIAL_CUBIC
17 #define DUMUX_MATERIAL_FLUIDMATRIX_TWO_P_INTERFACIAL_AREA_EXPONENTIAL_CUBIC
18
19 #include <cmath>
20 #include <dune/common/exceptions.hh>
21 #include <dune/common/float_cmp.hh>
22 #include <dumux/common/parameters.hh>
23
24 namespace Dumux::FluidMatrix {
25
26 /*!
27 * \ingroup Fluidmatrixinteractions
28 * \brief Implementation of a exponential function relating
29 * specific interfacial area to wetting phase saturation and capillary pressure.
30 */
31 class InterfacialAreaExponentialCubic
32 {
33 public:
34
35 template<class Scalar>
36 struct Params
37 {
38 1 Params(Scalar a1 = 0, Scalar a2 = 0, Scalar a3 = 0)
39
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 : a1_(a1), a2_(a2), a3_(a3) {}
40
41 Scalar a1() const { return a1_; }
42
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 void setA1(Scalar a1) { a1_ = a1; }
43
44 Scalar a2() const { return a2_; }
45
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 void setA2(Scalar a2) { a2_ = a2; }
46
47 Scalar a3() const { return a3_; }
48
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 void setA3(Scalar a3) { a3_ = a3; }
49
50 bool operator== (const Params& p) const
51 {
52 return Dune::FloatCmp::eq(a1(), p.a1(), 1e-6)
53 && Dune::FloatCmp::eq(a2(), p.a2(), 1e-6)
54 && Dune::FloatCmp::eq(a3(), p.a3(), 1e-6);
55 }
56
57 private:
58 Scalar a1_, a2_, a3_;
59 };
60
61 /*!
62 * \brief Construct from a subgroup from the global parameter tree
63 * \note This will give you nice error messages if a mandatory parameter is missing
64 */
65 template<class Scalar = double>
66 static Params<Scalar> makeParams(const std::string& paramGroup)
67 {
68 const auto a1 = getParamFromGroup<Scalar>(paramGroup, "A1");
69 const auto a2 = getParamFromGroup<Scalar>(paramGroup, "A2");
70 const auto a3 = getParamFromGroup<Scalar>(paramGroup, "A3");
71 return {a1, a2, a3};
72 }
73
74 /*!
75 * \brief The interfacial area
76 *
77 * the suggested (as estimated from pore network models) interfacial area between the nonwetting and solid phase:
78 * \f$\mathrm{
79 a_{ns} = a_1 e^{a_2 * S_w } + a_3 * p_c^3 ;
80 }\f$
81 * \param swe Effective saturation of the wetting phase
82 * \param pc Capillary pressure in \f$\mathrm{[Pa]}\f$
83 * \param params parameter container for the coefficients of the surface
84 */
85 template<class Scalar>
86 static Scalar area(const Scalar swe, const Scalar pc, const Params<Scalar>& params)
87 {
88 // TODO think about awn surface for relative saturation
89 1612800 const Scalar a1 = params.a1();
90 1612800 const Scalar a2 = params.a2();
91 1612800 const Scalar a3 = params.a3();
92
93 using std::exp;
94 1612800 return a1 * exp( a2 * swe) + a3 * pc * pc * pc ;
95 }
96 };
97
98 } // namespace Dumux::FluidMatrix
99
100 #endif
101