3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
deprecated.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 *****************************************************************************/
25#ifndef DUMUX_COMMON_DEPRECATED_HH
26#define DUMUX_COMMON_DEPRECATED_HH
27
28#include <type_traits>
29
30#include <dune/common/deprecated.hh>
31
33
34namespace Dumux {
35
36#ifndef DOXYGEN // hide from doxygen
37// Helper classes/functions for deprecation
38// Each implementation has to state after which release
39// it will be removed. Implementations in the Deprecated
40// namespace will be removed without
41// deprecation after their usage in the code exprired,
42// so most likely you don't want to use this in your code
43namespace Deprecated {
44
46// Remove the following after Release 3.2 //
48
50// Deprecation warnings for effective diffusion coefficients //
52constexpr auto hasEffDiffCoeffImpl = Dumux::isValid([](auto&& v) -> decltype(v.effectiveDiffusionCoefficient(0,0,0)){return 0;});
53template<class VolumeVariables> constexpr bool hasEffDiffCoeff = decltype(hasEffDiffCoeffImpl(std::declval<VolumeVariables>())){};
54
55template<class EDL, class VV,
56 typename std::enable_if_t<!hasEffDiffCoeff<VV>, int> = 0>
57[[deprecated("The volume variables class used does not have an effectiveDiffusionCoefficient(phaseIdx, compIIdx, compJIdx) function. "
58 "This will become mandatory after the 3.2 release! See e.g. the files /dumux/porousmediumflow/2p2c/volumevariables.hh "
59 "and /dumux/porousmediumflow/2p2c/properties.hh to see how this can be realized.")]]
60decltype(EDL::effectiveDiffusionCoefficient(std::declval<VV>(), int(), int(), int()))
61effectiveDiffusionCoefficient(const VV& volVars, int phaseIdx, int compIIdx, int compJIdx)
62{
63 return EDL::effectiveDiffusionCoefficient(volVars, phaseIdx, compIIdx, compJIdx);
64}
65
66template<class EDL, class VV,
67 typename std::enable_if_t<hasEffDiffCoeff<VV>, int> = 0>
68auto effectiveDiffusionCoefficient(const VV& volVars, int phaseIdx, int compIIdx, int compJIdx)
69{ return volVars.effectiveDiffusionCoefficient(phaseIdx, compIIdx, compJIdx); }
70
72 // Maxwell Stefan //
74
75template<class EDL, class FS, class VV, class P, class E, class SCV,
76 typename std::enable_if_t<hasEffDiffCoeff<VV>, int> = 0>
77auto effectiveMSDiffusionCoefficient(const VV& volVars,
78 const int phaseIdx,
79 const int compIIdx,
80 const int compJIdx,
81 const P& problem,
82 const E& element,
83 const SCV& scv)
84{ return volVars.effectiveDiffusionCoefficient(phaseIdx, compIIdx, compJIdx); }
85
86template<class EDL, class FS, class VV, class P, class E, class SCV,
87 typename std::enable_if_t<!hasEffDiffCoeff<VV>, int> = 0>
88[[deprecated("The volume variables class used does not have an effectiveDiffusionCoefficient(phaseIdx, compIIdx, compJIdx) function. "
89 "This will become mandatory after the 3.2 release! See e.g. the files /dumux/porousmediumflow/2p2c/volumevariables.hh "
90 "and /dumux/porousmediumflow/2p2c/properties.hh to see how this can be realized.")]]
91auto effectiveMSDiffusionCoefficient(const VV& volVars,
92 const int phaseIdx,
93 const int compIIdx,
94 const int compJIdx,
95 const P& problem,
96 const E& element,
97 const SCV& scv)
98{
99 auto tinInside = 0.0;
100 if constexpr (FS::isTracerFluidSystem())
101 {
102 tinInside = FS::binaryDiffusionCoefficient(compIIdx,
103 compJIdx,
104 problem,
105 element,
106 scv);
107 }
108 else
109 {
110 auto fluidState = volVars.fluidState();
111 typename FS::ParameterCache paramCache;
112 paramCache.updateAll(fluidState);
113 tinInside = FS::binaryDiffusionCoefficient(fluidState,
114 paramCache,
115 phaseIdx,
116 compIIdx,
117 compJIdx);
118 }
119
120 return EDL::effectiveDiffusivity(volVars.porosity(), volVars.saturation(phaseIdx), tinInside);
121}
122
125
126} // end namespace Deprecated
127#endif
128
129} // end namespace Dumux
130
131#endif
A helper function for class member function introspection.
Definition: adapt.hh:29
constexpr auto isValid(const Expression &t)
A function that creates a test functor to do class member introspection at compile time.
Definition: isvalid.hh:93