25#ifndef DUMUX_PNM_SPATIAL_PARAMS_BASE_HH
26#define DUMUX_PNM_SPATIAL_PARAMS_BASE_HH
28#warning "This file is deprecated, use PoreNetwork::SpatialParams from dumux/porenetwork/common/spatialparams.hh instead!"
33#include <dune/common/fvector.hh>
42template<
class GlobalPosition>
43struct hasMaterialLawParamsAtPos
45 template<
class SpatialParams>
46 auto operator()(
const SpatialParams& a)
47 ->
decltype(a.materialLawParamsAtPos(std::declval<GlobalPosition>()))
52template<
class GlobalPosition>
53struct hasPermeabilityAtPos
55 template<
class SpatialParams>
56 auto operator()(
const SpatialParams& a)
57 ->
decltype(a.permeabilityAtPos(std::declval<GlobalPosition>()))
61template<
class GlobalPosition,
class Sol
idSystem>
62struct hasInertVolumeFractionAtPos
64 template<
class SpatialParams>
65 auto operator()(
const SpatialParams& a)
66 ->
decltype(a.template inertVolumeFractionAtPos<SolidSystem>(std::declval<GlobalPosition>(), 0))
70template<
class GlobalPosition>
71struct hasPorosityAtPos
73 template<
class SpatialParams>
74 auto operator()(
const SpatialParams& a)
75 ->
decltype(a.porosityAtPos(std::declval<GlobalPosition>()))
90template<
class Gr
idGeometry,
class Scalar,
class Implementation>
92[[deprecated(
"Use PoreNetwork::SpatialParams from dumux/porenetwork/common/spatialparams.hh instead. This class will be removed after 3.5.")]]
95 using GridView =
typename GridGeometry::GridView;
96 using SubControlVolume =
typename GridGeometry::SubControlVolume;
97 using Element =
typename GridView::template Codim<0>::Entity;
99 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
100 static constexpr auto dimWorld = GridView::dimensionworld;
106 : gridGeometry_(gridGeometry)
109 const bool enableGravity = getParam<bool>(
"Problem.EnableGravity");
111 gravity_[dimWorld-1] = -9.81;
121 template<
class ElementVolumeVariables>
123 const ElementVolumeVariables& elemVolVars)
const
125 const auto eIdx = gridGeometry().elementMapper().index(element);
126 return gridGeometry().throatLength(eIdx);
136 template<
class ElementVolumeVariables>
138 const ElementVolumeVariables& elemVolVars)
const
140 const auto eIdx = gridGeometry().elementMapper().index(element);
141 return gridGeometry().throatInscribedRadius(eIdx);
151 template<
class ElementVolumeVariables>
153 const ElementVolumeVariables& elemVolVars)
const
155 const auto eIdx = gridGeometry().elementMapper().index(element);
156 return gridGeometry().throatCrossSectionalArea(eIdx);
167 template<
class ElementSolutionVector>
169 const SubControlVolume& scv,
170 const ElementSolutionVector& elemSol)
const
172 return gridGeometry().poreInscribedRadius(scv.dofIndex());
179 {
return gridGeometry().gridView(); }
185 template<
class ElementSolutionVector>
187 const SubControlVolume& scv,
188 const ElementSolutionVector& elemSol)
const
201 const GlobalPosition&
gravity(
const GlobalPosition& pos)
const
206 {
return *gridGeometry_; }
218 template<
class ElementSolution>
220 const SubControlVolume& scv,
221 const ElementSolution& elemSol)
const
223 static_assert(
decltype(
isValid(Detail::hasPorosityAtPos<GlobalPosition>())(this->asImp_()))::value,
" \n\n"
224 " Your spatial params class has to either implement\n\n"
225 " Scalar porosityAtPos(const GlobalPosition& globalPos) const\n\n"
226 " or overload this function\n\n"
227 " template<class ElementSolution>\n"
228 " Scalar porosity(const Element& element,\n"
229 " const SubControlVolume& scv,\n"
230 " const ElementSolution& elemSol) const\n\n");
232 return asImp_().porosityAtPos(scv.center());
254 template<
class SolidSystem,
class ElementSolution,
255 typename std::enable_if_t<SolidSystem::isInert()
256 && SolidSystem::numInertComponents == 1
257 && !
decltype(
isValid(Detail::hasInertVolumeFractionAtPos<GlobalPosition, SolidSystem>())(std::declval<Implementation>()))::value,
260 const SubControlVolume& scv,
261 const ElementSolution& elemSol,
264 return 1.0 - asImp_().porosity(element, scv, elemSol);
268 template<
class SolidSystem,
class ElementSolution,
269 typename std::enable_if_t<SolidSystem::numInertComponents == 0, int> = 0>
271 const SubControlVolume& scv,
272 const ElementSolution& elemSol,
279 template<
class SolidSystem,
class ElementSolution,
280 typename std::enable_if_t<(SolidSystem::numInertComponents > 1) ||
282 (SolidSystem::numInertComponents > 0) &&
284 !SolidSystem::isInert()
285 ||
decltype(
isValid(Detail::hasInertVolumeFractionAtPos<GlobalPosition, SolidSystem>())
286 (std::declval<Implementation>()))::value
291 const SubControlVolume& scv,
292 const ElementSolution& elemSol,
295 static_assert(
decltype(
isValid(Detail::hasInertVolumeFractionAtPos<GlobalPosition, SolidSystem>())(this->asImp_()))::value,
" \n\n"
296 " Your spatial params class has to either implement\n\n"
297 " template<class SolidSystem>\n"
298 " Scalar inertVolumeFractionAtPos(const GlobalPosition& globalPos, int compIdx) const\n\n"
299 " or overload this function\n\n"
300 " template<class SolidSystem, class ElementSolution>\n"
301 " Scalar inertVolumeFraction(const Element& element,\n"
302 " const SubControlVolume& scv,\n"
303 " const ElementSolution& elemSol,\n"
304 " int compIdx) const\n\n");
306 return asImp_().template inertVolumeFractionAtPos<SolidSystem>(scv.center(), compIdx);
311 {
return *
static_cast<Implementation*
>(
this); }
314 {
return *
static_cast<const Implementation*
>(
this); }
317 std::shared_ptr<const GridGeometry> gridGeometry_;
318 GlobalPosition gravity_;
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
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
Definition: discretization/porenetwork/fvelementgeometry.hh:34
Base class for the finite volume geometry for porenetwork models.
Definition: discretization/porenetwork/gridgeometry.hh:489
The base class for spatial parameters for pore-network models.
Definition: porenetworkbase.hh:94
Implementation & asImp_()
Definition: porenetworkbase.hh:310
Scalar porosityAtPos(const GlobalPosition &globalPos) const
Definition: porenetworkbase.hh:235
Scalar throatLength(const Element &element, const ElementVolumeVariables &elemVolVars) const
Length of the throat . Can be solution-dependent.
Definition: porenetworkbase.hh:122
const Implementation & asImp_() const
Definition: porenetworkbase.hh:313
Scalar permeability(const Element &element, const SubControlVolume &scv, const ElementSolutionVector &elemSol) const
Definition: porenetworkbase.hh:186
Scalar throatInscribedRadius(const Element &element, const ElementVolumeVariables &elemVolVars) const
Inscribed radius of the throat . Can be solution-dependent.
Definition: porenetworkbase.hh:137
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: porenetworkbase.hh:205
const GlobalPosition & gravity(const GlobalPosition &pos) const
Returns the acceleration due to gravity .
Definition: porenetworkbase.hh:201
Scalar throatCrossSectionalArea(const Element &element, const ElementVolumeVariables &elemVolVars) const
Cross-sectional area of the throat . Can be solution-dependent.
Definition: porenetworkbase.hh:152
Scalar porosity(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Function for defining the porosity. That is possibly solution dependent.
Definition: porenetworkbase.hh:219
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: porenetworkbase.hh:259
Scalar PermeabilityType
Definition: porenetworkbase.hh:103
BaseSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: porenetworkbase.hh:105
const GridView & gridView() const
Returns a reference to the gridview.
Definition: porenetworkbase.hh:178
Scalar poreInscribedRadius(const Element &element, const SubControlVolume &scv, const ElementSolutionVector &elemSol) const
Inscribed radius of the pore body . Can be solution-dependent.
Definition: porenetworkbase.hh:168