Skip to content
Snippets Groups Projects
Commit 291f4bb2 authored by Timo Koch's avatar Timo Koch Committed by Dennis Gläser
Browse files

[spatialparams] Add gravity to the pm spatial params

parent cbdfb1b9
No related branches found
No related tags found
1 merge request!1573Feature/move gravity to spatialparams
...@@ -90,7 +90,12 @@ class FVSpatialParamsOneP ...@@ -90,7 +90,12 @@ class FVSpatialParamsOneP
public: public:
FVSpatialParamsOneP(std::shared_ptr<const FVGridGeometry> fvGridGeometry) FVSpatialParamsOneP(std::shared_ptr<const FVGridGeometry> fvGridGeometry)
: 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 /* \brief default forchheimer coefficient
* Source: Ward, J.C. 1964 Turbulent flow in porous media. ASCE J. Hydraul. Div 90 \cite ward1964 . * 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 * Actually the Forchheimer coefficient is also a function of the dimensions of the
...@@ -100,6 +105,19 @@ public: ...@@ -100,6 +105,19 @@ public:
forchCoeffDefault_ = getParam<Scalar>("SpatialParams.ForchCoeff", 0.55); 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 * \brief Harmonic average of a discontinuous scalar field at discontinuity interface
* (for compatibility reasons with the function below) * (for compatibility reasons with the function below)
...@@ -322,6 +340,7 @@ protected: ...@@ -322,6 +340,7 @@ protected:
private: private:
std::shared_ptr<const FVGridGeometry> fvGridGeometry_; std::shared_ptr<const FVGridGeometry> fvGridGeometry_;
GlobalPosition gravity_; //!< The gravity vector
Scalar forchCoeffDefault_; Scalar forchCoeffDefault_;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment