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 Wrapper type to combine an arbitrary number of different laws | ||
11 | * for fluid-matrix interaction (e.g., pc-Sw-curves). | ||
12 | */ | ||
13 | #ifndef DUMUX_MATERIAL_FLUIDMATRIX_INTERACTIONS_FLUIDMATRIX_INTERACTION_HH | ||
14 | #define DUMUX_MATERIAL_FLUIDMATRIX_INTERACTIONS_FLUIDMATRIX_INTERACTION_HH | ||
15 | |||
16 | #include <type_traits> | ||
17 | #include <utility> | ||
18 | |||
19 | namespace Dumux { | ||
20 | |||
21 | /*! | ||
22 | * \ingroup Fluidmatrixinteractions | ||
23 | * \brief Wrapper type to combine an arbitrary number of different laws | ||
24 | * for fluid-matrix interaction (e.g., pc-Sw-curves). | ||
25 | */ | ||
26 | template<class... Laws> | ||
27 | 2514509 | struct FluidMatrixInteraction : public Laws... | |
28 | { | ||
29 | 543033763 | FluidMatrixInteraction(Laws&&... laws) : Laws(std::forward<Laws>(laws))... {} | |
30 | }; | ||
31 | |||
32 | /*! | ||
33 | * \ingroup Fluidmatrixinteractions | ||
34 | * \brief Helper function to create an FluidMatrixInteraction object containing an arbitrary number | ||
35 | * of fluid matrix interaction laws (e.g., pc-Sw curves and interfacial area laws). | ||
36 | * To be used in the spatial parameters. | ||
37 | */ | ||
38 | template<class... Laws> | ||
39 | auto makeFluidMatrixInteraction(Laws&&... laws) | ||
40 | { | ||
41 | 1623230167 | return FluidMatrixInteraction(wrap(std::forward<Laws>(laws))...); | |
42 | } | ||
43 | |||
44 | } // end namespace Dumux | ||
45 | |||
46 | namespace Dumux::FluidMatrix { | ||
47 | |||
48 | /*! | ||
49 | * \ingroup Fluidmatrixinteractions | ||
50 | * \brief Adapter to inherit from, allowing the inheriting class to be wrapped | ||
51 | * by the @ref makeFluidMatrixInteraction function. | ||
52 | */ | ||
53 | template<class A, template<class> class Wrapper> | ||
54 | struct Adapter | ||
55 | { | ||
56 | template<class T, std::enable_if_t<std::is_same_v<A, std::decay_t<T>>, int> = 0> | ||
57 | 1098827650 | friend auto wrap(T&& t) { return Wrapper(std::forward<T>(t)); } | |
58 | }; | ||
59 | |||
60 | /*! | ||
61 | * \ingroup Fluidmatrixinteractions | ||
62 | * \brief Wrapper type for laws providing pc-Sw and kr-Sw rules. | ||
63 | */ | ||
64 | template<class T> | ||
65 | 6125592 | class PcKrSw | |
66 | { | ||
67 | public: | ||
68 | using Scalar = typename std::decay_t<T>::Scalar; | ||
69 | |||
70 | using PcKrSwType = T; | ||
71 | |||
72 |
13/14✓ Branch 0 taken 123121 times.
✓ Branch 1 taken 83185879 times.
✓ Branch 2 taken 14533703 times.
✓ Branch 3 taken 7182423 times.
✓ Branch 4 taken 11495960 times.
✓ Branch 5 taken 133104 times.
✓ Branch 6 taken 632033 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 14800917 times.
✓ Branch 9 taken 1483589 times.
✓ Branch 10 taken 14800917 times.
✓ Branch 11 taken 1483589 times.
✓ Branch 13 taken 3014525 times.
✓ Branch 14 taken 30537881 times.
|
520902964 | PcKrSw(T&& impl) : impl_(std::forward<T>(impl)) {} |
73 | |||
74 |
1/12✗ Branch 0 not taken.
✓ Branch 1 taken 1531398 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
168253388 | Scalar pc(const Scalar sw) const { return impl_.pc(sw); } |
75 | 1426464 | Scalar dpc_dsw(const Scalar sw) const { return impl_.dpc_dsw(sw); } | |
76 |
4/4✓ Branch 0 taken 1445908 times.
✓ Branch 1 taken 4381177 times.
✓ Branch 2 taken 3571 times.
✓ Branch 3 taken 535091 times.
|
82367252 | Scalar endPointPc() const { return impl_.endPointPc(); } |
77 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 495883 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
|
76961902 | Scalar sw(const Scalar pc) const { return impl_.sw(pc); } |
78 | 25068204 | Scalar dsw_dpc(const Scalar pc) const { return impl_.dsw_dpc(pc); } | |
79 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 983124 times.
✓ Branch 2 taken 7174144 times.
✗ Branch 3 not taken.
|
236064360 | Scalar krw(const Scalar sw) const { return impl_.krw(sw); } |
80 | 17451680 | Scalar dkrw_dsw(const Scalar sw) const { return impl_.dkrw_dsw(sw); } | |
81 |
1/2✓ Branch 1 taken 983124 times.
✗ Branch 2 not taken.
|
166765914 | Scalar krn(const Scalar sw) const { return impl_.krn(sw); } |
82 | 873504 | Scalar dkrn_dsw(const Scalar sw) const { return impl_.dkrn_dsw(sw); } | |
83 | |||
84 | ✗ | const T& pcSwCurve() const { return impl_; } | |
85 | const T& krSwCurve() const { return impl_; } | ||
86 | |||
87 | private: | ||
88 | T impl_; | ||
89 | }; | ||
90 | |||
91 | /*! | ||
92 | * \ingroup Fluidmatrixinteractions | ||
93 | * \brief Deduction guide for the PcKrSw class. | ||
94 | * Makes sure that PcKrSw stores a copy of T if | ||
95 | * the constructor is called with a temporary object. | ||
96 | */ | ||
97 | template<typename T> | ||
98 | PcKrSw(T&&) -> PcKrSw<T>; | ||
99 | |||
100 | /*! | ||
101 | * \ingroup Fluidmatrixinteractions | ||
102 | * \brief Wrapper type for multiphase interface laws providing pc-S and kr-S rules. | ||
103 | */ | ||
104 | template<class T> | ||
105 | class MultiPhasePcKrSw | ||
106 | { | ||
107 | public: | ||
108 | using Scalar = typename std::decay_t<T>::Scalar; | ||
109 | |||
110 | 4751229 | MultiPhasePcKrSw(T&& impl) : impl_(std::forward<T>(impl)) {} | |
111 | |||
112 | template<class FS> | ||
113 |
1/2✓ Branch 2 taken 1567 times.
✗ Branch 3 not taken.
|
2571940 | auto capillaryPressures(const FS& fs, int wp) const { return impl_.capillaryPressures(fs, wp); } |
114 | template<class FS> | ||
115 | 1980040 | auto relativePermeabilities(const FS& fs, int wp) const { return impl_.relativePermeabilities(fs, wp); } | |
116 | |||
117 | const T& multiPhasePcKrS() const { return impl_; } | ||
118 | |||
119 | private: | ||
120 | T impl_; | ||
121 | }; | ||
122 | |||
123 | /*! | ||
124 | * \ingroup Fluidmatrixinteractions | ||
125 | * \brief Deduction guide for the MultiPhasePcKrSw class. | ||
126 | * Makes sure that MultiPhasePcKrSw stores a copy of T if | ||
127 | * the constructor is called with a temporary object. | ||
128 | */ | ||
129 | template<typename T> | ||
130 | MultiPhasePcKrSw(T&&) -> MultiPhasePcKrSw<T>; | ||
131 | |||
132 | /*! | ||
133 | * \ingroup Fluidmatrixinteractions | ||
134 | * \brief Wrapper type for 3p interface laws providing pc-S and kr-S rules. | ||
135 | */ | ||
136 | template<class T> | ||
137 | struct ThreePhasePcKrSw | ||
138 | { | ||
139 | using Scalar = typename std::decay_t<T>::Scalar; | ||
140 | using value_type = T; | ||
141 | |||
142 | using PcKrSwType = T; | ||
143 | |||
144 | 14316774 | ThreePhasePcKrSw(T&& impl) : impl_(std::forward<T>(impl)) {} | |
145 | |||
146 | 9523433 | Scalar pcgw(const Scalar sw, const Scalar sn) const { return impl_.pcgw(sw, sn); } | |
147 | 9496913 | Scalar pcnw(const Scalar sw, const Scalar sn) const { return impl_.pcnw(sw, sn); } | |
148 | 9496913 | Scalar pcgn(const Scalar sw, const Scalar sn) const { return impl_.pcgn(sw, sn); } | |
149 |
4/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 4609618 times.
✓ Branch 3 taken 4887295 times.
✓ Branch 4 taken 370 times.
✓ Branch 5 taken 3854578 times.
|
18993826 | Scalar pcAlpha(const Scalar sw, const Scalar sn) const { return impl_.pcAlpha(sw, sn); } |
150 | |||
151 | Scalar krw(const Scalar sw, const Scalar sn) const { return impl_.krw(sw, sn); } | ||
152 | Scalar krn(const Scalar sw, const Scalar sn) const { return impl_.krn(sw, sn); } | ||
153 | Scalar krg(const Scalar sw, const Scalar sn) const { return impl_.krn(sw, sn); } | ||
154 | 28490733 | Scalar kr(const int phaseIdx, const Scalar sw, const Scalar sn) const { return impl_.kr(phaseIdx, sw, sn); } | |
155 | |||
156 | const T& pcSwCurve() const { return impl_; } | ||
157 | const T& krSwCurve() const { return impl_; } | ||
158 | private: | ||
159 | T impl_; | ||
160 | }; | ||
161 | |||
162 | /*! | ||
163 | * \ingroup Fluidmatrixinteractions | ||
164 | * \brief Deduction guide for the ThreePhasePcKrSw class. | ||
165 | * Makes sure that ThreePhasePcKrSw stores a copy of T if | ||
166 | * the constructor is called with a temporary object. | ||
167 | */ | ||
168 | template<typename T> | ||
169 | ThreePhasePcKrSw(T&&) -> ThreePhasePcKrSw<T>; | ||
170 | |||
171 | /*! | ||
172 | * \ingroup Fluidmatrixinteractions | ||
173 | * \brief Wrapper type for laws providing rules for the wetting-nonwetting interfacial area. | ||
174 | */ | ||
175 | template<class T> | ||
176 | class WettingNonwettingInterfacialAreaPcSw | ||
177 | { | ||
178 | public: | ||
179 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 394268 times.
|
3148823 | WettingNonwettingInterfacialAreaPcSw(T&& impl) : impl_(std::forward<T>(impl)) {} |
180 | ✗ | const T& wettingNonwettingInterface() const { return impl_; } | |
181 | private: | ||
182 | T impl_; | ||
183 | }; | ||
184 | |||
185 | /*! | ||
186 | * \ingroup Fluidmatrixinteractions | ||
187 | * \brief Deduction guide for the WettingNonwettingInterfacialAreaPcSw class. | ||
188 | * Makes sure that WettingNonwettingInterfacialAreaPcSw stores a copy of T if | ||
189 | * the constructor is called with a temporary object. | ||
190 | */ | ||
191 | template<typename T> | ||
192 | WettingNonwettingInterfacialAreaPcSw(T&&) -> WettingNonwettingInterfacialAreaPcSw<T>; | ||
193 | |||
194 | /*! | ||
195 | * \ingroup Fluidmatrixinteractions | ||
196 | * \brief Wrapper type for laws providing rules for the wetting-solid interfacial area. | ||
197 | */ | ||
198 | template<class T> | ||
199 | class WettingSolidInterfacialAreaPcSw | ||
200 | { | ||
201 | public: | ||
202 | 2360287 | WettingSolidInterfacialAreaPcSw(T&& impl) : impl_(std::forward<T>(impl)) {} | |
203 | ✗ | const T& wettingSolidInterface() const { return impl_; } | |
204 | private: | ||
205 | T impl_; | ||
206 | }; | ||
207 | |||
208 | /*! | ||
209 | * \ingroup Fluidmatrixinteractions | ||
210 | * \brief Deduction guide for the WettingSolidInterfacialAreaPcSw class. | ||
211 | * Makes sure that WettingSolidInterfacialAreaPcSw stores a copy of T if | ||
212 | * the constructor is called with a temporary object. | ||
213 | */ | ||
214 | template<typename T> | ||
215 | WettingSolidInterfacialAreaPcSw(T&&) -> WettingSolidInterfacialAreaPcSw<T>; | ||
216 | |||
217 | /*! | ||
218 | * \ingroup Fluidmatrixinteractions | ||
219 | * \brief Wrapper type for laws providing rules for the nonwetting-solid interfacial area. | ||
220 | */ | ||
221 | template<class T> | ||
222 | class NonwettingSolidInterfacialAreaPcSw | ||
223 | { | ||
224 | public: | ||
225 | 2360287 | NonwettingSolidInterfacialAreaPcSw(T&& impl) : impl_(std::forward<T>(impl)) {} | |
226 | ✗ | const T& nonwettingSolidInterface() const { return impl_; } | |
227 | private: | ||
228 | T impl_; | ||
229 | }; | ||
230 | |||
231 | /*! | ||
232 | * \ingroup Fluidmatrixinteractions | ||
233 | * \brief Deduction guide for the NonwettingSolidInterfacialAreaPcSw class. | ||
234 | * Makes sure that NonwettingSolidInterfacialAreaPcSw stores a copy of T if | ||
235 | * the constructor is called with a temporary object. | ||
236 | */ | ||
237 | template<typename T> | ||
238 | NonwettingSolidInterfacialAreaPcSw(T&&) -> NonwettingSolidInterfacialAreaPcSw<T>; | ||
239 | |||
240 | |||
241 | /*! | ||
242 | * \ingroup Fluidmatrixinteractions | ||
243 | * \brief Wrapper type for adsorption laws. | ||
244 | */ | ||
245 | template<class T> | ||
246 | class Adsorption | ||
247 | { | ||
248 | public: | ||
249 | using value_type = T; | ||
250 | |||
251 | 1179193 | Adsorption(T&& impl) : impl_(std::forward<T>(impl)) {} | |
252 | ✗ | const T& adsorptionModel() const { return impl_; } | |
253 | private: | ||
254 | T impl_; | ||
255 | }; | ||
256 | |||
257 | /*! | ||
258 | * \ingroup Fluidmatrixinteractions | ||
259 | * \brief Deduction guide for the Adsorption class. | ||
260 | * Makes sure that Adsorption stores a copy of T if | ||
261 | * the constructor is called with a temporary object. | ||
262 | */ | ||
263 | template<typename T> | ||
264 | Adsorption(T&&) -> Adsorption<T>; | ||
265 | |||
266 | } // end namespace Dumux::FluidMatrix | ||
267 | |||
268 | #endif | ||
269 |