GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/multidomain/facet/1pnc_1pnc/problem_facet.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 16 22 72.7%
Functions: 20 44 45.5%
Branches: 17 46 37.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 1pnc facet coupling test.
11 */
12 #ifndef DUMUX_TEST_TPFAFACETCOUPLING_ONEPNC_FACETPROBLEM_HH
13 #define DUMUX_TEST_TPFAFACETCOUPLING_ONEPNC_FACETPROBLEM_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
27 * 1pnc model with coupling across the bulk grid facets.
28 */
29 template<class TypeTag>
30 class OnePNCLowDimProblem : 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 using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
50 using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
51
52 using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
53 static constexpr bool enableHeatConduction = ModelTraits::enableEnergyBalance();
54
55 enum
56 {
57 // indices of the primary variables
58 pressureIdx = Indices::pressureIdx,
59 N2Idx = FluidSystem::compIdx(FluidSystem::MultiPhaseFluidSystem::N2Idx)
60 };
61
62 public:
63 13 OnePNCLowDimProblem(std::shared_ptr<const GridGeometry> gridGeometry,
64 std::shared_ptr<typename ParentType::SpatialParams> spatialParams,
65 std::shared_ptr<CouplingManager> couplingManager,
66 const std::string& paramGroup = "")
67 : ParentType(gridGeometry, spatialParams, paramGroup)
68
4/14
✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 13 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 13 times.
✗ Branch 8 not taken.
✓ Branch 11 taken 13 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.
39 , couplingManagerPtr_(couplingManager)
69 {
70
7/22
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 13 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 13 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 13 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 13 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 13 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 13 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.
13 problemName_ = getParam<std::string>("Vtk.OutputName") + "_" +
71
2/4
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 13 times.
✗ Branch 5 not taken.
26 getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
72 13 }
73
74 //! The problem name.
75 const std::string& name() const
76
1/2
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
13 { return problemName_; }
77
78 //! Specifies the type of boundary condition at a given position.
79 BoundaryTypes boundaryTypesAtPos(const GlobalPosition& globalPos) const
80 {
81 3850 BoundaryTypes values;
82
3/4
✓ Branch 0 taken 450 times.
✓ Branch 1 taken 2660 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 740 times.
3850 values.setAllNeumann();
83 return values;
84 }
85
86 //! Evaluates the source term at a given position.
87 56392 NumEqVector source(const Element& element,
88 const FVElementGeometry& fvGeometry,
89 const ElementVolumeVariables& elemVolVars,
90 const SubControlVolume& scv) const
91 {
92 // evaluate sources from bulk domain
93 112784 auto source = couplingManagerPtr_->evalSourcesFromBulk(element, fvGeometry, elemVolVars, scv);
94 94164 source /= scv.volume()*elemVolVars[scv].extrusionFactor();
95 56392 return source;
96 }
97
98 //! Evaluates the Dirichlet boundary condition for a given position.
99 PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
100 { return initialAtPos(globalPos); }
101
102 //! Evaluates the initial conditions.
103 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
104 {
105 131 PrimaryVariables values;
106 131 values[pressureIdx] = 1.0e5;
107 204 values[N2Idx] = 0.0;
108
109 if constexpr (enableHeatConduction)
110 {
111 174 values[Indices::temperatureIdx] = this->spatialParams().temperatureAtPos(globalPos);
112 }
113
114 return values;
115 }
116
117 //! Returns reference to the coupling manager.
118 const CouplingManager& couplingManager() const
119 { return *couplingManagerPtr_; }
120
121 private:
122 std::shared_ptr<CouplingManager> couplingManagerPtr_;
123 std::string problemName_;
124 };
125
126 } // end namespace Dumux
127
128 #endif
129