GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/multidomain/boundary/freeflowporenetwork/1p_1p/problem_pnm.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 22 22 100.0%
Functions: 5 5 100.0%
Branches: 43 78 55.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 BoundaryTests
10 * \brief Pore-network sub-problem for the coupled 1p_1p free-flow/pore-network-model test
11 */
12
13 #ifndef DUMUX_TEST_MULTIDOMAIN_BOUNDARY_FREEFLOW_PORE_NETWORK_PROBLEM_PNM_HH
14 #define DUMUX_TEST_MULTIDOMAIN_BOUNDARY_FREEFLOW_PORE_NETWORK_PROBLEM_PNM_HH
15
16 #include <dumux/common/boundarytypes.hh>
17 #include <dumux/common/numeqvector.hh>
18 #include <dumux/common/properties.hh>
19 #include <dumux/common/parameters.hh>
20 #include <dumux/porousmediumflow/problem.hh>
21
22 namespace Dumux {
23
24 /*!
25 * \ingroup BoundaryTests
26 * \brief Pore-network sub-problem for the coupled 1p_1p free-flow/pore-network-model test
27 * A two-dimensional pore-network region coupled to a free-flow model.
28 */
29 template <class TypeTag>
30 class PNMOnePProblem : public PorousMediumFlowProblem<TypeTag>
31 {
32 using ParentType = PorousMediumFlowProblem<TypeTag>;
33 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
34 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
35 using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
36 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
37 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
38 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
39 using Element = typename GridGeometry::GridView::template Codim<0>::Entity;
40
41 using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
42
43 public:
44 template<class SpatialParams>
45 2 PNMOnePProblem(std::shared_ptr<const GridGeometry> gridGeometry,
46 std::shared_ptr<SpatialParams> spatialParams,
47 std::shared_ptr<CouplingManager> couplingManager)
48
6/18
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 2 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
8 : ParentType(gridGeometry, spatialParams, "PNM"), couplingManager_(couplingManager)
49 {
50
2/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
4 singleThroatTest_ = getParamFromGroup<bool>(this->paramGroup(), "Problem.SingleThroatTest", true);
51 2 }
52
53 /*!
54 * \name Simulation steering
55 */
56 // \{
57
58 /*!
59 * \name Problem parameters
60 */
61 // \{
62
63 2 const std::string& name() const
64 {
65
10/26
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 2 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 2 times.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 2 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 2 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 2 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
2 static const std::string problemName = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
66 2 return problemName;
67 }
68
69 // \}
70
71 /*!
72 * \name Boundary conditions
73 */
74 // \{
75
76 /*!
77 * \brief Specifies which kind of boundary condition should be used for
78 * which equation for a finite volume on the boundary.
79 */
80 58 BoundaryTypes boundaryTypes(const Element& element, const SubControlVolume& scv) const
81 {
82
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 44 times.
58 BoundaryTypes bcTypes;
83
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 44 times.
58 if (couplingManager().isCoupled(CouplingManager::poreNetworkIndex, CouplingManager::freeFlowMassIndex, scv))
84 bcTypes.setAllCouplingNeumann();
85
86
4/4
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 48 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 5 times.
58 if (singleThroatTest_ && scv.dofIndex() == 0)
87 bcTypes.setAllDirichlet();
88
89 58 return bcTypes;
90 }
91
92 /*!
93 * \brief Evaluate the boundary conditions for a dirichlet
94 * control volume.
95 */
96 3 PrimaryVariables dirichlet(const Element& element,
97 const SubControlVolume& scv) const
98 {
99
5/8
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
3 static const Scalar pressureBottom = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.PressureBottom", 10.0);
100 6 return PrimaryVariables(pressureBottom);
101 }
102
103 // \}
104
105 /*!
106 * \name Volume terms
107 */
108 // \{
109
110 /*!
111 * \brief Evaluate the source term for all phases within a given
112 * sub-control-volume.
113 *
114 * This is the method for the case where the source term is
115 * potentially solution dependent and requires some quantities that
116 * are specific to the fully-implicit method.
117 *
118 * \param element The finite element
119 * \param fvGeometry The finite-volume geometry
120 * \param elemVolVars All volume variables for the element
121 * \param scv The sub control volume
122 *
123 * For this method, the return parameter stores the conserved quantity rate
124 * generated or annihilate per volume unit. Positive values mean
125 * that the conserved quantity is created, negative ones mean that it vanishes.
126 * E.g. for the mass balance that would be a mass rate in \f$ [ kg / (m^3 \cdot s)] \f$.
127 */
128 template<class ElementVolumeVariables>
129 430 PrimaryVariables source(const Element &element,
130 const FVElementGeometry& fvGeometry,
131 const ElementVolumeVariables& elemVolVars,
132 const SubControlVolume &scv) const
133 {
134
2/2
✓ Branch 0 taken 168 times.
✓ Branch 1 taken 262 times.
430 PrimaryVariables values(0.0);
135
136
2/2
✓ Branch 0 taken 168 times.
✓ Branch 1 taken 262 times.
430 if (couplingManager().isCoupled(CouplingManager::poreNetworkIndex, CouplingManager::freeFlowMassIndex, scv))
137 {
138 168 values = couplingManager().massCouplingCondition(
139 CouplingManager::poreNetworkIndex,
140 CouplingManager::freeFlowMassIndex, fvGeometry,
141 scv,
142 504 elemVolVars) / this->gridGeometry().poreVolume(scv.dofIndex());
143 }
144
145 430 return values;
146 }
147
148 // \}
149
150 // \}
151
152 //! Set the coupling manager
153 void setCouplingManager(std::shared_ptr<CouplingManager> cm)
154 { couplingManager_ = cm; }
155
156 //! Get the coupling manager
157 const CouplingManager& couplingManager() const
158
8/8
✓ Branch 0 taken 168 times.
✓ Branch 1 taken 262 times.
✓ Branch 2 taken 168 times.
✓ Branch 3 taken 262 times.
✓ Branch 6 taken 14 times.
✓ Branch 7 taken 44 times.
✓ Branch 8 taken 14 times.
✓ Branch 9 taken 44 times.
976 { return *couplingManager_; }
159
160 private:
161 std::shared_ptr<CouplingManager> couplingManager_;
162 bool singleThroatTest_;
163 };
164
165 } // end namespace Dumux
166
167 #endif
168