GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/multidomain/facet/1p_1p/linearprofile/problem_lowdim.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 13 18 72.2%
Functions: 8 20 40.0%
Branches: 18 50 36.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-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 #ifndef DUMUX_TEST_TPFAFACETCOUPLING_ONEP_LOWDIMPROBLEM_HH
13 #define DUMUX_TEST_TPFAFACETCOUPLING_ONEP_LOWDIMPROBLEM_HH
14
15 #include <dumux/common/properties.hh>
16 #include <dumux/common/parameters.hh>
17 #include <dumux/common/boundarytypes.hh>
18 #include <dumux/common/numeqvector.hh>
19
20 #include <dumux/porousmediumflow/problem.hh>
21
22 namespace Dumux {
23
24 /*!
25 * \ingroup FacetTests
26 * \brief The lower-dimensional test problem for the incompressible
27 * one-phase model with coupling across the bulk grid facets.
28 */
29 template<class TypeTag>
30 class OnePLowDimProblem : public PorousMediumFlowProblem<TypeTag>
31 {
32 using ParentType = PorousMediumFlowProblem<TypeTag>;
33
34 using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
35 using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView;
36 using PrimaryVariables = typename GridVariables::PrimaryVariables;
37 using Scalar = typename GridVariables::Scalar;
38
39 using GridGeometry = typename GridVariables::GridGeometry;
40 using FVElementGeometry = typename GridGeometry::LocalView;
41 using SubControlVolume = typename GridGeometry::SubControlVolume;
42 using GridView = typename GridGeometry::GridView;
43 using Element = typename GridView::template Codim<0>::Entity;
44 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
45
46 using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
47 using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
48 using NumEqVector = Dumux::NumEqVector<PrimaryVariables>;
49
50 public:
51 6 OnePLowDimProblem(std::shared_ptr<const GridGeometry> gridGeometry,
52 std::shared_ptr<typename ParentType::SpatialParams> spatialParams,
53 std::shared_ptr<CouplingManager> couplingManager,
54 const std::string& paramGroup = "")
55 : ParentType(gridGeometry, spatialParams, paramGroup)
56
4/14
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 11 taken 6 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
18 , couplingManagerPtr_(couplingManager)
57 {
58
7/22
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 6 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 6 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 6 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 6 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
6 problemName_ = getParam<std::string>("Vtk.OutputName") + "_" +
59
2/4
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
12 getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
60 6 }
61
62 //! The problem name.
63 const std::string& name() const
64
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 { return problemName_; }
65
66 //! Specifies the type of boundary condition at a given position.
67 BoundaryTypes boundaryTypesAtPos(const GlobalPosition& globalPos) const
68 {
69
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 36 times.
108 BoundaryTypes values;
70
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 36 times.
108 values.setAllNeumann();
71 return values;
72 }
73
74 //! Evaluates the source term at a given position.
75 1404 NumEqVector source(const Element& element,
76 const FVElementGeometry& fvGeometry,
77 const ElementVolumeVariables& elemVolVars,
78 const SubControlVolume& scv) const
79 {
80 // evaluate sources from bulk domain
81 2808 auto source = couplingManagerPtr_->evalSourcesFromBulk(element, fvGeometry, elemVolVars, scv);
82 1404 source /= scv.volume()*elemVolVars[scv].extrusionFactor();
83 1404 return source;
84 }
85
86 //! Evaluates the Dirichlet boundary condition for a given position.
87 PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
88 { return initialAtPos(globalPos); }
89
90 //! Evaluates the initial conditions.
91 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
92 78 { return PrimaryVariables(1.0); }
93
94 //! Returns reference to the coupling manager.
95 const CouplingManager& couplingManager() const
96 { return *couplingManagerPtr_; }
97
98 private:
99 std::shared_ptr<CouplingManager> couplingManagerPtr_;
100 std::string problemName_;
101 };
102
103 } // end namespace Dumux
104
105 #endif
106