GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/multidomain/facet/box/upwindscheme.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 21 21 100.0%
Functions: 4 4 100.0%
Branches: 24 26 92.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 FacetCoupling
10 * \brief Modified upwind scheme for models using the box scheme
11 * with coupling across element facets.
12 */
13 #ifndef DUMUX_MULTIDOMAIN_FACET_BOX_UPWINDSCHEME_HH
14 #define DUMUX_MULTIDOMAIN_FACET_BOX_UPWINDSCHEME_HH
15
16 #include <dumux/common/parameters.hh>
17 #include <dumux/discretization/method.hh>
18
19 namespace Dumux {
20
21 /*!
22 * \ingroup FacetCoupling
23 * \brief The upwind scheme used for the advective fluxes.
24 * This is a modified scheme for models involving coupling
25 * with a lower-dimensional domain across the element facets.
26 */
27 template<class GridGeometry>
28 class BoxFacetCouplingUpwindScheme
29 {
30 public:
31 // applies a simple upwind scheme to the precalculated advective flux
32 template<class FluxVariables, class UpwindTermFunction, class Scalar>
33 25946912 static Scalar apply(const FluxVariables& fluxVars,
34 const UpwindTermFunction& upwindTerm,
35 Scalar flux, int phaseIdx)
36 {
37 // TODO: pass this from outside?
38
4/6
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 8380703 times.
✓ Branch 3 taken 17 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 17 times.
✗ Branch 7 not taken.
25946912 static const Scalar upwindWeight = getParam<Scalar>("Flux.UpwindWeight");
39
40 25946912 const auto& elemVolVars = fluxVars.elemVolVars();
41 25946912 const auto& scvf = fluxVars.scvFace();
42
4/4
✓ Branch 0 taken 686160 times.
✓ Branch 1 taken 7694560 times.
✓ Branch 2 taken 686160 times.
✓ Branch 3 taken 7694560 times.
51893824 const auto& insideScv = fluxVars.fvGeometry().scv(scvf.insideScvIdx());
43
2/2
✓ Branch 0 taken 686160 times.
✓ Branch 1 taken 7694560 times.
25946912 const auto& insideVolVars = elemVolVars[insideScv];
44
45 // check if this is an interior boundary
46
2/2
✓ Branch 0 taken 686160 times.
✓ Branch 1 taken 7694560 times.
25946912 if (scvf.interiorBoundary())
47 {
48 2306944 const auto& cm = fluxVars.problem().couplingManager();
49 2306944 const auto& outsideVolVars = cm.getLowDimVolVars(fluxVars.element(), scvf);
50
4/4
✓ Branch 0 taken 401306 times.
✓ Branch 1 taken 284854 times.
✓ Branch 2 taken 401306 times.
✓ Branch 3 taken 284854 times.
4613888 if (std::signbit(flux)) // if sign of flux is negative
51 1482696 return flux*(upwindWeight*upwindTerm(outsideVolVars)
52 2097950 + (1.0 - upwindWeight)*upwindTerm(insideVolVars));
53 else
54 824248 return flux*(upwindWeight*upwindTerm(insideVolVars)
55 1219026 + (1.0 - upwindWeight)*upwindTerm(outsideVolVars));
56 }
57 else
58 {
59
2/2
✓ Branch 1 taken 4326528 times.
✓ Branch 2 taken 3368032 times.
23639968 const auto& outsideScv = fluxVars.fvGeometry().scv(scvf.outsideScvIdx());
60
2/2
✓ Branch 0 taken 4326528 times.
✓ Branch 1 taken 3368032 times.
23639968 const auto& outsideVolVars = elemVolVars[outsideScv];
61
4/4
✓ Branch 0 taken 4326528 times.
✓ Branch 1 taken 3368032 times.
✓ Branch 2 taken 4326528 times.
✓ Branch 3 taken 3368032 times.
47279936 if (std::signbit(flux)) // if sign of flux is negative
62 13002166 return flux*(upwindWeight*upwindTerm(outsideVolVars)
63 17897740 + (1.0 - upwindWeight)*upwindTerm(insideVolVars));
64 else
65 10637802 return flux*(upwindWeight*upwindTerm(insideVolVars)
66 14979444 + (1.0 - upwindWeight)*upwindTerm(outsideVolVars));
67 }
68 }
69 };
70
71 } // end namespace Dumux
72
73 #endif
74