GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/multidomain/facet/1p_1p/gravity/problem_bulk.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 18 22 81.8%
Functions: 4 16 25.0%
Branches: 119 180 66.1%

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 FacetTests
10 * \brief The problem for the bulk domain in the single-phase facet coupling test.
11 */
12 #ifndef DUMUX_TEST_TPFAFACETCOUPLING_ONEP_BULKPROBLEM_HH
13 #define DUMUX_TEST_TPFAFACETCOUPLING_ONEP_BULKPROBLEM_HH
14
15 #include <dumux/common/properties.hh>
16 #include <dumux/common/parameters.hh>
17 #include <dumux/common/boundarytypes.hh>
18 #include <dumux/common/numeqvector.hh>
19
20 #include <dumux/porousmediumflow/problem.hh>
21
22 namespace Dumux {
23
24 /*!
25 * \ingroup FacetTests
26 * \brief Test problem for the incompressible one-phase model
27 * with coupling across the bulk grid facets.
28 */
29 template<class TypeTag>
30 class OnePBulkProblem : public PorousMediumFlowProblem<TypeTag>
31 {
32 using ParentType = PorousMediumFlowProblem<TypeTag>;
33
34 using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
35 using PrimaryVariables = typename GridVariables::PrimaryVariables;
36 using Scalar = typename GridVariables::Scalar;
37
38 using GridGeometry = typename GridVariables::GridGeometry;
39 using FVElementGeometry = typename GridGeometry::LocalView;
40 using SubControlVolume = typename GridGeometry::SubControlVolume;
41 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
42 using GridView = typename GridGeometry::GridView;
43 using Element = typename GridView::template Codim<0>::Entity;
44 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
45
46 using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
47 using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
48 using NumEqVector = Dumux::NumEqVector<PrimaryVariables>;
49
50 static constexpr int dimWorld = GridView::dimensionworld;
51
52 public:
53 6 OnePBulkProblem(std::shared_ptr<const GridGeometry> gridGeometry,
54 std::shared_ptr<typename ParentType::SpatialParams> spatialParams,
55 std::shared_ptr<CouplingManager> couplingManager,
56 const std::string& paramGroup = "")
57 : ParentType(gridGeometry, spatialParams, paramGroup)
58
4/14
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 11 taken 6 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
18 , couplingManagerPtr_(couplingManager)
59 {
60
7/22
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 6 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 6 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 6 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 6 times.
✗ 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.
6 problemName_ = getParam<std::string>("Vtk.OutputName") + "_" +
61
2/4
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
12 getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
62 6 }
63
64 //! The problem name.
65 const std::string& name() const
66
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 { return problemName_; }
67
68 //! Specifies the type of boundary condition at a given position.
69 BoundaryTypes boundaryTypesAtPos(const GlobalPosition& globalPos) const
70 {
71
8/10
✓ Branch 0 taken 7356 times.
✓ Branch 1 taken 1020 times.
✓ Branch 2 taken 11058 times.
✓ Branch 3 taken 1542 times.
✓ Branch 4 taken 4932 times.
✓ Branch 5 taken 684 times.
✓ Branch 6 taken 2484 times.
✓ Branch 7 taken 348 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
29424 BoundaryTypes values;
72 29424 values.setAllNeumann();
73
56/70
✓ Branch 0 taken 7356 times.
✓ Branch 1 taken 1020 times.
✓ Branch 2 taken 7356 times.
✓ Branch 3 taken 1020 times.
✓ Branch 4 taken 6336 times.
✓ Branch 5 taken 1020 times.
✓ Branch 6 taken 6336 times.
✓ Branch 7 taken 1020 times.
✓ Branch 8 taken 6336 times.
✓ Branch 9 taken 1020 times.
✓ Branch 10 taken 6336 times.
✓ Branch 11 taken 1020 times.
✓ Branch 12 taken 6336 times.
✓ Branch 13 taken 1020 times.
✓ Branch 14 taken 11058 times.
✓ Branch 15 taken 1542 times.
✓ Branch 16 taken 11058 times.
✓ Branch 17 taken 1542 times.
✓ Branch 18 taken 9516 times.
✓ Branch 19 taken 1542 times.
✓ Branch 20 taken 9516 times.
✓ Branch 21 taken 1542 times.
✓ Branch 22 taken 9516 times.
✓ Branch 23 taken 1542 times.
✓ Branch 24 taken 9516 times.
✓ Branch 25 taken 1542 times.
✓ Branch 26 taken 9516 times.
✓ Branch 27 taken 1542 times.
✓ Branch 28 taken 4932 times.
✓ Branch 29 taken 684 times.
✓ Branch 30 taken 4932 times.
✓ Branch 31 taken 684 times.
✓ Branch 32 taken 4248 times.
✓ Branch 33 taken 684 times.
✓ Branch 34 taken 4248 times.
✓ Branch 35 taken 684 times.
✓ Branch 36 taken 4248 times.
✓ Branch 37 taken 684 times.
✓ Branch 38 taken 4248 times.
✓ Branch 39 taken 684 times.
✓ Branch 40 taken 4248 times.
✓ Branch 41 taken 684 times.
✓ Branch 42 taken 2484 times.
✓ Branch 43 taken 348 times.
✓ Branch 44 taken 2484 times.
✓ Branch 45 taken 348 times.
✓ Branch 46 taken 2136 times.
✓ Branch 47 taken 348 times.
✓ Branch 48 taken 2136 times.
✓ Branch 49 taken 348 times.
✓ Branch 50 taken 2136 times.
✓ Branch 51 taken 348 times.
✓ Branch 52 taken 2136 times.
✓ Branch 53 taken 348 times.
✓ Branch 54 taken 2136 times.
✓ Branch 55 taken 348 times.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
58848 if (globalPos[1] < 1e-6 || globalPos[1] > this->gridGeometry().bBoxMax()[1] - 1e-6)
74 values.setAllDirichlet();
75 return values;
76 }
77
78 //! Specifies the type of interior boundary condition at a given position.
79 BoundaryTypes interiorBoundaryTypes(const Element& element, const SubControlVolumeFace& scvf) const
80 {
81
3/4
✓ Branch 0 taken 5916 times.
✓ Branch 1 taken 2052 times.
✓ Branch 2 taken 4176 times.
✗ Branch 3 not taken.
12144 BoundaryTypes values;
82
3/4
✓ Branch 0 taken 5916 times.
✓ Branch 1 taken 2052 times.
✓ Branch 2 taken 4176 times.
✗ Branch 3 not taken.
12144 values.setAllNeumann();
83 return values;
84 }
85
86 //! Evaluates the source term at a given position.
87 NumEqVector sourceAtPos(const GlobalPosition& globalPos) const
88
1/4
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 61248 times.
61248 { return NumEqVector(0.0); }
89
90 //! Evaluates the Dirichlet boundary condition for a given position.
91 PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
92 4776 { return initialAtPos(globalPos); }
93
94 //! Evaluates the Neumann boundary condition for a boundary segment.
95 NumEqVector neumannAtPos(const GlobalPosition& globalPos) const
96
2/2
✓ Branch 0 taken 6384 times.
✓ Branch 1 taken 4176 times.
10560 { return NumEqVector(0.0); }
97
98 //! Evaluates the initial conditions.
99 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
100 {
101
3/6
✓ Branch 1 taken 1344 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1344 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1344 times.
✗ Branch 8 not taken.
53100 const auto g = this->spatialParams().gravity(globalPos)[dimWorld-1];
102
1/2
✓ Branch 1 taken 1344 times.
✗ Branch 2 not taken.
17700 const auto h = 1.0 - (3.0-globalPos[dimWorld-1])*g;
103
1/2
✓ Branch 1 taken 1344 times.
✗ Branch 2 not taken.
17700 return PrimaryVariables(h);
104 }
105
106 //! Returns reference to the coupling manager.
107 const CouplingManager& couplingManager() const
108
27/34
✓ Branch 0 taken 372540 times.
✓ Branch 1 taken 55812 times.
✓ Branch 2 taken 372540 times.
✓ Branch 3 taken 5916 times.
✓ Branch 4 taken 49896 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 23976 times.
✓ Branch 7 taken 1185096 times.
✓ Branch 8 taken 23976 times.
✓ Branch 9 taken 1185096 times.
✓ Branch 10 taken 238680 times.
✓ Branch 11 taken 29124 times.
✓ Branch 12 taken 238680 times.
✓ Branch 13 taken 4176 times.
✓ Branch 14 taken 24948 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 4176 times.
✓ Branch 17 taken 290688 times.
✓ Branch 18 taken 4176 times.
✓ Branch 19 taken 240792 times.
✓ Branch 20 taken 49896 times.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 2052 times.
✓ Branch 29 taken 242892 times.
✓ Branch 30 taken 2052 times.
✓ Branch 31 taken 242892 times.
✓ Branch 32 taken 19800 times.
✓ Branch 33 taken 954864 times.
✓ Branch 34 taken 19800 times.
✓ Branch 35 taken 954864 times.
6859584 { return *couplingManagerPtr_; }
109
110 private:
111 std::shared_ptr<CouplingManager> couplingManagerPtr_;
112 std::string problemName_;
113 };
114
115 } // end namespace Dumux
116
117 #endif
118