GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/multidomain/facet/1p_1p/boundary_coupling/problem_bulk.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 19 25 76.0%
Functions: 6 21 28.6%
Branches: 74 116 63.8%

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 box-facet coupling dof enrichment test.
11 */
12 #ifndef DUMUX_TEST_FACET_BOX_DOF_ENRICHMENT_ONEP_BULKPROBLEM_HH
13 #define DUMUX_TEST_FACET_BOX_DOF_ENRICHMENT_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 4 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 4 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 11 taken 4 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.
12 , couplingManagerPtr_(couplingManager)
59 {
60
7/22
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 4 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.
4 problemName_ = getParam<std::string>("Vtk.OutputName") + "_" +
61
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
8 getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
62 4 }
63
64 //! The problem name.
65 const std::string& name() const
66
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 { return problemName_; }
67
68 //! Specifies the type of boundary condition at a given position.
69 7644 BoundaryTypes boundaryTypesAtPos(const GlobalPosition& globalPos) const
70 {
71
2/2
✓ Branch 0 taken 5448 times.
✓ Branch 1 taken 2196 times.
7644 BoundaryTypes values;
72 7644 values.setAllNeumann();
73 // we actively set Dirichlet BCs on the right center boundary, but these should be ignored
74 // because the lower-dimensional (coupled) domain coincides with that boundary
75
4/4
✓ Branch 0 taken 5448 times.
✓ Branch 1 taken 2196 times.
✓ Branch 2 taken 5448 times.
✓ Branch 3 taken 2196 times.
15288 if (globalPos[0] < 1e-6 || isOnRightCenterBoundary_(globalPos))
76 values.setAllDirichlet();
77 7644 return values;
78 }
79
80 //! Specifies the type of interior boundary condition at a given position.
81 BoundaryTypes interiorBoundaryTypes(const Element& element, const SubControlVolumeFace& scvf) const
82 {
83
3/4
✓ Branch 0 taken 590 times.
✓ Branch 1 taken 4678 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2400 times.
7668 BoundaryTypes values;
84
3/4
✓ Branch 0 taken 590 times.
✓ Branch 1 taken 4678 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2400 times.
7668 values.setAllDirichlet();
85 return values;
86 }
87
88 //! Evaluates the source term at a given position.
89 NumEqVector sourceAtPos(const GlobalPosition& globalPos) const
90
1/4
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 79296 times.
79296 { return NumEqVector(0.0); }
91
92 //! Evaluates the Dirichlet boundary condition for a given position.
93 PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
94 1878 { return initialAtPos(globalPos); }
95
96 //! Evaluates the Neumann boundary condition for a boundary segment.
97 NumEqVector neumannAtPos(const GlobalPosition& globalPos) const
98
2/2
✓ Branch 0 taken 732 times.
✓ Branch 1 taken 936 times.
3516 { return NumEqVector(0.0); }
99
100 //! Evaluates the initial conditions.
101 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
102
1/2
✓ Branch 1 taken 1044 times.
✗ Branch 2 not taken.
1878 { return PrimaryVariables(1.0); }
103
104 //! Returns reference to the coupling manager.
105 const CouplingManager& couplingManager() const
106
26/34
✓ Branch 0 taken 51756 times.
✓ Branch 1 taken 600 times.
✓ Branch 2 taken 51756 times.
✓ Branch 3 taken 600 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8160 times.
✓ Branch 6 taken 3420 times.
✓ Branch 7 taken 227820 times.
✓ Branch 8 taken 11580 times.
✓ Branch 9 taken 227820 times.
✓ Branch 10 taken 33144 times.
✓ Branch 11 taken 7284 times.
✓ Branch 12 taken 33144 times.
✓ Branch 13 taken 480 times.
✓ Branch 14 taken 6804 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 480 times.
✓ Branch 17 taken 33384 times.
✓ Branch 18 taken 480 times.
✓ Branch 19 taken 33384 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 588 times.
✓ Branch 29 taken 49923 times.
✓ Branch 30 taken 588 times.
✓ Branch 31 taken 49923 times.
✓ Branch 32 taken 2940 times.
✓ Branch 33 taken 196104 times.
✓ Branch 34 taken 2940 times.
✓ Branch 35 taken 196104 times.
1240326 { return *couplingManagerPtr_; }
107
108 private:
109 bool isOnRightCenterBoundary_(const GlobalPosition& globalPos) const
110
18/18
✓ Branch 0 taken 1074 times.
✓ Branch 1 taken 4374 times.
✓ Branch 2 taken 1074 times.
✓ Branch 3 taken 4374 times.
✓ Branch 4 taken 1074 times.
✓ Branch 5 taken 4374 times.
✓ Branch 6 taken 1074 times.
✓ Branch 7 taken 4374 times.
✓ Branch 8 taken 1074 times.
✓ Branch 9 taken 4374 times.
✓ Branch 10 taken 978 times.
✓ Branch 11 taken 96 times.
✓ Branch 12 taken 978 times.
✓ Branch 13 taken 96 times.
✓ Branch 14 taken 114 times.
✓ Branch 15 taken 864 times.
✓ Branch 16 taken 114 times.
✓ Branch 17 taken 864 times.
27240 { return globalPos[0] > this->gridGeometry().bBoxMax()[0] - 1e-6 && globalPos[1] > 0.1 && globalPos[1] < 0.9; }
111
112 std::shared_ptr<CouplingManager> couplingManagerPtr_;
113 std::string problemName_;
114 };
115
116 } // end namespace Dumux
117
118 #endif
119