diff --git a/dumux/material/spatialparams/fv1p.hh b/dumux/material/spatialparams/fv1p.hh index c59242aa586fb5579ec5e19bd766c9619290dff6..8c254d079298cb1c683850705215dbdc424c94ee 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_; };