GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/material/fluidmatrixinteractions/porenetwork/pore/2p/singleshapelocalrules.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 20 20 100.0%
Functions: 20 20 100.0%
Branches: 33 69 47.8%

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 * \ingroup PoreNetworkModels
11 * \brief Base classes for standard pore-local pc-Sw curves.
12 */
13 #ifndef DUMUX_PNM_2P_SINGLE_SHAPE_LOCAL_RULES_HH
14 #define DUMUX_PNM_2P_SINGLE_SHAPE_LOCAL_RULES_HH
15
16 #include <dumux/common/parameters.hh>
17 #include <dumux/porenetwork/common/poreproperties.hh>
18 #include <dumux/material/fluidmatrixinteractions/2p/noregularization.hh>
19 #include <dumux/material/fluidmatrixinteractions/fluidmatrixinteraction.hh>
20
21 namespace Dumux::PoreNetwork::FluidMatrix {
22
23 /*!
24 * \ingroup Fluidmatrixinteractions
25 * \ingroup PoreNetworkModels
26 * \brief Base class for all standard pore-local pc-Sw curves.
27 */
28 template<class ScalarType,
29 class BaseLaw,
30 class Regularization = Dumux::FluidMatrix::NoRegularization>
31 class SingleShapeTwoPLocalRules : public Dumux::FluidMatrix::Adapter<SingleShapeTwoPLocalRules<ScalarType, BaseLaw, Regularization>, Dumux::FluidMatrix::PcKrSw>
32 {
33 public:
34
35 using Scalar = ScalarType;
36
37 using BasicParams = typename BaseLaw::template Params<Scalar>;
38 using RegularizationParams = typename Regularization::template Params<Scalar>;
39
40 static constexpr bool supportsMultipleGeometries()
41 { return false; }
42
43 template<class SpatialParams, class Element, class SubControlVolume, class ElemSol>
44 void updateParams(const SpatialParams& spatialParams,
45 const Element& element,
46 const SubControlVolume& scv,
47 const ElemSol& elemSol)
48 {
49 basicParams_.update(spatialParams, element, scv, elemSol);
50 regularization_.updateParams(spatialParams, element, scv, elemSol);
51 }
52
53 /*!
54 * \brief Return the number of fluid phases
55 */
56 static constexpr int numFluidPhases()
57 { return 2; }
58
59 /*!
60 * \brief Return whether this law is regularized
61 */
62 static constexpr bool isRegularized()
63 { return !std::is_same<Regularization, Dumux::FluidMatrix::NoRegularization>::value; }
64
65 /*!
66 * \brief Construct from parameter structs
67 * \note More efficient constructor but you need to ensure all parameters are initialized
68 */
69 3104368 SingleShapeTwoPLocalRules(const BasicParams& baseParams = {},
70 const RegularizationParams& regParams = {},
71 const std::string& paramGroup = "")
72
8/24
✓ Branch 1 taken 41563 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 1 times.
✗ Branch 25 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 3062797 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 1 times.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✓ Branch 36 taken 1 times.
✓ Branch 38 taken 3 times.
✗ Branch 39 not taken.
3104368 : basicParams_(baseParams)
73
74 {
75 if constexpr (isRegularized())
76
9/27
✓ Branch 1 taken 41563 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 41563 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 1 times.
✗ Branch 25 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 3062797 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 1 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 3 times.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✓ Branch 39 taken 3 times.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
3104367 regularization_.init(this, regParams, paramGroup);
77 }
78
79 /*!
80 * \brief The capillary pressure-saturation curve
81 */
82 template<bool enableRegularization = isRegularized()>
83 3072996 Scalar pc(const Scalar sw) const
84 {
85 if constexpr (enableRegularization)
86 {
87 3072996 const auto regularized = regularization_.pc(sw);
88
2/2
✓ Branch 0 taken 270471 times.
✓ Branch 1 taken 1266027 times.
3072996 if (regularized)
89 return regularized.value();
90 }
91
92 541242 return BaseLaw::pc(sw, basicParams_);
93 }
94
95 /*!
96 * \brief The partial derivative of the capillary pressure w.r.t. the saturation
97 */
98 template<bool enableRegularization = isRegularized()>
99 3200 Scalar dpc_dsw(const Scalar sw) const
100 {
101 if constexpr (enableRegularization)
102 {
103 3200 const auto regularized = regularization_.dpc_dsw(sw);
104
2/2
✓ Branch 0 taken 1568 times.
✓ Branch 1 taken 32 times.
3200 if (regularized)
105 return regularized.value();
106 }
107
108 3136 return BaseLaw::dpc_dsw(sw, basicParams_);
109 }
110
111 /*!
112 * \brief The saturation-capillary-pressure curve
113 */
114 template<bool enableRegularization = isRegularized()>
115 43163 Scalar sw(const Scalar pc) const
116 {
117 if constexpr (enableRegularization)
118 {
119 43163 const auto regularized = regularization_.sw(pc);
120
2/2
✓ Branch 0 taken 42347 times.
✓ Branch 1 taken 16 times.
43163 if (regularized)
121 return regularized.value();
122 }
123
124 43131 return BaseLaw::sw(pc, basicParams_);
125 }
126
127 /*!
128 * \brief The partial derivative of the saturation to the capillary pressure
129 */
130 template<bool enableRegularization = isRegularized()>
131 1600 Scalar dsw_dpc(const Scalar pc) const
132 {
133 if constexpr (enableRegularization)
134 {
135 1600 const auto regularized = regularization_.dsw_dpc(pc);
136
2/2
✓ Branch 0 taken 784 times.
✓ Branch 1 taken 16 times.
1600 if (regularized)
137 return regularized.value();
138 }
139
140 1568 return BaseLaw::dsw_dpc(pc, basicParams_);
141 }
142
143 /*!
144 * \brief The relative permeability for the wetting phase
145 * \note This is only for compatibility. Will not be used.
146 */
147 template<bool enableRegularization = isRegularized()>
148 Scalar krw(const Scalar sw) const
149 { return 1.0; }
150
151 /*!
152 * \brief The derivative of the relative permeability for the wetting phase w.r.t. saturation
153 * \note This is only for compatibility. Will not be used.
154 */
155 template<bool enableRegularization = isRegularized()>
156 Scalar dkrw_dsw(const Scalar sw) const
157 { return 0; }
158
159 /*!
160 * \brief The relative permeability for the non-wetting phase
161 * \note This is only for compatibility. Will not be used.
162 */
163 template<bool enableRegularization = isRegularized()>
164 Scalar krn(const Scalar sw) const
165 { return 1.0; }
166
167 /*!
168 * \brief The derivative of the relative permeability for the non-wetting phase w.r.t. saturation
169 * \note This is only for compatibility. Will not be used.
170 */
171 template<bool enableRegularization = isRegularized()>
172 Scalar dkrn_dsw(const Scalar sw) const
173 { return 0.0; }
174
175 /*!
176 * \brief Equality comparison with another instance
177 */
178 bool operator== (const SingleShapeTwoPLocalRules& o) const
179 {
180 return basicParams_ == o.basicParams_
181 && regularization_ == o.regularization_;
182 }
183
184 /*!
185 * \brief Return the base law's parameters
186 */
187 const BasicParams& basicParams() const
188
8/10
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 41562 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 3062792 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 3 times.
3104367 { return basicParams_; }
189
190
191 private:
192 BasicParams basicParams_;
193 Regularization regularization_;
194 };
195
196 } // end namespace Dumux::PoreNetwork::FluidMatrix
197
198 #endif
199