25#ifndef DUMUX_FV_SPATIAL_PARAMS_HH
26#define DUMUX_FV_SPATIAL_PARAMS_HH
28#include <dune/common/exceptions.hh>
38template<
class GlobalPosition>
39struct hasMaterialLawParamsAtPos
41 template<
class SpatialParams>
42 auto operator()(
const SpatialParams& a)
43 ->
decltype(a.materialLawParamsAtPos(std::declval<GlobalPosition>()))
55template<
class Gr
idGeometry,
class Scalar,
class Implementation>
59 using GridView =
typename GridGeometry::GridView;
60 using FVElementGeometry =
typename GridGeometry::LocalView;
61 using SubControlVolume =
typename GridGeometry::SubControlVolume;
62 using Element =
typename GridView::template Codim<0>::Entity;
64 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
79 template<
class ElementSolution>
81 const SubControlVolume& scv,
82 const ElementSolution& elemSol)
const
84 static_assert(
decltype(
isValid(Detail::hasMaterialLawParamsAtPos<GlobalPosition>())(this->
asImp_()))::value,
" \n\n"
85 " Your spatial params class has to either implement\n\n"
86 " const MaterialLawParams& materialLawParamsAtPos(const GlobalPosition& globalPos) const\n\n"
87 " or overload this function\n\n"
88 " template<class ElementSolution>\n"
89 " const MaterialLawParams& materialLawParams(const Element& element,\n"
90 " const SubControlVolume& scv,\n"
91 " const ElementSolution& elemSol) const\n\n");
93 return this->
asImp_().materialLawParamsAtPos(scv.center());
104 template<
class Flu
idSystem,
class ElementSolution>
106 const SubControlVolume& scv,
107 const ElementSolution& elemSol)
const
109 return this->
asImp_().template wettingPhaseAtPos<FluidSystem>(scv.center());
118 template<
class Flu
idSystem>
121 DUNE_THROW(Dune::InvalidStateException,
122 "The spatial parameters do not provide "
123 "a wettingPhaseAtPos() method.");
A helper function for class member function introspection.
The base class for spatial parameters of one-phase problems using a fully implicit discretization met...
make the local view function available whenever we use the grid geometry
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 of multi-phase problems using a fully implicit discretization m...
Definition: fv.hh:57
decltype(auto) materialLawParams(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Function for defining the parameters needed by constitutive relationships (kr-sw, pc-sw,...
Definition: fv.hh:80
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: fv.hh:105
FVSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: fv.hh:67
int wettingPhaseAtPos(const GlobalPosition &globalPos) const
Function for defining which phase is to be considered as the wetting phase.
Definition: fv.hh:119
The base class for spatial parameters of one-phase problems using a fully implicit discretization met...
Definition: fv1p.hh:77
Implementation & asImp_()
Definition: fv1p.hh:339
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: fv1p.hh:334