GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/test/multidomain/facet/1p_1p/threedomain/problem_bulk.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 19 19 100.0%
Functions: 2 2 100.0%
Branches: 45 60 75.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-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 FacetTests
10 * \brief The problem for the bulk domain in the single-phase facet coupling test.
11 */
12
13 #ifndef DUMUX_TEST_FACETCOUPLING_THREEDOMAIN_ONEP_BULKPROBLEM_HH
14 #define DUMUX_TEST_FACETCOUPLING_THREEDOMAIN_ONEP_BULKPROBLEM_HH
15
16 #include <dumux/common/boundarytypes.hh>
17 #include <dumux/common/numeqvector.hh>
18
19 #include <dumux/porousmediumflow/problem.hh>
20
21 namespace Dumux {
22
23 /*!
24 * \ingroup FacetTests
25 * \brief Test problem for the incompressible one-phase model
26 * with coupling across the bulk grid facets.
27 */
28 template<class TypeTag>
29 class OnePBulkProblem : public PorousMediumFlowProblem<TypeTag>
30 {
31 using ParentType = PorousMediumFlowProblem<TypeTag>;
32 using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
33 using PrimaryVariables = typename GridVariables::PrimaryVariables;
34 using NumEqVector = Dumux::NumEqVector<PrimaryVariables>;
35 using Scalar = typename GridVariables::Scalar;
36
37 using GridGeometry = typename GridVariables::GridGeometry;
38 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
39 using GridView = typename GridGeometry::GridView;
40 using Element = typename GridView::template Codim<0>::Entity;
41 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
42
43 using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
44 using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
45
46 public:
47 //! The constructor
48 2 OnePBulkProblem(std::shared_ptr<const GridGeometry> gridGeometry,
49 std::shared_ptr<typename ParentType::SpatialParams> spatialParams,
50 std::shared_ptr<CouplingManager> couplingManagerPtr,
51 const std::string& paramGroup = "Bulk")
52 : ParentType(gridGeometry, spatialParams, paramGroup)
53
3/8
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
6 , couplingManagerPtr_(couplingManagerPtr)
54 {
55
3/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
4 problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
56 2 }
57
58 /*!
59 * \brief The problem name.
60 */
61 const std::string& name() const
62 {
63
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 return problemName_;
64 }
65
66 //! Specifies the kind of boundary condition on a given boundary position.
67
4/4
✓ Branch 0 taken 15376 times.
✓ Branch 1 taken 3376 times.
✓ Branch 2 taken 1860 times.
✓ Branch 3 taken 372 times.
20984 BoundaryTypes boundaryTypesAtPos(const GlobalPosition& globalPos) const
68 {
69
4/4
✓ Branch 0 taken 15376 times.
✓ Branch 1 taken 3376 times.
✓ Branch 2 taken 1860 times.
✓ Branch 3 taken 372 times.
20984 BoundaryTypes values;
70
4/4
✓ Branch 0 taken 15376 times.
✓ Branch 1 taken 3376 times.
✓ Branch 2 taken 1860 times.
✓ Branch 3 taken 372 times.
20984 values.setAllNeumann();
71
8/8
✓ Branch 0 taken 15376 times.
✓ Branch 1 taken 3376 times.
✓ Branch 2 taken 3376 times.
✓ Branch 3 taken 12000 times.
✓ Branch 4 taken 1860 times.
✓ Branch 5 taken 372 times.
✓ Branch 6 taken 372 times.
✓ Branch 7 taken 1488 times.
20984 if (globalPos[1] < this->gridGeometry().bBoxMin()[1] + 1e-6 || globalPos[1] > this->gridGeometry().bBoxMax()[1] - 1e-6)
72 values.setAllDirichlet();
73 return values;
74 }
75
76 /*!
77 * \brief Specifies which kind of interior boundary condition should be
78 * used for which equation on a given sub-control volume face
79 * that couples to a facet element.
80 *
81 * \param element The finite element the scvf is embedded in
82 * \param scvf The sub-control volume face
83 */
84
3/4
✓ Branch 0 taken 11089 times.
✓ Branch 1 taken 61055 times.
✓ Branch 2 taken 22368 times.
✗ Branch 3 not taken.
94512 BoundaryTypes interiorBoundaryTypes(const Element& element, const SubControlVolumeFace& scvf) const
85 {
86
3/4
✓ Branch 0 taken 11089 times.
✓ Branch 1 taken 61055 times.
✓ Branch 2 taken 22368 times.
✗ Branch 3 not taken.
94512 BoundaryTypes values;
87 values.setAllNeumann();
88 return values;
89 }
90
91 //! Evaluates the Dirichlet boundary conditions at a given position.
92
1/2
✓ Branch 1 taken 744 times.
✗ Branch 2 not taken.
6008 PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
93 {
94 6008 const auto y = globalPos[1];
95
1/2
✓ Branch 1 taken 744 times.
✗ Branch 2 not taken.
6008 const auto yMin = this->gridGeometry().bBoxMin()[1];
96
1/2
✓ Branch 1 taken 744 times.
✗ Branch 2 not taken.
6008 const auto yMax = this->gridGeometry().bBoxMax()[1];
97
98
1/2
✓ Branch 1 taken 744 times.
✗ Branch 2 not taken.
6008 return PrimaryVariables( {2.0 - (y-yMin)/(yMax-yMin)} );
99 }
100
101 //! Evaluates the initial conditions.
102 2486 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
103 { return PrimaryVariables(1.0); }
104
105 //! Returns const reference to the coupling manager.
106 603312 const CouplingManager& couplingManager() const
107
8/8
✓ Branch 0 taken 188208 times.
✓ Branch 1 taken 11088 times.
✓ Branch 3 taken 6336 times.
✓ Branch 4 taken 82944 times.
✓ Branch 5 taken 82944 times.
✓ Branch 6 taken 6336 times.
✓ Branch 8 taken 6336 times.
✓ Branch 9 taken 85920 times.
609648 { return *couplingManagerPtr_; }
108
109 private:
110 std::string problemName_;
111 std::shared_ptr<CouplingManager> couplingManagerPtr_;
112 };
113
114 } // end namespace Dumux
115
116 #endif
117