3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
geomechanics/fvproblem.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 *****************************************************************************/
24#ifndef DUMUX_GEOMECHANICS_FV_PROBLEM_HH
25#define DUMUX_GEOMECHANICS_FV_PROBLEM_HH
26
29
30namespace Dumux {
31
32#ifndef DOXYGEN
33namespace Detail {
34// helper struct detecting if the user-defined problem class has an effectiveFluidDensityAtPos function
35// for g++ > 5.3, this can be replaced by a lambda
36template<class GlobalPosition>
37struct hasEffFluidDensityAtPos
38{
39 template<class Problem>
40 auto operator()(const Problem& a)
41 -> decltype(a.effectiveFluidDensityAtPos(std::declval<GlobalPosition>()))
42 {}
43};
44
45// helper struct detecting if the user-defined problem class has an effectivePorePressureAtPos function
46// for g++ > 5.3, this can be replaced by a lambda
47template<class GlobalPosition>
48struct hasEffPorePressureAtPos
49{
50 template<class Problem>
51 auto operator()(const Problem& a)
52 -> decltype(a.effectivePorePressureAtPos(std::declval<GlobalPosition>()))
53 {}
54};
55
56} // end namespace Detail
57#endif
58
59
66template<class TypeTag>
68{
70
73 using FVElementGeometry = typename GridGeometry::LocalView;
74 using SubControlVolume = typename GridGeometry::SubControlVolume;
76 using Element = typename GridView::template Codim<0>::Entity;
77 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
78
80
81public:
84
92 template< int n = numFP, std::enable_if_t<(n > 0), int> = 0 >
93 Scalar effectiveFluidDensity(const Element& element,
94 const SubControlVolume& scv) const
95 {
96 static_assert(decltype(isValid(Detail::hasEffFluidDensityAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
97 " Your problem class has to either implement\n\n"
98 " Scalar effectiveFluidDensityAtPos(const GlobalPosition& globalPos) const\n\n"
99 " or overload this function\n\n"
100 " template<class ElementSolution>\n"
101 " Scalar effectiveFluidDensity(const Element& element,\n\
102 const SubControlVolume& scv) const\n\n");
103
104 return this->asImp_().effectiveFluidDensityAtPos(scv.center());
105 }
106
120 template< class ElemVolVars, class FluxVarsCache, int n = numFP, std::enable_if_t<(n > 0), int> = 0 >
121 Scalar effectivePorePressure(const Element& element,
122 const FVElementGeometry& fvGeometry,
123 const ElemVolVars& elemVolVars,
124 const FluxVarsCache& fluxVarsCache) const
125 {
126 static_assert(decltype(isValid(Detail::hasEffPorePressureAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
127 " Your problem class has to either implement\n\n"
128 " Scalar effectivePorePressureAtPos(const GlobalPosition& globalPos) const\n\n"
129 " or overload this function\n\n"
130 " template<class ElementSolution>\n"
131 " Scalar effectivePorePressure(const Element& element,\n"
132 " const FVElementGeometry& fvGeometry,\n"
133 " const ElemVolVars& elemVolVars,\n"
134 " const FluxVarsCache& fluxVarsCache) const\n\n");
135
136 return this->asImp_().effectivePorePressureAtPos(element.geometry().center());
137 }
138};
139
140} // end namespace Dumux
141
142#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
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:50
Implementation & asImp_()
Returns the implementation of the problem (i.e. static polymorphism)
Definition: common/fvproblem.hh:591
Base class for all geomechanical problems.
Definition: geomechanics/fvproblem.hh:68
Scalar effectiveFluidDensity(const Element &element, const SubControlVolume &scv) const
Returns the effective fluid density within an scv.
Definition: geomechanics/fvproblem.hh:93
Scalar effectivePorePressure(const Element &element, const FVElementGeometry &fvGeometry, const ElemVolVars &elemVolVars, const FluxVarsCache &fluxVarsCache) const
Returns the effective pore pressure.
Definition: geomechanics/fvproblem.hh:121
Base class for all fully implicit porous media problems.
Definition: porousmediumflow/problem.hh:39
Base class for all porous media problems.