version 3.10-dev
frictionlaw.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_MATERIAL_FLUIDMATRIX_FRICTIONLAW_HH
13#define DUMUX_MATERIAL_FLUIDMATRIX_FRICTIONLAW_HH
14
15#include <algorithm>
16#include <cmath>
17
18#include <dune/common/fvector.hh>
19
20namespace Dumux {
29template <typename VolumeVariables >
31{
32 using Scalar = typename VolumeVariables::PrimaryVariables::value_type;
33public:
45 virtual Dune::FieldVector<Scalar, 2> bottomShearStress(const VolumeVariables& volVars) const = 0;
46
84 Scalar limitRoughH(const Scalar roughnessHeight, const Scalar waterDepth, const Scalar eps=1.0e-12) const
85 {
86 using std::clamp;
87
88 // return zero if the roughness depth is near zero
89 if (roughnessHeight < eps) return 0.0;
90
91 // calculate the artificial water depth
92 const Scalar mobilityMax = 1.0;
93
94 const Scalar minUpperH = roughnessHeight * 2.0;
95 const Scalar sw = clamp(waterDepth * (1.0/minUpperH), 0.0, 1.0);
96 const Scalar mobility = mobilityMax /(1.0 + (1.0-sw)*(1.0-sw));
97 return roughnessHeight * (1.0 - mobility);
98 }
99
100 // virtual base class needs a virtual destructor
101 virtual ~FrictionLaw() = default;
102};
103
104} // end namespace Dumux
105
106#endif
Implementation of the abstract base class for friction laws.
Definition: frictionlaw.hh:31
virtual ~FrictionLaw()=default
Scalar limitRoughH(const Scalar roughnessHeight, const Scalar waterDepth, const Scalar eps=1.0e-12) const
Limit the friction for small water depth.
Definition: frictionlaw.hh:84
virtual Dune::FieldVector< Scalar, 2 > bottomShearStress(const VolumeVariables &volVars) const =0
Compute the bottom shear stress.
std::string mobility(int phaseIdx) noexcept
I/O name of mobility for multiphase systems.
Definition: name.hh:89
Definition: adapt.hh:17