25#ifndef DUMUX_FV_SPATIAL_PARAMS_ONE_P_HH
26#define DUMUX_FV_SPATIAL_PARAMS_ONE_P_HH
28#warning "This file is deprecated, use FVPorousMediumFlowSpatialParamsOneP from dumux/porousmediumflow/fvspatialparams1p.hh instead!"
30#include <dune/common/exceptions.hh>
31#include <dune/common/fmatrix.hh>
42template<
class GlobalPosition>
43struct hasPermeabilityAtPos
45 template<
class SpatialParams>
46 auto operator()(
const SpatialParams& a)
47 ->
decltype(a.permeabilityAtPos(std::declval<GlobalPosition>()))
51template<
class GlobalPosition,
class Sol
idSystem>
52struct hasInertVolumeFractionAtPos
54 template<
class SpatialParams>
55 auto operator()(
const SpatialParams& a)
56 ->
decltype(a.template inertVolumeFractionAtPos<SolidSystem>(std::declval<GlobalPosition>(), 0))
60template<
class GlobalPosition>
61struct hasPorosityAtPos
63 template<
class SpatialParams>
64 auto operator()(
const SpatialParams& a)
65 ->
decltype(a.porosityAtPos(std::declval<GlobalPosition>()))
76template<
class Gr
idGeometry,
class Scalar,
class Implementation>
78[[deprecated(
"Use FVPorousMediumFlowSpatialParamsOneP from dumux/porousmediumflow/fvspatialparamsmp.hh instead. This class will be removed after 3.5.")]]
81 using GridView =
typename GridGeometry::GridView;
82 using FVElementGeometry =
typename GridGeometry::LocalView;
83 using SubControlVolume =
typename GridGeometry::SubControlVolume;
84 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
85 using Element =
typename GridView::template Codim<0>::Entity;
87 enum { dim = GridView::dimension };
88 enum { dimWorld = GridView::dimensionworld };
89 using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
91 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
95 : gridGeometry_(gridGeometry)
98 const bool enableGravity = getParam<bool>(
"Problem.EnableGravity");
100 gravity_[dimWorld-1] = -9.81;
108 forchCoeffDefault_ = getParam<Scalar>(
"SpatialParams.ForchCoeff", 0.55);
121 const GlobalPosition&
gravity(
const GlobalPosition &pos)
const
134 const GlobalPosition&
normal)
const
147 const DimWorldMatrix& T2,
148 const GlobalPosition&
normal)
const
155 const Scalar alpha1 = tmp*
normal;
156 const Scalar alpha2 = tmp2*
normal;
159 const Scalar alphaAverage = 0.5*(alpha1 + alpha2);
161 DimWorldMatrix T(0.0);
162 for (
int i = 0; i < dimWorld; ++i)
164 for (
int j = 0; j < dimWorld; ++j)
166 T[i][j] += 0.5*(T1[i][j] + T2[i][j]);
168 T[i][j] += alphaHarmonic - alphaAverage;
184 template<
class ElementSolution>
186 const SubControlVolume& scv,
187 const ElementSolution& elemSol)
const
189 static_assert(
decltype(
isValid(Detail::hasPermeabilityAtPos<GlobalPosition>())(this->asImp_()))::value,
" \n\n"
190 " Your spatial params class has to either implement\n\n"
191 " const PermeabilityType& permeabilityAtPos(const GlobalPosition& globalPos) const\n\n"
192 " or overload this function\n\n"
193 " template<class ElementSolution>\n"
194 " const PermeabilityType& permeability(const Element& element,\n"
195 " const SubControlVolume& scv,\n"
196 " const ElementSolution& elemSol) const\n\n");
198 return asImp_().permeabilityAtPos(scv.center());
219 template<
class ElementSolution>
221 const SubControlVolume& scv,
222 const ElementSolution& elemSol)
const
224 static_assert(
decltype(
isValid(Detail::hasPorosityAtPos<GlobalPosition>())(this->asImp_()))::value,
" \n\n"
225 " Your spatial params class has to either implement\n\n"
226 " Scalar porosityAtPos(const GlobalPosition& globalPos) const\n\n"
227 " or overload this function\n\n"
228 " template<class ElementSolution>\n"
229 " Scalar porosity(const Element& element,\n"
230 " const SubControlVolume& scv,\n"
231 " const ElementSolution& elemSol) const\n\n");
233 return asImp_().porosityAtPos(scv.center());
252 template<
class SolidSystem,
class ElementSolution,
253 typename std::enable_if_t<SolidSystem::isInert()
254 && SolidSystem::numInertComponents == 1
255 && !
decltype(
isValid(Detail::hasInertVolumeFractionAtPos<GlobalPosition, SolidSystem>())(std::declval<Implementation>()))::value,
258 const SubControlVolume& scv,
259 const ElementSolution& elemSol,
262 return 1.0 - asImp_().porosity(element, scv, elemSol);
266 template<
class SolidSystem,
class ElementSolution,
267 typename std::enable_if_t<SolidSystem::numInertComponents == 0, int> = 0>
269 const SubControlVolume& scv,
270 const ElementSolution& elemSol,
277 template<
class SolidSystem,
class ElementSolution,
278 typename std::enable_if_t<(SolidSystem::numInertComponents > 1) ||
280 (SolidSystem::numInertComponents > 0) &&
282 !SolidSystem::isInert()
283 ||
decltype(
isValid(Detail::hasInertVolumeFractionAtPos<GlobalPosition, SolidSystem>())
284 (std::declval<Implementation>()))::value
289 const SubControlVolume& scv,
290 const ElementSolution& elemSol,
293 static_assert(
decltype(
isValid(Detail::hasInertVolumeFractionAtPos<GlobalPosition, SolidSystem>())(this->asImp_()))::value,
" \n\n"
294 " Your spatial params class has to either implement\n\n"
295 " template<class SolidSystem>\n"
296 " Scalar inertVolumeFractionAtPos(const GlobalPosition& globalPos, int compIdx) const\n\n"
297 " or overload this function\n\n"
298 " template<class SolidSystem, class ElementSolution>\n"
299 " Scalar inertVolumeFraction(const Element& element,\n"
300 " const SubControlVolume& scv,\n"
301 " const ElementSolution& elemSol,\n"
302 " int compIdx) const\n\n");
304 return asImp_().template inertVolumeFractionAtPos<SolidSystem>(scv.center(), compIdx);
316 DUNE_THROW(Dune::InvalidStateException,
317 "The spatial parameters do not provide a beaversJosephCoeffAtPos() method.");
328 return forchCoeffDefault_;
333 {
return *gridGeometry_; }
338 {
return *
static_cast<Implementation*
>(
this); }
341 {
return *
static_cast<const Implementation*
>(
this); }
344 std::shared_ptr<const GridGeometry> gridGeometry_;
345 GlobalPosition gravity_;
346 Scalar forchCoeffDefault_;
A helper function for class member function introspection.
Define some often used mathematical functions.
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Vector normal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:36
constexpr Scalar harmonicMean(Scalar x, Scalar y, Scalar wx=1.0, Scalar wy=1.0) noexcept
Calculate the (weighted) harmonic mean of two scalar values.
Definition: math.hh:69
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 one-phase problems using a fully implicit discretization met...
Definition: fv1p.hh:80
DimWorldMatrix harmonicMean(const DimWorldMatrix &T1, const DimWorldMatrix &T2, const GlobalPosition &normal) const
Harmonic average of a discontinuous tensorial field at discontinuity interface.
Definition: fv1p.hh:146
Scalar harmonicMean(const Scalar T1, const Scalar T2, const GlobalPosition &normal) const
Harmonic average of a discontinuous scalar field at discontinuity interface (for compatibility reason...
Definition: fv1p.hh:132
Scalar beaversJosephCoeffAtPos(const GlobalPosition &globalPos) const
Function for defining the Beavers-Joseph coefficient for multidomain problems .
Definition: fv1p.hh:314
static constexpr bool evaluatePermeabilityAtScvfIP()
If the permeability should be evaluated directly at the scvf integration point (for convergence tests...
Definition: fv1p.hh:206
const Implementation & asImp_() const
Definition: fv1p.hh:340
Implementation & asImp_()
Definition: fv1p.hh:337
Scalar forchCoeff(const SubControlVolumeFace &scvf) const
Apply the Forchheimer coefficient for inertial forces calculation.
Definition: fv1p.hh:326
const GlobalPosition & gravity(const GlobalPosition &pos) const
Returns the acceleration due to gravity .
Definition: fv1p.hh:121
Scalar porosity(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Function for defining the porosity. That is possibly solution dependent.
Definition: fv1p.hh:220
FVSpatialParamsOneP(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: fv1p.hh:94
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: fv1p.hh:257
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: fv1p.hh:332
decltype(auto) permeability(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Function for defining the (intrinsic) permeability .
Definition: fv1p.hh:185