GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/multidomain/facet/1p_1p/analytical/problem_lowdim.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 13 21 61.9%
Functions: 4 12 33.3%
Branches: 19 52 36.5%

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 FacetTests
10 * \brief The problem for the lower-dimensional domain in the single-phase facet coupling test.
11 */
12
13 #ifndef DUMUX_TEST_TPFAFACETCOUPLING_ONEP_LOWDIMPROBLEM_HH
14 #define DUMUX_TEST_TPFAFACETCOUPLING_ONEP_LOWDIMPROBLEM_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 FacetTests
27 * \brief The lower-dimensional test problem for the incompressible
28 * one-phase model with coupling across the bulk grid facets.
29 */
30 template<class TypeTag>
31 class OnePLowDimProblem : public PorousMediumFlowProblem<TypeTag>
32 {
33 using ParentType = PorousMediumFlowProblem<TypeTag>;
34
35 using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
36 using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView;
37 using PrimaryVariables = typename GridVariables::PrimaryVariables;
38 using Scalar = typename GridVariables::Scalar;
39
40 using GridGeometry = typename GridVariables::GridGeometry;
41 using FVElementGeometry = typename GridGeometry::LocalView;
42 using SubControlVolume = typename GridGeometry::SubControlVolume;
43 using GridView = typename GridGeometry::GridView;
44 using Element = typename GridView::template Codim<0>::Entity;
45 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
46
47 using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
48 using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
49 using NumEqVector = Dumux::NumEqVector<PrimaryVariables>;
50
51 public:
52 20 OnePLowDimProblem(std::shared_ptr<const GridGeometry> gridGeometry,
53 std::shared_ptr<typename ParentType::SpatialParams> spatialParams,
54 std::shared_ptr<CouplingManager> couplingManagerPtr,
55 const std::string& paramGroup = "LowDim")
56 : ParentType(gridGeometry, spatialParams, paramGroup)
57 , couplingManagerPtr_(couplingManagerPtr)
58
5/16
✓ Branch 3 taken 20 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 20 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✓ Branch 11 taken 20 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 20 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
60 , aperture_(getParamFromGroup<Scalar>(paramGroup, "SpatialParams.Aperture"))
59 {
60
9/26
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 20 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 20 times.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 20 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 20 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 20 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 20 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.
40 problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
61 20 }
62
63 /*!
64 * \brief The problem name.
65 */
66 const std::string& name() const
67 {
68
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
20 return problemName_;
69 }
70
71 //! Specifies the type of boundary condition at a given position.
72 BoundaryTypes boundaryTypesAtPos(const GlobalPosition& globalPos) const
73 {
74
2/4
✓ Branch 0 taken 120 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
160 BoundaryTypes values;
75
2/4
✓ Branch 0 taken 120 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
160 values.setAllDirichlet();
76 return values;
77 }
78
79 //! Evaluates the source term at a given position.
80 8800 NumEqVector source(const Element& element,
81 const FVElementGeometry& fvGeometry,
82 const ElementVolumeVariables& elemVolVars,
83 const SubControlVolume& scv) const
84 {
85 // evaluate sources from bulk domain
86 17600 auto source = couplingManagerPtr_->evalSourcesFromBulk(element, fvGeometry, elemVolVars, scv);
87 22000 source /= scv.volume()*elemVolVars[scv].extrusionFactor();
88 8800 return source;
89 }
90
91 //! Evaluates the exact solution at a given position.
92 Scalar exact(const GlobalPosition& globalPos) const
93 {
94 using std::cos;
95 using std::cosh;
96
97 const auto x = globalPos[0];
98 const auto y = globalPos[1];
99
100 return cos(x)*cosh(y);
101 }
102
103 //! Evaluates the Dirichlet boundary condition for a given position.
104 PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
105 80 { return PrimaryVariables(exact(globalPos)); }
106
107 //! Evaluates the initial conditions.
108 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
109 560 { return PrimaryVariables(1.0); }
110
111 //! Returns reference to the coupling manager.
112 const CouplingManager& couplingManager() const
113 { return *couplingManagerPtr_; }
114
115 private:
116 std::shared_ptr<CouplingManager> couplingManagerPtr_;
117 Scalar aperture_;
118 std::string problemName_;
119 };
120
121 } // end namespace Dumux
122
123 #endif
124