GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/2p1c/problem.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 23 25 92.0%
Functions: 4 8 50.0%
Branches: 46 72 63.9%

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 TwoPOneCTests
10 * \brief Non-isothermal steam injection test problem for the 2p1cni model.
11 */
12
13 #ifndef DUMUX_STEAM_INJECTIONPROBLEM_HH
14 #define DUMUX_STEAM_INJECTIONPROBLEM_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 TwoPOneCTests
27 * \brief Non-isothermal 2D problem where steam is injected on the lower left side of the domain.
28 *
29 */
30 template <class TypeTag>
31 4 class InjectionProblem : public PorousMediumFlowProblem<TypeTag>
32 {
33 using ParentType = PorousMediumFlowProblem<TypeTag>;
34
35 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
36 using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
37 using Indices = typename ModelTraits::Indices;
38 using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
39 using BoundaryTypes = Dumux::BoundaryTypes<ModelTraits::numEq()>;
40
41 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
42 using NumEqVector = Dumux::NumEqVector<PrimaryVariables>;
43
44 using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
45 using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView;
46 using ElementFluxVariablesCache = typename GridVariables::GridFluxVariablesCache::LocalView;
47
48 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
49 using FVElementGeometry = typename GridGeometry::LocalView;
50 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
51 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
52 using GridView = typename GridGeometry::GridView;
53 using Element = typename GridView::template Codim<0>::Entity;
54
55 // copy some indices for convenience
56 enum {
57 pressureIdx = Indices::pressureIdx,
58 switchIdx = Indices::switchIdx,
59
60 conti0EqIdx = Indices::conti0EqIdx,
61 energyEqIdx = Indices::energyEqIdx,
62
63 // phase state
64 liquidPhaseOnly = Indices::liquidPhaseOnly
65 };
66
67 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
68
69 public:
70 4 InjectionProblem(std::shared_ptr<const GridGeometry> gridGeometry)
71
6/16
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 4 times.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
12 : ParentType(gridGeometry)
72
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 { FluidSystem::init(); }
73
74
75 //! \copydoc Dumux::FVProblem::source()
76 NumEqVector source(const Element &element,
77 const FVElementGeometry& fvGeometry,
78 const ElementVolumeVariables& elemVolVars,
79 const SubControlVolume &scv) const
80 1737600 { return NumEqVector(0.0); }
81
82 /*!
83 * \brief Specifies which kind of boundary condition should be
84 * used for which equation on a given boundary segment
85 *
86 * \param globalPos The global position
87 */
88 70246 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
89 {
90 70246 BoundaryTypes bcTypes;
91
92
20/20
✓ Branch 0 taken 58046 times.
✓ Branch 1 taken 12200 times.
✓ Branch 2 taken 58046 times.
✓ Branch 3 taken 12200 times.
✓ Branch 4 taken 58046 times.
✓ Branch 5 taken 12200 times.
✓ Branch 6 taken 58046 times.
✓ Branch 7 taken 12200 times.
✓ Branch 8 taken 58046 times.
✓ Branch 9 taken 12200 times.
✓ Branch 10 taken 33802 times.
✓ Branch 11 taken 24244 times.
✓ Branch 12 taken 33802 times.
✓ Branch 13 taken 24244 times.
✓ Branch 14 taken 33802 times.
✓ Branch 15 taken 24244 times.
✓ Branch 16 taken 33802 times.
✓ Branch 17 taken 24244 times.
✓ Branch 18 taken 33802 times.
✓ Branch 19 taken 24244 times.
351230 if(globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_ || globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_)
93 bcTypes.setAllDirichlet();
94 else
95 bcTypes.setAllNeumann();
96
97 70246 return bcTypes;
98 }
99
100 /*!
101 * \brief Evaluates the boundary conditions for a Dirichlet boundary segment.
102 *
103 * \param globalPos The global position
104 */
105 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
106 {
107 24640 return initialAtPos(globalPos);
108 }
109
110 /*!
111 * \brief Evaluates the boundary conditions for a Neumann boundary segment.
112 *
113 * This is the method for the case where the Neumann condition is
114 * potentially solution dependent and requires some quantities that
115 * are specific to the fully-implicit method.
116 *
117 * \param element The finite element
118 * \param fvGeometry The finite-volume geometry
119 * \param elemVolVars All volume variables for the element
120 * \param elemFluxVarsCache Flux variables caches for all faces in stencil
121 * \param scvf The sub-control volume face
122 *
123 * For this method, the \a values parameter stores the flux
124 * in normal direction of each phase. Negative values mean influx.
125 * E.g. for the mass balance that would the mass flux in \f$ [ kg / (m^2 \cdot s)] \f$.
126 */
127 NumEqVector neumann(const Element& element,
128 const FVElementGeometry& fvGeometry,
129 const ElementVolumeVariables& elemVolVars,
130 const ElementFluxVariablesCache& elemFluxVarsCache,
131 const SubControlVolumeFace& scvf) const
132 {
133 63630 NumEqVector values(0.0);
134
135
6/8
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 12840 times.
✓ Branch 3 taken 6420 times.
✓ Branch 4 taken 29835 times.
✓ Branch 5 taken 14535 times.
✓ Branch 6 taken 29835 times.
✓ Branch 7 taken 14535 times.
108000 const auto& ipGlobal = scvf.ipGlobal();
136
137
4/8
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 42675 times.
✓ Branch 5 taken 20955 times.
✓ Branch 6 taken 42675 times.
✓ Branch 7 taken 20955 times.
127260 if (ipGlobal[0] < eps_)
138 {
139
8/16
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 31815 times.
✓ Branch 9 taken 10860 times.
✓ Branch 10 taken 31815 times.
✓ Branch 11 taken 10860 times.
✓ Branch 12 taken 5430 times.
✓ Branch 13 taken 26385 times.
✓ Branch 14 taken 5430 times.
✓ Branch 15 taken 26385 times.
85350 if (ipGlobal[1] > 2.0 - eps_ && ipGlobal[1] < 3.0 + eps_)
140 {
141 5430 const Scalar massRate = 1e-1;
142 5430 values[conti0EqIdx] = -massRate;
143 10860 values[energyEqIdx] = -massRate * 2690e3;
144 }
145 }
146
1/2
✓ Branch 0 taken 19260 times.
✗ Branch 1 not taken.
63630 return values;
147 }
148
149 /*!
150 * \brief Evaluates the initial values for a control volume.
151 *
152 * \param globalPos The global position
153 */
154 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
155 {
156 14382 PrimaryVariables values(0.0);
157
158 14382 const Scalar densityW = 1000.0;
159 61600 values[pressureIdx] = 101300.0 + (this->gridGeometry().bBoxMax()[1] - globalPos[1])*densityW*9.81; // hydrostatic pressure
160 12320 values[switchIdx] = 283.13;
161
162 24640 values.setState(liquidPhaseOnly);
163
164 return values;
165 }
166
167 private:
168
169 static constexpr Scalar eps_ = 1e-6;
170 };
171 } // end namespace Dumux
172
173 #endif
174