GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/test/porousmediumflow/1p/nonisothermal/simple/problem.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 21 21 100.0%
Functions: 6 6 100.0%
Branches: 16 22 72.7%

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 OnePTests
10 * \brief Test for the OnePModel in combination with the NI model for a conduction problem.
11 *
12 * The simulation domain is a tube with an elevated temperature on the left hand side.
13 */
14
15 #ifndef DUMUX_1PNI_CONDUCTION_PROBLEM_HH
16 #define DUMUX_1PNI_CONDUCTION_PROBLEM_HH
17
18 #include <dumux/common/properties.hh>
19 #include <dumux/common/parameters.hh>
20
21 #include <dumux/common/boundarytypes.hh>
22 #include <dumux/porousmediumflow/problem.hh>
23
24 namespace Dumux {
25
26 /*!
27 * \ingroup OnePTests
28 * \brief Test for the OnePModel in combination with the NI model
29 */
30 template <class TypeTag>
31 2 class OnePNISimpleProblem : public PorousMediumFlowProblem<TypeTag>
32 {
33 using ParentType = PorousMediumFlowProblem<TypeTag>;
34 using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView;
35 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
36 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
37 using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
38 using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
39 using ThermalConductivityModel = GetPropType<TypeTag, Properties::ThermalConductivityModel>;
40 using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>;
41 using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
42 using Element = typename GridView::template Codim<0>::Entity;
43 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
44 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
45 static constexpr int dimWorld = GridView::dimensionworld;
46
47 public:
48 2 OnePNISimpleProblem(std::shared_ptr<const GridGeometry> gridGeometry)
49
3/6
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
6 : ParentType(gridGeometry)
50 {
51
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 name_ = getParam<std::string>("Problem.Name");
52
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 direction_ = getParam<int>("Problem.Direction");
53 2 }
54
55 2 const std::string& name() const
56
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 { return name_; }
57
58
59 18524 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
60 {
61 18524 BoundaryTypes bcTypes;
62
63
4/4
✓ Branch 0 taken 18254 times.
✓ Branch 1 taken 270 times.
✓ Branch 2 taken 17984 times.
✓ Branch 3 taken 540 times.
37048 if (globalPos[direction_] < this->gridGeometry().bBoxMin()[direction_] + eps_
64
4/4
✓ Branch 0 taken 18254 times.
✓ Branch 1 taken 270 times.
✓ Branch 2 taken 270 times.
✓ Branch 3 taken 17984 times.
18524 || globalPos[direction_] > this->gridGeometry().bBoxMax()[direction_] - eps_)
65 18524 bcTypes.setAllDirichlet();
66 else
67 18524 bcTypes.setAllNeumann();
68
69 18524 return bcTypes;
70 }
71
72 5962 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
73 {
74
2/2
✓ Branch 0 taken 136 times.
✓ Branch 1 taken 5826 times.
5962 if (globalPos[direction_] < this->gridGeometry().bBoxMin()[direction_] + eps_)
75 136 return {0, 0.0};
76 else
77 5826 return {1e5, 0.0};
78 }
79
80 5710 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
81 5710 { return dirichletAtPos(globalPos); }
82
83 private:
84 static constexpr Scalar eps_ = 1e-6;
85 std::string name_;
86 int direction_;
87 };
88
89 } // end namespace Dumux
90
91 #endif
92