GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/test/porenetwork/solidenergy/problem.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 25 25 100.0%
Functions: 1 1 100.0%
Branches: 28 50 56.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 #ifndef DUMUX_TEST_PORENETWORK_SOLID_ENERGY_PROBLEM_HH
8 #define DUMUX_TEST_PORENETWORK_SOLID_ENERGY_PROBLEM_HH
9
10 #include <dumux/common/properties.hh>
11 #include <dumux/common/parameters.hh>
12 #include <dumux/common/boundarytypes.hh>
13 #include <dumux/common/numeqvector.hh>
14 #include <dumux/porousmediumflow/problem.hh>
15
16 namespace Dumux {
17
18 /*!
19 * \brief Heat conduction problem with multiple solid spheres
20 */
21 template <class TypeTag>
22 2 class SolidProblem : public PorousMediumFlowProblem<TypeTag>
23 {
24 using ParentType = PorousMediumFlowProblem<TypeTag>;
25 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
26 using GridView = typename GridGeometry::GridView;
27 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
28 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
29 using NumEqVector = Dumux::NumEqVector<PrimaryVariables>;
30 using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
31 using FVElementGeometry = typename GridGeometry::LocalView;
32 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
33 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
34
35 using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
36
37 using Element = typename GridView::template Codim<0>::Entity;
38 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
39
40 public:
41 template<class SpatialParams>
42 2 SolidProblem(std::shared_ptr<const GridGeometry> gridGeometry,
43 std::shared_ptr<SpatialParams> spatialParams)
44
4/10
✓ 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 11 taken 2 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
8 : ParentType(gridGeometry, spatialParams)
45 {
46
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 problemName_ = getParam<std::string>("Problem.Name");
47
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 initialTemperature_ = getParam<Scalar>("Problem.InitialTemperature");
48
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 temperatureLeft_ = getParam<Scalar>("Problem.LeftTemperature");
49
50
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 leftIndex_ = getParam<int>("Problem.LeftIndex");
51
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 rightIndex_ = getParam<int>("Problem.RightIndex");
52 2 }
53
54 2 const std::string& name() const
55
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 { return problemName_; }
56
57
2/2
✓ Branch 0 taken 14720 times.
✓ Branch 1 taken 14720 times.
29440 BoundaryTypes boundaryTypes(const Element &element, const SubControlVolume& scv) const
58 {
59
2/2
✓ Branch 0 taken 14720 times.
✓ Branch 1 taken 14720 times.
29440 BoundaryTypes values;
60 29440 values.setAllNeumann();
61
62
3/4
✓ Branch 0 taken 14720 times.
✓ Branch 1 taken 14720 times.
✓ Branch 2 taken 14720 times.
✗ Branch 3 not taken.
29440 if (onLeftBoundary_(scv) || onRightBoundary_(scv))
63 values.setAllDirichlet();
64
65 return values;
66 }
67
68 template<class ElementVolumeVariables>
69 NumEqVector source(const Element& element,
70 const FVElementGeometry& fvGeometry,
71 const ElementVolumeVariables& elemVolVars,
72 const SubControlVolume& scv) const
73 {
74 NumEqVector value = 0.0; //isolating boundary condition
75 return value;
76 }
77
78
2/4
✓ Branch 0 taken 14720 times.
✓ Branch 1 taken 14720 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
29440 PrimaryVariables dirichlet(const Element& element, const SubControlVolume& scv) const
79 {
80 29440 auto values = initialAtPos(scv.dofPosition()); //onRightBoundary_(scv)
81
82
2/4
✓ Branch 0 taken 14720 times.
✓ Branch 1 taken 14720 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
29440 if (onLeftBoundary_(scv))
83 {
84 14720 values = temperatureLeft_;
85 }
86
87 return values;
88 }
89
90 29568 PrimaryVariables initialAtPos(const GlobalPosition& pos) const
91 {
92
2/4
✓ Branch 0 taken 14720 times.
✓ Branch 1 taken 14720 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
29568 PrimaryVariables values(initialTemperature_); //uniform initial temperature
93 return values;
94 }
95
96 private:
97
98 58880 bool onLeftBoundary_(const SubControlVolume& scv) const
99
4/6
✓ Branch 0 taken 14720 times.
✓ Branch 1 taken 14720 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14720 times.
✓ Branch 5 taken 14720 times.
58880 { return this->gridGeometry().poreLabel(scv.dofIndex()) == leftIndex_; }
100
101 14720 bool onRightBoundary_(const SubControlVolume& scv) const
102
1/2
✓ Branch 0 taken 14720 times.
✗ Branch 1 not taken.
14720 { return this->gridGeometry().poreLabel(scv.dofIndex()) == rightIndex_; }
103
104 std::string problemName_;
105
106 Scalar initialTemperature_;
107 Scalar temperatureLeft_;
108
109 int leftIndex_;
110 int rightIndex_;
111 };
112
113 } // end namespace Dumux
114
115 #endif
116