From 291f4bb23c85d940ba1c88cf80e83c03715a0753 Mon Sep 17 00:00:00 2001 From: Timo Koch <timo.koch@iws.uni-stuttgart.de> Date: Wed, 1 May 2019 22:07:37 +0200 Subject: [PATCH] [spatialparams] Add gravity to the pm spatial params --- dumux/material/spatialparams/fv1p.hh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dumux/material/spatialparams/fv1p.hh b/dumux/material/spatialparams/fv1p.hh index c59242aa58..8c254d0792 100644 --- a/dumux/material/spatialparams/fv1p.hh +++ b/dumux/material/spatialparams/fv1p.hh @@ -90,7 +90,12 @@ class FVSpatialParamsOneP public: FVSpatialParamsOneP(std::shared_ptr<const FVGridGeometry> fvGridGeometry) : fvGridGeometry_(fvGridGeometry) + , gravity_(0.0) { + const bool enableGravity = getParam<bool>("Problem.EnableGravity"); + if (enableGravity) + gravity_[dimWorld-1] = -9.81; + /* \brief default forchheimer coefficient * Source: Ward, J.C. 1964 Turbulent flow in porous media. ASCE J. Hydraul. Div 90 \cite ward1964 . * Actually the Forchheimer coefficient is also a function of the dimensions of the @@ -100,6 +105,19 @@ public: forchCoeffDefault_ = getParam<Scalar>("SpatialParams.ForchCoeff", 0.55); } + /*! + * \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$. + * + * The default behaviour is a constant gravity vector; + * if the <tt>Problem.EnableGravity</tt> parameter is true, + * \f$\boldsymbol{g} = ( 0,\dots,\ -9.81)^T \f$, + * else \f$\boldsymbol{g} = ( 0,\dots, 0)^T \f$. + * + * \param pos the spatial position at which to evaulate the gravity vector + */ + const GlobalPosition& gravity(const GlobalPosition &pos) const + { return gravity_; } + /*! * \brief Harmonic average of a discontinuous scalar field at discontinuity interface * (for compatibility reasons with the function below) @@ -322,6 +340,7 @@ protected: private: std::shared_ptr<const FVGridGeometry> fvGridGeometry_; + GlobalPosition gravity_; //!< The gravity vector Scalar forchCoeffDefault_; }; -- GitLab