GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/flux/shallowwater/fluxlimiterlet.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 7 7 100.0%
Functions: 1 1 100.0%
Branches: 5 6 83.3%

Line Branch Exec Source
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 //
7 /*!
8 * \file
9 * \ingroup ShallowWaterFlux
10 * \brief Function to limit the fluxes
11 *
12 */
13 #ifndef DUMUX_FLUX_SHALLOW_WATER_FLUX_LIMITER_LET_HH
14 #define DUMUX_FLUX_SHALLOW_WATER_FLUX_LIMITER_LET_HH
15
16 #include <algorithm>
17 #include <cmath>
18
19 namespace Dumux {
20 namespace ShallowWater {
21
22 /*!
23 * \ingroup ShallowWaterFlux
24 * \brief Flux limiter function to scale fluxes for small water depths.
25 *
26 * This function acts like a kind of mobility, it limits the water flux
27 * for small water depths. The mobility depends on the left and right
28 * side state of a variable. The LET-Type function is described at
29 * https://en.wikipedia.org/wiki/Relative_permeability
30 * The LET-Parameters are fixed. The current parameters are set to a
31 * values to get a nice curve. They have no physical meaning.
32 *
33 * \tparam Scalar the scalar type for scalar physical quantities
34 * \param valueLeft The value on the left side
35 * \param valueRight The value on the right side
36 * \param upperH Where to start the limit the function (mobility < 1)
37 * \param lowerH Where the limit should reach zero (mobility < 0)
38 */
39 template<class Scalar>
40 159362171 static Scalar fluxLimiterLET(const Scalar valueLeft,
41 const Scalar valueRight,
42 const Scalar upperH,
43 const Scalar lowerH)
44 {
45 using std::pow;
46 using std::min;
47 using std::max;
48
49 159362171 const auto h = (valueLeft + valueRight)*0.5;
50
51 159362171 Scalar mobility = 1.0;
52
2/2
✓ Branch 0 taken 25258558 times.
✓ Branch 1 taken 134103613 times.
159362171 if (h < upperH)
53 {
54
3/4
✗ Branch 0 not taken.
✓ Branch 1 taken 25258558 times.
✓ Branch 2 taken 7040 times.
✓ Branch 3 taken 25251518 times.
25258558 const auto sw = max(min(h*(1.0/upperH) - lowerH, 1.0), 0.0);
55
56 // LET-model for mobility
57 // constexpr Scalar krw = 1.0;
58 // constexpr Scalar letL = 2.0;
59 // constexpr Scalar letT = 2.0;
60 // constexpr Scalar letE = 1.0;
61 // mobility = (krw * pow(sw, letL))/(pow(sw, letL) + letE * pow(1.0 - sw, letT));
62
63 25258558 mobility = (sw*sw)/(sw*sw + (1-sw)*(1-sw));
64 }
65
66 159362171 return mobility;
67 }
68
69 } // end namespace ShallowWater
70 } // end namespace Dumux
71
72 #endif
73