GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/discretization/cellcentered/tpfa/computetransmissibility.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 11 11 100.0%
Functions: 29 33 87.9%
Branches: 25 30 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 CCTpfaDiscretization
10 * \brief Free functions to evaluate the transmissibilities
11 * associated with flux evaluations across sub-control volume faces
12 * in the context of the cell-centered TPFA scheme.
13 */
14 #ifndef DUMUX_DISCRETIZATION_CC_TPFA_COMPUTE_TRANSMISSIBILITY_HH
15 #define DUMUX_DISCRETIZATION_CC_TPFA_COMPUTE_TRANSMISSIBILITY_HH
16
17 #include <dune/common/typetraits.hh>
18 #include <dune/common/fmatrix.hh>
19
20 namespace Dumux {
21
22 /*!
23 * \ingroup CCTpfaDiscretization
24 * \brief Free function to evaluate the Tpfa transmissibility
25 * associated with the flux (in the form of flux = T*gradU) across a
26 * sub-control volume face stemming from a given sub-control
27 * volume with corresponding tensor T.
28 *
29 * \param fvGeometry The element-centered control volume geometry
30 * \param scvf The sub-control volume face
31 * \param scv The neighboring sub-control volume
32 * \param T The tensor living in the neighboring scv
33 * \param extrusionFactor The extrusion factor of the scv
34 */
35 template< class FVElementGeometry, class Tensor >
36 57734164 typename Tensor::field_type computeTpfaTransmissibility(const FVElementGeometry& fvGeometry,
37 const typename FVElementGeometry::SubControlVolumeFace& scvf,
38 const typename FVElementGeometry::SubControlVolume& scv,
39 const Tensor& T,
40 typename FVElementGeometry::SubControlVolume::Traits::Scalar extrusionFactor)
41 {
42 using GlobalPosition = typename FVElementGeometry::SubControlVolumeFace::Traits::GlobalPosition;
43 57734164 GlobalPosition Knormal;
44 115468328 T.mv(scvf.unitOuterNormal(), Knormal);
45
46 57734164 auto distanceVector = scvf.ipGlobal();
47 115468328 distanceVector -= scv.center();
48 distanceVector /= distanceVector.two_norm2();
49
50 57734164 return (Knormal*distanceVector) * extrusionFactor;
51 }
52
53 /*!
54 * \ingroup CCTpfaDiscretization
55 * \brief Free function to evaluate the Tpfa transmissibility
56 * associated with the flux (in the form of flux = T*gradU) across a
57 * sub-control volume face stemming from a given sub-control
58 * volume for the case where T is just a scalar
59 *
60 * \param fvGeometry The element-centered control volume geometry
61 * \param scvf The sub-control volume face
62 * \param scv The neighboring sub-control volume
63 * \param t The scalar quantity living in the neighboring scv
64 * \param extrusionFactor The extrusion factor of the scv
65 */
66 template< class FVElementGeometry,
67 class Tensor,
68 typename std::enable_if_t<Dune::IsNumber<Tensor>::value, int> = 0 >
69 1452327024 Tensor computeTpfaTransmissibility(const FVElementGeometry& fvGeometry,
70 const typename FVElementGeometry::SubControlVolumeFace& scvf,
71 const typename FVElementGeometry::SubControlVolume& scv,
72 Tensor t,
73 typename FVElementGeometry::SubControlVolumeFace::Traits::Scalar extrusionFactor)
74 {
75 1536626738 auto distanceVector = scvf.ipGlobal();
76
10/12
✓ Branch 0 taken 162646 times.
✓ Branch 1 taken 32579784 times.
✓ Branch 2 taken 162646 times.
✓ Branch 3 taken 32579784 times.
✓ Branch 4 taken 124504 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 124504 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 788 times.
✓ Branch 9 taken 124504 times.
✓ Branch 10 taken 788 times.
✓ Branch 11 taken 124504 times.
3073253476 distanceVector -= scv.center();
77 1536621218 distanceVector /= distanceVector.two_norm2();
78
79
15/18
✓ Branch 0 taken 162646 times.
✓ Branch 1 taken 32579784 times.
✓ Branch 2 taken 162646 times.
✓ Branch 3 taken 32579784 times.
✓ Branch 4 taken 162646 times.
✓ Branch 5 taken 32579784 times.
✓ Branch 6 taken 124504 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 124504 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 124504 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 788 times.
✓ Branch 13 taken 124504 times.
✓ Branch 14 taken 788 times.
✓ Branch 15 taken 124504 times.
✓ Branch 16 taken 788 times.
✓ Branch 17 taken 124504 times.
3157558710 return t * extrusionFactor * (distanceVector * scvf.unitOuterNormal());
80 }
81
82 } // end namespace Dumux
83
84 #endif
85