3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
fvspatialparamsmp.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_POROUS_MEDIUM_FLOW_FV_SPATIAL_PARAMS_MP_HH
25#define DUMUX_POROUS_MEDIUM_FLOW_FV_SPATIAL_PARAMS_MP_HH
26
27#include <dune/common/exceptions.hh>
28#include <dune/common/fmatrix.hh>
29
31#include <dumux/common/math.hh>
34
35#include "fvspatialparams.hh"
36
37namespace Dumux {
38
39#ifndef DOXYGEN
40namespace Detail {
41// helper struct detecting if the user-defined spatial params class
42// has a fluidMatrixInteractionAtPos function
43template<class GlobalPosition>
44struct hasFluidMatrixInteractionAtPos
45{
46 template<class SpatialParams>
47 auto operator()(const SpatialParams& a)
48 -> decltype(a.fluidMatrixInteractionAtPos(std::declval<GlobalPosition>()))
49 {}
50};
51} // end namespace Detail
52#endif
53
58template<class GridGeometry, class Scalar, class Implementation>
60: public FVPorousMediumFlowSpatialParams<GridGeometry, Scalar, Implementation>
61{
63 using GridView = typename GridGeometry::GridView;
64 using FVElementGeometry = typename GridGeometry::LocalView;
65 using SubControlVolume = typename GridGeometry::SubControlVolume;
66 using Element = typename GridView::template Codim<0>::Entity;
67
68 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
69
70public:
71 FVPorousMediumFlowSpatialParamsMP(std::shared_ptr<const GridGeometry> gridGeometry)
73 {}
74
82 template<class ElementSolution>
83 decltype(auto) fluidMatrixInteraction(const Element& element,
84 const SubControlVolume& scv,
85 const ElementSolution& elemSol) const
86 {
87 static_assert(decltype(isValid(Detail::hasFluidMatrixInteractionAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
88 " Your spatial params class has to either implement\n\n"
89 " auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const\n\n"
90 " or overload this function\n\n"
91 " template<class ElementSolution>\n"
92 " auto fluidMatrixInteraction(const Element& element,\n"
93 " const SubControlVolume& scv,\n"
94 " const ElementSolution& elemSol) const\n\n");
95
96 return this->asImp_().fluidMatrixInteractionAtPos(scv.center());
97 }
98
107 template<class FluidSystem, class ElementSolution>
108 int wettingPhase(const Element& element,
109 const SubControlVolume& scv,
110 const ElementSolution& elemSol) const
111 {
112 return this->asImp_().template wettingPhaseAtPos<FluidSystem>(scv.center());
113 }
114
121 template<class FluidSystem>
122 int wettingPhaseAtPos(const GlobalPosition& globalPos) const
123 {
124 DUNE_THROW(Dune::InvalidStateException,
125 "The spatial parameters do not provide "
126 "a wettingPhaseAtPos() method.");
127 }
128};
129
130} // namespace Dumux
131
132#endif
A helper function for class member function introspection.
Define some often used mathematical functions.
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
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
The base class for spatial parameters used with finite-volume schemes.
Definition: common/fvspatialparams.hh:46
Implementation & asImp_()
Returns the implementation of the spatial parameters (static polymorphism)
Definition: common/fvspatialparams.hh:147
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvspatialparams.hh:142
The base class for spatial parameters of porous-medium-flow problems.
Definition: porousmediumflow/fvspatialparams.hh:59
The base class for spatial parameters of multi-phase problems.
Definition: fvspatialparamsmp.hh:61
int wettingPhaseAtPos(const GlobalPosition &globalPos) const
Function for defining which phase is to be considered as the wetting phase.
Definition: fvspatialparamsmp.hh:122
FVPorousMediumFlowSpatialParamsMP(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: fvspatialparamsmp.hh:71
decltype(auto) fluidMatrixInteraction(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Function for defining the parameters needed by constitutive relationships (kr-sw, pc-sw,...
Definition: fvspatialparamsmp.hh:83
int wettingPhase(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Function for defining which phase is to be considered as the wetting phase.
Definition: fvspatialparamsmp.hh:108
Basic spatial parameters to be used with finite-volume schemes.
Basic spatial parameters to be used with finite-volume schemes.