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 {
* \param waterDepthInside Water depth in the inner cell [m]
* \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 gravity Gravity constant [m^3/s]
* \param gravity Gravity constant [m/s^2]
* \param nxy Normal vector of the boundary face
*
* \return cellStateOutside The outer cell state
......@@ -77,7 +77,7 @@ std::array<Scalar, 3> fixedWaterDepthBoundary(const Scalar waterDepthBoundary,
* \param waterDepthInside Water depth in the inner cell [m]
* \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 gravity Gravity constant [m^3/s]
* \param gravity Gravity constant [m/s^2]
* \param nxy Normal vector of the boundary face
*
* \return cellStateOutside The outer cell state
......
......@@ -35,9 +35,11 @@ namespace Dumux {
* The LET mobility model is used to limit the friction for small water depths.
*/
template <typename Scalar, typename NumEqVector>
template <typename NumEqVector>
class FrictionLaw
{
using Scalar = typename NumEqVector::value_type;
public:
/*!
* \brief Compute the friction source term.
......@@ -47,10 +49,10 @@ public:
* \return Friction source term.
*/
virtual NumEqVector computeSource(const Scalar waterDept,
const Scalar frictionValue,
const Scalar u,
const Scalar v) const = 0;
virtual NumEqVector computeSource(const Scalar waterDepth,
const Scalar frictionValue,
const Scalar u,
const Scalar v) const = 0;
/*!
* \brief Limit the friction for small water depth.
......
......@@ -36,9 +36,11 @@ namespace Dumux {
* The LET mobility model is used to limit the friction for small water depths.
*/
template <typename Scalar, typename NumEqVector>
class FrictionLawManning : public FrictionLaw<Scalar, NumEqVector>
template <typename NumEqVector>
class FrictionLawManning : public FrictionLaw<NumEqVector>
{
using Scalar = typename NumEqVector::value_type;
public:
FrictionLawManning(const Scalar gravity)
: gravity_(gravity) {}
......@@ -54,9 +56,9 @@ public:
* \return Friction source term.
*/
NumEqVector computeSource(const Scalar waterDepth,
const Scalar frictionValue,
const Scalar u,
const Scalar v) const final
const Scalar frictionValue,
const Scalar u,
const Scalar v) const final
{
using std::pow;
using std::hypot;
......
......@@ -36,9 +36,11 @@ namespace Dumux {
* The LET mobility model is used to limit the friction for small water depths.
*/
template <typename Scalar, typename NumEqVector>
class FrictionLawNikuradse : public FrictionLaw<Scalar, NumEqVector>
template <typename NumEqVector>
class FrictionLawNikuradse : public FrictionLaw<NumEqVector>
{
using Scalar = typename NumEqVector::value_type;
public:
/*!
* \brief Compute the friction source term.
......@@ -52,9 +54,9 @@ public:
*/
NumEqVector computeSource(const Scalar waterDepth,
const Scalar frictionValue,
const Scalar u,
const Scalar v) const final
const Scalar frictionValue,
const Scalar u,
const Scalar v) const final
{
using std::pow;
using std::log;
......
......@@ -147,11 +147,11 @@ public:
const auto gravity = this->spatialParams().gravity();
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"))
{
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<<" 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.";
......@@ -380,7 +380,7 @@ private:
Scalar constManningN_; // analytic solution is only available for const friction.
Scalar bedSlope_;
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;
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