GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/flux/shallowwaterflux.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 11 11 100.0%
Functions: 6 6 100.0%
Branches: 0 0 -%

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 Flux
10 * \copydoc Dumux::ShallowWaterFlux
11 */
12 #ifndef DUMUX_FLUX_SHALLOW_WATER_FLUX_HH
13 #define DUMUX_FLUX_SHALLOW_WATER_FLUX_HH
14
15 #include <dumux/flux/fluxvariablescaching.hh>
16 #include <dumux/flux/shallowwater/riemannproblem.hh>
17
18 namespace Dumux {
19
20 /*!
21 * \ingroup Flux
22 * \brief Prepare and compute the shallow water advective flux.
23 *
24 * Prepares the Riemann problem for the advective flux for the 2D shallow
25 * water model. The actual model uses an exact Riemann solver after Torro
26 * and the reconstruction after Audusse. A flux limiter is
27 * applied to limit water flow for small water depths.
28 *
29 * The computed water flux of the Riemann solver is given in m^2/s, the
30 * momentum fluxes are given in m^3/s^2. The Riemann flux is multiplied by
31 * scvf.area() (given in m) to obtain the flux over the face.
32 *
33 * \todo Add more numerical fluxes and reconstruction methods.
34 */
35 template<class NumEqVector>
36 class ShallowWaterFlux
37 {
38
39 public:
40
41 using Cache = FluxVariablesCaching::EmptyAdvectionCache;
42 using CacheFiller = FluxVariablesCaching::EmptyCacheFiller;
43
44 /*!
45 * \ingroup Flux
46 * \brief Prepares and compute the shallow water advective flux.
47 *
48 */
49 template<class Problem, class FVElementGeometry, class ElementVolumeVariables>
50 156514916 static NumEqVector flux(const Problem& problem,
51 const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
52 const FVElementGeometry& fvGeometry,
53 const ElementVolumeVariables& elemVolVars,
54 const typename FVElementGeometry::SubControlVolumeFace& scvf)
55 {
56
57 //Get the inside and outside volume variables
58 313029832 const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
59 313029832 const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
60 156514916 const auto& nxy = scvf.unitOuterNormal();
61 313029832 const auto gravity = problem.spatialParams().gravity(scvf.center());
62
63 1095604412 auto riemannFlux = ShallowWater::riemannProblem(insideVolVars.waterDepth(),
64 outsideVolVars.waterDepth(),
65 insideVolVars.velocity(0),
66 outsideVolVars.velocity(0),
67 insideVolVars.velocity(1),
68 outsideVolVars.velocity(1),
69 insideVolVars.bedSurface(),
70 outsideVolVars.bedSurface(),
71 gravity,
72 nxy);
73
74 156514916 NumEqVector localFlux(0.0);
75 469544748 localFlux[0] = riemannFlux[0] * scvf.area();
76 469544748 localFlux[1] = riemannFlux[1] * scvf.area();
77 469544748 localFlux[2] = riemannFlux[2] * scvf.area();
78
79 156514916 return localFlux;
80 }
81 };
82
83 } // end namespace Dumux
84
85 #endif
86