version 3.8
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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_POROUS_MEDIUM_FLOW_FV_SPATIAL_PARAMS_MP_HH
13#define DUMUX_POROUS_MEDIUM_FLOW_FV_SPATIAL_PARAMS_MP_HH
14
15#include <dune/common/exceptions.hh>
16#include <dune/common/fmatrix.hh>
17
19#include <dumux/common/math.hh>
22
23#include "fvspatialparams.hh"
24
25namespace Dumux {
26
27#ifndef DOXYGEN
28namespace Detail {
29// helper struct detecting if the user-defined spatial params class
30// has a fluidMatrixInteractionAtPos function
31template<class GlobalPosition>
32struct hasFluidMatrixInteractionAtPos
33{
34 template<class SpatialParams>
35 auto operator()(const SpatialParams& a)
36 -> decltype(a.fluidMatrixInteractionAtPos(std::declval<GlobalPosition>()))
37 {}
38};
39} // end namespace Detail
40#endif
41
46template<class GridGeometry, class Scalar, class Implementation>
48: public FVPorousMediumFlowSpatialParams<GridGeometry, Scalar, Implementation>
49{
51 using GridView = typename GridGeometry::GridView;
52 using FVElementGeometry = typename GridGeometry::LocalView;
53 using SubControlVolume = typename GridGeometry::SubControlVolume;
54 using Element = typename GridView::template Codim<0>::Entity;
55
56 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
57
58public:
59 FVPorousMediumFlowSpatialParamsMP(std::shared_ptr<const GridGeometry> gridGeometry)
61 {}
62
70 template<class ElementSolution>
71 decltype(auto) fluidMatrixInteraction(const Element& element,
72 const SubControlVolume& scv,
73 const ElementSolution& elemSol) const
74 {
75 static_assert(decltype(isValid(Detail::hasFluidMatrixInteractionAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
76 " Your spatial params class has to either implement\n\n"
77 " auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const\n\n"
78 " or overload this function\n\n"
79 " template<class ElementSolution>\n"
80 " auto fluidMatrixInteraction(const Element& element,\n"
81 " const SubControlVolume& scv,\n"
82 " const ElementSolution& elemSol) const\n\n");
83
84 return this->asImp_().fluidMatrixInteractionAtPos(scv.center());
85 }
86
95 template<class FluidSystem, class ElementSolution>
96 int wettingPhase(const Element& element,
97 const SubControlVolume& scv,
98 const ElementSolution& elemSol) const
99 {
100 return this->asImp_().template wettingPhaseAtPos<FluidSystem>(scv.center());
101 }
102
109 template<class FluidSystem>
110 int wettingPhaseAtPos(const GlobalPosition& globalPos) const
111 {
112 DUNE_THROW(Dune::InvalidStateException,
113 "The spatial parameters do not provide "
114 "a wettingPhaseAtPos() method.");
115 }
116};
117
118} // namespace Dumux
119
120#endif
The base class for spatial parameters of porous-medium-flow problems.
Definition: porousmediumflow/fvspatialparams.hh:46
The base class for spatial parameters of multi-phase problems.
Definition: fvspatialparamsmp.hh:49
int wettingPhaseAtPos(const GlobalPosition &globalPos) const
Function for defining which phase is to be considered as the wetting phase.
Definition: fvspatialparamsmp.hh:110
FVPorousMediumFlowSpatialParamsMP(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: fvspatialparamsmp.hh:59
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:71
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:96
The base class for spatial parameters used with finite-volume schemes.
Definition: common/fvspatialparams.hh:34
Implementation & asImp_()
Returns the implementation of the spatial parameters (static polymorphism)
Definition: common/fvspatialparams.hh:135
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvspatialparams.hh:130
Basic spatial parameters to be used with finite-volume schemes.
constexpr auto isValid(const Expression &t)
A function that creates a test functor to do class member introspection at compile time.
Definition: isvalid.hh:81
A helper function for class member function introspection.
Define some often used mathematical functions.
Definition: adapt.hh:17
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Basic spatial parameters to be used with finite-volume schemes.