13#ifndef DUMUX_POROUS_MEDIUM_FV_SPATIAL_PARAMS_HH
14#define DUMUX_POROUS_MEDIUM_FV_SPATIAL_PARAMS_HH
23template<
class GlobalPosition,
class Sol
idSystem>
24struct hasInertVolumeFractionAtPos
26 template<
class SpatialParams>
27 auto operator()(
const SpatialParams& a)
28 ->
decltype(a.template inertVolumeFractionAtPos<SolidSystem>(std::declval<GlobalPosition>(), 0))
32template<
class GlobalPosition>
33struct hasPorosityAtPos
35 template<
class SpatialParams>
36 auto operator()(
const SpatialParams& a)
37 ->
decltype(a.porosityAtPos(std::declval<GlobalPosition>()))
48template<
class Gr
idGeometry,
class Scalar,
class Implementation>
53 using GridView =
typename GridGeometry::GridView;
54 using FVElementGeometry =
typename GridGeometry::LocalView;
55 using SubControlVolume =
typename GridGeometry::SubControlVolume;
56 using Element =
typename GridView::template Codim<0>::Entity;
57 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
74 template<
class ElementSolution>
76 const SubControlVolume& scv,
77 const ElementSolution& elemSol)
const
79 static_assert(
decltype(
isValid(Detail::hasPorosityAtPos<GlobalPosition>())(this->
asImp_()))::value,
" \n\n"
80 " Your spatial params class has to either implement\n\n"
81 " Scalar porosityAtPos(const GlobalPosition& globalPos) const\n\n"
82 " or overload this function\n\n"
83 " template<class ElementSolution>\n"
84 " Scalar porosity(const Element& element,\n"
85 " const SubControlVolume& scv,\n"
86 " const ElementSolution& elemSol) const\n\n");
88 return this->
asImp_().porosityAtPos(scv.center());
107 template<
class SolidSystem,
class ElementSolution,
108 typename std::enable_if_t<SolidSystem::isInert()
109 && SolidSystem::numInertComponents == 1
110 && !
decltype(
isValid(Detail::hasInertVolumeFractionAtPos<GlobalPosition, SolidSystem>())(std::declval<Implementation>()))::value,
113 const SubControlVolume& scv,
114 const ElementSolution& elemSol,
117 return 1.0 - this->
asImp_().porosity(element, scv, elemSol);
121 template<
class SolidSystem,
class ElementSolution,
122 typename std::enable_if_t<SolidSystem::numInertComponents == 0, int> = 0>
124 const SubControlVolume& scv,
125 const ElementSolution& elemSol,
132 template<
class SolidSystem,
class ElementSolution,
133 typename std::enable_if_t<(SolidSystem::numInertComponents > 1) ||
135 (SolidSystem::numInertComponents > 0) &&
137 !SolidSystem::isInert()
138 ||
decltype(
isValid(Detail::hasInertVolumeFractionAtPos<GlobalPosition, SolidSystem>())
139 (std::declval<Implementation>()))::value
144 const SubControlVolume& scv,
145 const ElementSolution& elemSol,
148 static_assert(
decltype(
isValid(Detail::hasInertVolumeFractionAtPos<GlobalPosition, SolidSystem>())(this->
asImp_()))::value,
" \n\n"
149 " Your spatial params class has to either implement\n\n"
150 " template<class SolidSystem>\n"
151 " Scalar inertVolumeFractionAtPos(const GlobalPosition& globalPos, int compIdx) const\n\n"
152 " or overload this function\n\n"
153 " template<class SolidSystem, class ElementSolution>\n"
154 " Scalar inertVolumeFraction(const Element& element,\n"
155 " const SubControlVolume& scv,\n"
156 " const ElementSolution& elemSol,\n"
157 " int compIdx) const\n\n");
159 return this->
asImp_().template inertVolumeFractionAtPos<SolidSystem>(scv.center(), compIdx);
The base class for spatial parameters of porous-medium problems.
Definition: fvporousmediumspatialparams.hh:51
FVPorousMediumSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: fvporousmediumspatialparams.hh:60
Scalar porosity(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Function for defining the porosity. That is possibly solution dependent.
Definition: fvporousmediumspatialparams.hh:75
Scalar inertVolumeFraction(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol, int compIdx) const
Function for defining the solid volume fraction. That is possibly solution dependent.
Definition: fvporousmediumspatialparams.hh:112
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.