25#ifndef DUMUX_POROUS_MEDIUM_FV_SPATIAL_PARAMS_HH
26#define DUMUX_POROUS_MEDIUM_FV_SPATIAL_PARAMS_HH
35template<
class GlobalPosition,
class Sol
idSystem>
36struct hasInertVolumeFractionAtPos
38 template<
class SpatialParams>
39 auto operator()(
const SpatialParams& a)
40 ->
decltype(a.template inertVolumeFractionAtPos<SolidSystem>(std::declval<GlobalPosition>(), 0))
44template<
class GlobalPosition>
45struct hasPorosityAtPos
47 template<
class SpatialParams>
48 auto operator()(
const SpatialParams& a)
49 ->
decltype(a.porosityAtPos(std::declval<GlobalPosition>()))
60template<
class Gr
idGeometry,
class Scalar,
class Implementation>
65 using GridView =
typename GridGeometry::GridView;
66 using FVElementGeometry =
typename GridGeometry::LocalView;
67 using SubControlVolume =
typename GridGeometry::SubControlVolume;
68 using Element =
typename GridView::template Codim<0>::Entity;
69 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
86 template<
class ElementSolution>
88 const SubControlVolume& scv,
89 const ElementSolution& elemSol)
const
91 static_assert(
decltype(
isValid(Detail::hasPorosityAtPos<GlobalPosition>())(this->
asImp_()))::value,
" \n\n"
92 " Your spatial params class has to either implement\n\n"
93 " Scalar porosityAtPos(const GlobalPosition& globalPos) const\n\n"
94 " or overload this function\n\n"
95 " template<class ElementSolution>\n"
96 " Scalar porosity(const Element& element,\n"
97 " const SubControlVolume& scv,\n"
98 " const ElementSolution& elemSol) const\n\n");
100 return this->
asImp_().porosityAtPos(scv.center());
119 template<
class SolidSystem,
class ElementSolution,
120 typename std::enable_if_t<SolidSystem::isInert()
121 && SolidSystem::numInertComponents == 1
122 && !
decltype(
isValid(Detail::hasInertVolumeFractionAtPos<GlobalPosition, SolidSystem>())(std::declval<Implementation>()))::value,
125 const SubControlVolume& scv,
126 const ElementSolution& elemSol,
129 return 1.0 - this->
asImp_().porosity(element, scv, elemSol);
133 template<
class SolidSystem,
class ElementSolution,
134 typename std::enable_if_t<SolidSystem::numInertComponents == 0, int> = 0>
136 const SubControlVolume& scv,
137 const ElementSolution& elemSol,
144 template<
class SolidSystem,
class ElementSolution,
145 typename std::enable_if_t<(SolidSystem::numInertComponents > 1) ||
147 (SolidSystem::numInertComponents > 0) &&
149 !SolidSystem::isInert()
150 ||
decltype(
isValid(Detail::hasInertVolumeFractionAtPos<GlobalPosition, SolidSystem>())
151 (std::declval<Implementation>()))::value
156 const SubControlVolume& scv,
157 const ElementSolution& elemSol,
160 static_assert(
decltype(
isValid(Detail::hasInertVolumeFractionAtPos<GlobalPosition, SolidSystem>())(this->
asImp_()))::value,
" \n\n"
161 " Your spatial params class has to either implement\n\n"
162 " template<class SolidSystem>\n"
163 " Scalar inertVolumeFractionAtPos(const GlobalPosition& globalPos, int compIdx) const\n\n"
164 " or overload this function\n\n"
165 " template<class SolidSystem, class ElementSolution>\n"
166 " Scalar inertVolumeFraction(const Element& element,\n"
167 " const SubControlVolume& scv,\n"
168 " const ElementSolution& elemSol,\n"
169 " int compIdx) const\n\n");
171 return this->
asImp_().template inertVolumeFractionAtPos<SolidSystem>(scv.center(), compIdx);
A helper function for class member function introspection.
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 of porous-medium problems.
Definition: fvporousmediumspatialparams.hh:63
FVPorousMediumSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: fvporousmediumspatialparams.hh:72
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:87
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:124
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
Basic spatial parameters to be used with finite-volume schemes.