GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/1p/network1d3d/spatialparams.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 11 19 57.9%
Functions: 2 12 16.7%
Branches: 11 58 19.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 OnePTests
10 * \brief A test problem for the 1p model: A pipe system with circular cross-section
11 * and a branching point embedded in a three-dimensional world
12 */
13
14 #ifndef DUMUX_ONEP_TUBES_TEST_SPATIALPARAMS_HH
15 #define DUMUX_ONEP_TUBES_TEST_SPATIALPARAMS_HH
16
17 #include <dumux/porousmediumflow/properties.hh>
18 #include <dumux/porousmediumflow/fvspatialparams1p.hh>
19
20 namespace Dumux {
21
22 /*!
23 * \ingroup OnePTests
24 * \brief A test problem for the 1p model: A pipe system with circular cross-section
25 * and a branching point embedded in a three-dimensional world
26 */
27 template<class GridGeometry, class Scalar>
28
1/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 12 times.
✗ Branch 5 not taken.
12 class TubesTestSpatialParams
29 : public FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar,
30 TubesTestSpatialParams<GridGeometry, Scalar>>
31 {
32 using FVElementGeometry = typename GridGeometry::LocalView;
33 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
34 using GridView = typename GridGeometry::GridView;
35 using Element = typename GridView::template Codim<0>::Entity;
36
37 using ThisType = TubesTestSpatialParams<GridGeometry, Scalar>;
38 using ParentType = FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar, ThisType>;
39
40 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
41
42 public:
43 // export permeability type
44 using PermeabilityType = Scalar;
45
46 12 TubesTestSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
47
2/6
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 12 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
12 : ParentType(gridGeometry)
48 {
49 12 radius_ = 1.0;
50
51 using std::sqrt;
52 12 radiusMain_ = sqrt(sqrt(4.0/sqrt(3.0)));
53 12 }
54
55 /*!
56 * \brief Returns the radius of the circular pipe for the current
57 * sub-control volume in [m].
58 *
59 * \param scv The sub-control volume
60 */
61 Scalar radius(const SubControlVolume &scv) const
62 {
63
4/34
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5664 times.
✓ Branch 5 taken 39648 times.
✓ Branch 6 taken 5664 times.
✓ Branch 7 taken 39648 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
90624 if(scv.center()[2] > 0.5 - eps_)
64 5664 return radiusMain_;
65 else
66 return radius_;
67 }
68
69 /*!
70 * \brief Function for defining the (intrinsic) permeability \f$[m^2]\f$.
71 *
72 * \param element The element
73 * \param scv The sub-control volume
74 * \param elemSol The element solution vector
75 * \return The intrinsic permeability
76 */
77 template<class ElementSolution>
78 PermeabilityType permeability(const Element& element,
79 const SubControlVolume& scv,
80 const ElementSolution& elemSol) const
81 {
82
2/4
✓ Branch 0 taken 5664 times.
✓ Branch 1 taken 39648 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
45312 const Scalar radius = this->radius(scv);
83 45312 const Scalar gamma = 2; // quadratic velocity profile (Poiseuille flow)
84
2/2
✓ Branch 0 taken 5664 times.
✓ Branch 1 taken 39648 times.
45312 return radius*radius/(2*(2+gamma));
85 }
86
87 /*!
88 * \brief Define the porosity \f$\mathrm{[-]}\f$.
89 *
90 * \param globalPos The global position
91 */
92 Scalar porosityAtPos(const GlobalPosition& globalPos) const
93 { return 1; }
94
95 /*!
96 * \brief Returns how much the domain is extruded at a given sub-control volume.
97 *
98 * This means the factor by which a lower-dimensional (1D or 2D)
99 * entity needs to be expanded to get a full dimensional cell. The
100 * default is 1.0 which means that 1D problems are actually
101 * thought as pipes with a cross section of 1 m^2 and 2D problems
102 * are assumed to extend 1 m to the back.
103 */
104 template<class ElementSolution>
105 Scalar extrusionFactor(const Element &element,
106 const SubControlVolume &scv,
107 const ElementSolution& elemSol) const
108 {
109 const auto radius = this->radius(scv);
110 return M_PI*radius*radius;
111 }
112
113 private:
114 Scalar radius_, radiusMain_;
115 static constexpr Scalar eps_ = 1e-8;
116 };
117
118 } // end namespace Dumux
119
120 #endif
121