GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/multidomain/facet/box/upwindscheme.hh
Date: 2025-04-12 19:19:20
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-FileCopyrightText: 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
2/2
✓ Branch 0 taken 686160 times.
✓ Branch 1 taken 7694560 times.
25946912 const auto& elemVolVars = fluxVars.elemVolVars();
41
2/2
✓ Branch 0 taken 686160 times.
✓ Branch 1 taken 7694560 times.
25946912 const auto& scvf = fluxVars.scvFace();
42
2/2
✓ Branch 0 taken 686160 times.
✓ Branch 1 taken 7694560 times.
25946912 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
2/2
✓ Branch 1 taken 401246 times.
✓ Branch 2 taken 284914 times.
2306944 const auto& outsideVolVars = cm.getLowDimVolVars(fluxVars.element(), scvf);
50
2/2
✓ Branch 0 taken 401246 times.
✓ Branch 1 taken 284914 times.
2306944 if (std::signbit(flux)) // if sign of flux is negative
51 1482636 return flux*(upwindWeight*upwindTerm(outsideVolVars)
52 1482636 + (1.0 - upwindWeight)*upwindTerm(insideVolVars));
53 else
54 824308 return flux*(upwindWeight*upwindTerm(insideVolVars)
55 824308 + (1.0 - upwindWeight)*upwindTerm(outsideVolVars));
56 }
57 else
58 {
59
2/2
✓ Branch 1 taken 4325609 times.
✓ Branch 2 taken 3368951 times.
23639968 const auto& outsideScv = fluxVars.fvGeometry().scv(scvf.outsideScvIdx());
60
2/2
✓ Branch 0 taken 4325609 times.
✓ Branch 1 taken 3368951 times.
23639968 const auto& outsideVolVars = elemVolVars[outsideScv];
61
2/2
✓ Branch 0 taken 4325609 times.
✓ Branch 1 taken 3368951 times.
23639968 if (std::signbit(flux)) // if sign of flux is negative
62 13001247 return flux*(upwindWeight*upwindTerm(outsideVolVars)
63 13001247 + (1.0 - upwindWeight)*upwindTerm(insideVolVars));
64 else
65 10638721 return flux*(upwindWeight*upwindTerm(insideVolVars)
66 10638721 + (1.0 - upwindWeight)*upwindTerm(outsideVolVars));
67 }
68 }
69 };
70
71 } // end namespace Dumux
72
73 #endif
74