GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/multidomain/poromechanics/el1p/problem_1p.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 14 18 77.8%
Functions: 2 5 40.0%
Branches: 38 70 54.3%

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 PoromechanicsTests
10 * \brief Definition of the spatial parameters for the single-phase flow
11 * sub-problem in the coupled poro-mechanical el1p problem.
12 */
13 #ifndef DUMUX_1P_SUB_PROBLEM_HH
14 #define DUMUX_1P_SUB_PROBLEM_HH
15
16 #include <dumux/common/properties.hh>
17 #include <dumux/common/parameters.hh>
18 #include <dumux/common/boundarytypes.hh>
19 #include <dumux/common/numeqvector.hh>
20
21 #include <dumux/porousmediumflow/problem.hh>
22
23 namespace Dumux {
24
25 /*!
26 * \ingroup PoromechanicsTests
27 * \brief The single-phase sub problem in the el1p coupled problem.
28 */
29 template <class TypeTag>
30 class OnePSubProblem : public PorousMediumFlowProblem<TypeTag>
31 {
32 using ParentType = PorousMediumFlowProblem<TypeTag>;
33
34 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
35 using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView;
36 using Element = typename GridView::template Codim<0>::Entity;
37 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
38
39 // copy pressure index for convenience
40 enum { pressureIdx = GetPropType<TypeTag, Properties::ModelTraits>::Indices::pressureIdx };
41
42 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
43 using NumEqVector = Dumux::NumEqVector<PrimaryVariables>;
44 using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
45 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
46
47 public:
48 1 OnePSubProblem(std::shared_ptr<const GridGeometry> gridGeometry,
49 std::shared_ptr<GetPropType<TypeTag, Properties::SpatialParams>> spatialParams,
50 const std::string& paramGroup = "OneP")
51
4/12
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
3 : ParentType(gridGeometry, spatialParams, paramGroup)
52 {
53
9/26
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
2 problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
54 1 }
55
56 /*!
57 * \brief The problem name.
58 */
59 const std::string& name() const
60 {
61
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 return problemName_;
62 }
63
64 //! Evaluates the boundary conditions for a Dirichlet boundary segment.
65 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
66 3576 { return initialAtPos(globalPos); }
67
68 //! Evaluates the initial value for a control volume.
69 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
70 3676 { return PrimaryVariables(1.0e5); }
71
72 //! Evaluates source terms.
73 10680 NumEqVector sourceAtPos(const GlobalPosition& globalPos) const
74 {
75
4/6
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 10679 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
10680 static const Scalar source = getParam<Scalar>("Problem.InjectionRate");
76
16/16
✓ Branch 0 taken 6444 times.
✓ Branch 1 taken 4236 times.
✓ Branch 2 taken 6444 times.
✓ Branch 3 taken 4236 times.
✓ Branch 4 taken 2208 times.
✓ Branch 5 taken 4236 times.
✓ Branch 6 taken 2208 times.
✓ Branch 7 taken 4236 times.
✓ Branch 8 taken 1332 times.
✓ Branch 9 taken 876 times.
✓ Branch 10 taken 1332 times.
✓ Branch 11 taken 876 times.
✓ Branch 12 taken 456 times.
✓ Branch 13 taken 876 times.
✓ Branch 14 taken 456 times.
✓ Branch 15 taken 876 times.
21360 if (globalPos[0] > 0.4 && globalPos[0] < 0.6 && globalPos[1] < 0.6 && globalPos[1] > 0.4)
77 912 return NumEqVector(source);
78 10224 return NumEqVector(0.0);
79 }
80
81 /*!
82 * \brief Specifies which kind of boundary condition should be
83 * used for which equation on a given boundary segment.
84 *
85 * \param globalPos The global position
86 */
87 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
88 {
89
2/4
✓ Branch 0 taken 3696 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3576 times.
✗ Branch 3 not taken.
7272 BoundaryTypes values;
90
2/4
✓ Branch 0 taken 3696 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3576 times.
✗ Branch 3 not taken.
7272 values.setAllDirichlet();
91 return values;
92 }
93
94 private:
95 static constexpr Scalar eps_ = 1.0e-6;
96 std::string problemName_;
97 };
98
99 } // end namespace Dumux
100
101 #endif
102