GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/multidomain/facet/1p_1p/boundary_coupling/problem_lowdim.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 15 19 78.9%
Functions: 6 15 40.0%
Branches: 32 66 48.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 box-facet coupling dof enrichment test.
11 */
12 #ifndef DUMUX_TEST_FACET_BOX_DOF_ENRICHMENT_ONEP_LOWDIMPROBLEM_HH
13 #define DUMUX_TEST_FACET_BOX_DOF_ENRICHMENT_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 static constexpr int dimWorld = GridView::dimensionworld;
51
52 public:
53 4 OnePLowDimProblem(std::shared_ptr<const GridGeometry> gridGeometry,
54 std::shared_ptr<typename ParentType::SpatialParams> spatialParams,
55 std::shared_ptr<CouplingManager> couplingManager,
56 const std::string& paramGroup = "")
57 : ParentType(gridGeometry, spatialParams, paramGroup)
58
4/14
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 11 taken 4 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.
12 , couplingManagerPtr_(couplingManager)
59 {
60
7/22
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 4 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.
4 problemName_ = getParam<std::string>("Vtk.OutputName") + "_" +
61
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
8 getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
62 4 }
63
64 //! The problem name.
65 const std::string& name() const
66
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 { return problemName_; }
67
68 //! Specifies the type of boundary condition at a given position.
69 BoundaryTypes boundaryTypesAtPos(const GlobalPosition& globalPos) const
70 {
71
6/8
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 12 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
48 BoundaryTypes values;
72 48 values.setAllNeumann();
73
12/16
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 12 times.
✓ Branch 5 taken 12 times.
✓ Branch 6 taken 12 times.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 6 times.
✓ Branch 9 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 6 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
96 if (globalPos[1] < 1e-6)
74 values.setAllDirichlet();
75 return values;
76 }
77
78 //! Evaluates the source term at a given position.
79 960 NumEqVector source(const Element& element,
80 const FVElementGeometry& fvGeometry,
81 const ElementVolumeVariables& elemVolVars,
82 const SubControlVolume& scv) const
83 {
84 // evaluate sources from bulk domain
85 1920 auto source = couplingManagerPtr_->evalSourcesFromBulk(element, fvGeometry, elemVolVars, scv);
86 2400 source /= scv.volume()*elemVolVars[scv].extrusionFactor();
87 960 return source;
88 }
89
90 //! Evaluates the Dirichlet boundary condition for a given position.
91 PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
92 12 { return initialAtPos(globalPos); }
93
94 //! Evaluates the initial conditions.
95 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
96 54 { return PrimaryVariables(2.0); }
97
98 //! Returns reference to the coupling manager.
99 const CouplingManager& couplingManager() const
100 { return *couplingManagerPtr_; }
101
102 private:
103 std::shared_ptr<CouplingManager> couplingManagerPtr_;
104 std::string problemName_;
105 };
106
107 } // end namespace Dumux
108
109 #endif
110