Commit 241c5038 authored by Martin Utz's avatar Martin Utz
Browse files

[swe][frictionlaws] Remove template argument Scalar

It is possible to extract the Scalar type from the NumEqVector type.
Therefore its not necessary any longer to pass it explicitly as an
template argument.
parent d3d6f0c9
...@@ -43,7 +43,7 @@ namespace ShallowWater { ...@@ -43,7 +43,7 @@ namespace ShallowWater {
* \param waterDepthInside Water depth in the inner cell [m] * \param waterDepthInside Water depth in the inner cell [m]
* \param velocityXInside Velocity in x-direction in the inner cell [m/s] * \param velocityXInside Velocity in x-direction in the inner cell [m/s]
* \param velocityYInside Velocity in y-direction in the inner cell [m/s] * \param velocityYInside Velocity in y-direction in the inner cell [m/s]
* \param gravity Gravity constant [m^3/s] * \param gravity Gravity constant [m/s^2]
* \param nxy Normal vector of the boundary face * \param nxy Normal vector of the boundary face
* *
* \return cellStateOutside The outer cell state * \return cellStateOutside The outer cell state
...@@ -77,7 +77,7 @@ std::array<Scalar, 3> fixedWaterDepthBoundary(const Scalar waterDepthBoundary, ...@@ -77,7 +77,7 @@ std::array<Scalar, 3> fixedWaterDepthBoundary(const Scalar waterDepthBoundary,
* \param waterDepthInside Water depth in the inner cell [m] * \param waterDepthInside Water depth in the inner cell [m]
* \param velocityXInside Velocity in x-direction in the inner cell [m/s] * \param velocityXInside Velocity in x-direction in the inner cell [m/s]
* \param velocityYInside Velocity in y-direction in the inner cell [m/s] * \param velocityYInside Velocity in y-direction in the inner cell [m/s]
* \param gravity Gravity constant [m^3/s] * \param gravity Gravity constant [m/s^2]
* \param nxy Normal vector of the boundary face * \param nxy Normal vector of the boundary face
* *
* \return cellStateOutside The outer cell state * \return cellStateOutside The outer cell state
......
...@@ -35,9 +35,11 @@ namespace Dumux { ...@@ -35,9 +35,11 @@ namespace Dumux {
* The LET mobility model is used to limit the friction for small water depths. * The LET mobility model is used to limit the friction for small water depths.
*/ */
template <typename Scalar, typename NumEqVector> template <typename NumEqVector>
class FrictionLaw class FrictionLaw
{ {
using Scalar = typename NumEqVector::value_type;
public: public:
/*! /*!
* \brief Compute the friction source term. * \brief Compute the friction source term.
...@@ -47,10 +49,10 @@ public: ...@@ -47,10 +49,10 @@ public:
* \return Friction source term. * \return Friction source term.
*/ */
virtual NumEqVector computeSource(const Scalar waterDept, virtual NumEqVector computeSource(const Scalar waterDepth,
const Scalar frictionValue, const Scalar frictionValue,
const Scalar u, const Scalar u,
const Scalar v) const = 0; const Scalar v) const = 0;
/*! /*!
* \brief Limit the friction for small water depth. * \brief Limit the friction for small water depth.
......
...@@ -36,9 +36,11 @@ namespace Dumux { ...@@ -36,9 +36,11 @@ namespace Dumux {
* The LET mobility model is used to limit the friction for small water depths. * The LET mobility model is used to limit the friction for small water depths.
*/ */
template <typename Scalar, typename NumEqVector> template <typename NumEqVector>
class FrictionLawManning : public FrictionLaw<Scalar, NumEqVector> class FrictionLawManning : public FrictionLaw<NumEqVector>
{ {
using Scalar = typename NumEqVector::value_type;
public: public:
FrictionLawManning(const Scalar gravity) FrictionLawManning(const Scalar gravity)
: gravity_(gravity) {} : gravity_(gravity) {}
...@@ -54,9 +56,9 @@ public: ...@@ -54,9 +56,9 @@ public:
* \return Friction source term. * \return Friction source term.
*/ */
NumEqVector computeSource(const Scalar waterDepth, NumEqVector computeSource(const Scalar waterDepth,
const Scalar frictionValue, const Scalar frictionValue,
const Scalar u, const Scalar u,
const Scalar v) const final const Scalar v) const final
{ {
using std::pow; using std::pow;
using std::hypot; using std::hypot;
......
...@@ -36,9 +36,11 @@ namespace Dumux { ...@@ -36,9 +36,11 @@ namespace Dumux {
* The LET mobility model is used to limit the friction for small water depths. * The LET mobility model is used to limit the friction for small water depths.
*/ */
template <typename Scalar, typename NumEqVector> template <typename NumEqVector>
class FrictionLawNikuradse : public FrictionLaw<Scalar, NumEqVector> class FrictionLawNikuradse : public FrictionLaw<NumEqVector>
{ {
using Scalar = typename NumEqVector::value_type;
public: public:
/*! /*!
* \brief Compute the friction source term. * \brief Compute the friction source term.
...@@ -52,9 +54,9 @@ public: ...@@ -52,9 +54,9 @@ public:
*/ */
NumEqVector computeSource(const Scalar waterDepth, NumEqVector computeSource(const Scalar waterDepth,
const Scalar frictionValue, const Scalar frictionValue,
const Scalar u, const Scalar u,
const Scalar v) const final const Scalar v) const final
{ {
using std::pow; using std::pow;
using std::log; using std::log;
......
...@@ -147,11 +147,11 @@ public: ...@@ -147,11 +147,11 @@ public:
const auto gravity = this->spatialParams().gravity(); const auto gravity = this->spatialParams().gravity();
if (getParam<std::string>("Problem.FrictionLaw") == ("Manning")) if (getParam<std::string>("Problem.FrictionLaw") == ("Manning"))
{ {
frictionLaw_ = std::make_shared<FrictionLawManning<Scalar,NumEqVector>>(gravity); frictionLaw_ = std::make_shared<FrictionLawManning<NumEqVector>>(gravity);
} }
else if (getParam<std::string>("Problem.FrictionLaw") == ("Nikuradse")) else if (getParam<std::string>("Problem.FrictionLaw") == ("Nikuradse"))
{ {
frictionLaw_ = std::make_shared<FrictionLawNikuradse<Scalar,NumEqVector>>(); frictionLaw_ = std::make_shared<FrictionLawNikuradse<NumEqVector>>();
std::cout<<"\nWARNING: This test is meant to be run for the friction law after Manning.\n"; std::cout<<"\nWARNING: This test is meant to be run for the friction law after Manning.\n";
std::cout<<" You are running it with Nikuradse, although the friction values in\n"; std::cout<<" You are running it with Nikuradse, although the friction values in\n";
std::cout<<" the input file and the analytic solution don't fit to Nikuradse!\n\n."; std::cout<<" the input file and the analytic solution don't fit to Nikuradse!\n\n.";
...@@ -380,7 +380,7 @@ private: ...@@ -380,7 +380,7 @@ private:
Scalar constManningN_; // analytic solution is only available for const friction. Scalar constManningN_; // analytic solution is only available for const friction.
Scalar bedSlope_; Scalar bedSlope_;
Scalar discharge_; // discharge at the inflow boundary Scalar discharge_; // discharge at the inflow boundary
std::shared_ptr<FrictionLaw<Scalar,NumEqVector>> frictionLaw_; std::shared_ptr<FrictionLaw<NumEqVector>> frictionLaw_;
static constexpr Scalar eps_ = 1.0e-6; static constexpr Scalar eps_ = 1.0e-6;
std::string name_; std::string name_;
}; };
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment