GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/freeflow/rans/problem.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 230 269 85.5%
Functions: 486 1058 45.9%
Branches: 321 1927 16.7%

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 RANSModel
10 * \copydoc Dumux::RANSProblem
11 */
12 #ifndef DUMUX_RANS_PROBLEM_HH
13 #define DUMUX_RANS_PROBLEM_HH
14
15 #include <algorithm>
16
17 #include <dune/common/fmatrix.hh>
18 #include <dumux/common/properties.hh>
19 #include <dumux/common/staggeredfvproblem.hh>
20 #include <dumux/discretization/localview.hh>
21 #include <dumux/discretization/method.hh>
22 #include <dumux/discretization/walldistance.hh>
23 #include <dumux/discretization/staggered/elementsolution.hh>
24 #include <dumux/freeflow/navierstokes/staggered/problem.hh>
25 #include "model.hh"
26
27 namespace Dumux {
28
29 //! forward declare
30 template<class TypeTag, TurbulenceModel turbulenceModel>
31 class RANSProblemImpl;
32
33 //! the turbulence-model-specfic RANS problem
34 template<class TypeTag>
35 using RANSProblem = RANSProblemImpl<TypeTag, GetPropType<TypeTag, Properties::ModelTraits>::turbulenceModel()>;
36
37 /*!
38 * \ingroup RANSModel
39 * \brief Reynolds-Averaged Navier-Stokes problem base class.
40 *
41 * This implements some base functionality for RANS models.
42 * Especially vectors containing all wall-relevant properties, which are accessed
43 * by the volumevariables.
44 */
45 template<class TypeTag>
46 class RANSProblemBase : public NavierStokesStaggeredProblem<TypeTag>
47 {
48 using ParentType = NavierStokesStaggeredProblem<TypeTag>;
49 using Implementation = GetPropType<TypeTag, Properties::Problem>;
50
51 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
52
53 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
54 using FVElementGeometry = typename GridGeometry::LocalView;
55 using GridView = typename GridGeometry::GridView;
56 using Element = typename GridView::template Codim<0>::Entity;
57 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
58 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
59 using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>;
60 using PrimaryVariables = typename VolumeVariables::PrimaryVariables;
61 using CellCenterPrimaryVariables = GetPropType<TypeTag, Properties::CellCenterPrimaryVariables>;
62 using FacePrimaryVariables = GetPropType<TypeTag, Properties::FacePrimaryVariables>;
63 using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
64
65 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
66
67 static constexpr auto dim = GridView::dimension;
68 static constexpr int numCorners = SubControlVolumeFace::numCornersPerFace;
69 using DimVector = GlobalPosition;
70 using DimMatrix = Dune::FieldMatrix<Scalar, dim, dim>;
71
72 struct WallElementInformation
73 {
74 // store the element indices for all elements with an intersection on the wall
75 unsigned int wallElementIdx;
76 // for each wall element, store the faces normal axis
77 unsigned int wallFaceNormalAxis;
78 // for each wall element, store the location of the face center and each corner.
79 GlobalPosition wallFaceCenter;
80 std::array<GlobalPosition, numCorners> wallFaceCorners;
81 };
82
83 public:
84
85 /*!
86 * \brief The constructor
87 * \param gridGeometry The finite volume grid geometry
88 * \param paramGroup The parameter group in which to look for runtime parameters first (default is "")
89 */
90 29 RANSProblemBase(std::shared_ptr<const GridGeometry> gridGeometry, const std::string& paramGroup = "")
91
17/60
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 29 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 29 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 29 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 29 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 29 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 29 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 29 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 29 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 29 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 29 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 29 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 29 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 29 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 29 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 29 times.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
58 : ParentType(gridGeometry, paramGroup)
92 {
93
7/16
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 29 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 29 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 29 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 29 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 29 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
145 if ( !(hasParamInGroup(this->paramGroup(), "RANS.IsFlatWallBounded")))
94 {
95 std::cout << "The parameter \"Rans.IsFlatWallBounded\" is not specified. \n"
96 << " -- Based on the grid and the boundary conditions specified by the user,"
97 << " this parameter is set to be "<< std::boolalpha << isFlatWallBounded() << "\n";
98 }
99
100 // update size and initial values of the global vectors
101
4/8
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 29 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 29 times.
✗ Branch 11 not taken.
116 wallDistance_.resize(this->gridGeometry().elementMapper().size(), std::numeric_limits<Scalar>::max());
102
4/8
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 29 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 29 times.
✗ Branch 11 not taken.
116 neighborIdx_.resize(this->gridGeometry().elementMapper().size());
103
4/8
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 29 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 29 times.
✗ Branch 11 not taken.
145 velocity_.resize(this->gridGeometry().elementMapper().size(), DimVector(0.0));
104
4/8
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 29 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 29 times.
✗ Branch 11 not taken.
145 velocityGradients_.resize(this->gridGeometry().elementMapper().size(), DimMatrix(0.0));
105
4/8
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 29 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 29 times.
✗ Branch 11 not taken.
116 stressTensorScalarProduct_.resize(this->gridGeometry().elementMapper().size(), 0.0);
106
4/8
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 29 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 29 times.
✗ Branch 11 not taken.
116 vorticityTensorScalarProduct_.resize(this->gridGeometry().elementMapper().size(), 0.0);
107
4/8
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 29 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 29 times.
✗ Branch 11 not taken.
116 flowDirectionAxis_.resize(this->gridGeometry().elementMapper().size(), fixedFlowDirectionAxis_);
108
4/8
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 29 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 29 times.
✗ Branch 11 not taken.
116 storedViscosity_.resize(this->gridGeometry().elementMapper().size(), 0.0);
109
4/10
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 29 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 29 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
116 storedDensity_.resize(this->gridGeometry().elementMapper().size(), 0.0);
110 29 }
111
112 /*!
113 * \brief Update the static (solution independent) relations to the walls and neighbors
114 */
115 29 void updateStaticWallProperties()
116 {
117 29 std::cout << "Update static wall properties. ";
118 29 calledUpdateStaticWallProperties = true;
119
120 29 checkForWalls_();
121 29 findWallDistances_();
122 29 findNeighborIndices_();
123 29 }
124
125 /*!
126 * \brief Update the dynamic (solution dependent) turbulence parameters
127 *
128 * \param curSol The solution vector.
129 */
130 template<class SolutionVector>
131 1078 void updateDynamicWallProperties(const SolutionVector& curSol)
132 {
133 2156 std::cout << "Update dynamic wall properties." << std::endl;
134
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1078 times.
1078 if (!calledUpdateStaticWallProperties)
135 DUNE_THROW(Dune::InvalidStateException,
136 "You have to call updateStaticWallProperties() once before you call updateDynamicWallProperties().");
137
138 1078 calculateCCVelocities_(curSol);
139 1078 calculateCCVelocityGradients_();
140 1078 calculateMaxMinVelocities_();
141 1078 calculateStressTensor_();
142 1078 calculateVorticityTensor_();
143 1078 storeViscosities_(curSol);
144 1078 }
145
146 /*!
147 * \brief Returns whether a wall function should be used at a given face
148 *
149 * \param element The element.
150 * \param scvf The sub control volume face.
151 * \param eqIdx The equation index.
152 */
153 bool useWallFunction(const Element& element,
154 const SubControlVolumeFace& scvf,
155 const int& eqIdx) const
156 { return false; }
157
158 /*!
159 * \brief Returns an additional wall function momentum flux
160 */
161 template<class ElementVolumeVariables, class ElementFaceVariables>
162 FacePrimaryVariables wallFunction(const Element& element,
163 const FVElementGeometry& fvGeometry,
164 const ElementVolumeVariables& elemVolVars,
165 const ElementFaceVariables& elemFaceVars,
166 const SubControlVolumeFace& scvf,
167 const SubControlVolumeFace& lateralBoundaryFace) const
168 { return FacePrimaryVariables(0.0); }
169
170 /*!
171 * \brief Returns an additional wall function flux for cell-centered quantities
172 */
173 template<class ElementVolumeVariables, class ElementFaceVariables>
174 CellCenterPrimaryVariables wallFunction(const Element& element,
175 const FVElementGeometry& fvGeometry,
176 const ElementVolumeVariables& elemVolVars,
177 const ElementFaceVariables& elemFaceVars,
178 const SubControlVolumeFace& scvf) const
179 { return CellCenterPrimaryVariables(0.0); }
180
181 /*!
182 * \brief Returns whether a given sub control volume face is on a wall
183 */
184 1000003903 bool isFlatWallBounded() const
185 {
186
4/6
✓ Branch 0 taken 29 times.
✓ Branch 1 taken 1000003874 times.
✓ Branch 3 taken 29 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 29 times.
✗ Branch 7 not taken.
1000003903 static const bool hasAlignedWalls = hasAlignedWalls_();
187 1000003903 return hasAlignedWalls;
188 }
189
190 /*!
191 * \brief Returns the Karman constant
192 */
193 const Scalar karmanConstant() const
194 { return 0.41; }
195
196 //! \brief Returns the \f$ \beta_{\omega} \f$ constant
197 const Scalar betaOmega() const
198 { return 0.0708; }
199
200 /*!
201 * \brief Return the turbulent Prandtl number \f$ [-] \f$ which is used to convert
202 * the eddy viscosity to an eddy thermal conductivity
203 */
204 42232722 Scalar turbulentPrandtlNumber() const
205 {
206
3/4
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 42232708 times.
✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
42232736 static const Scalar turbulentPrandtlNumber
207
2/4
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
42 = getParamFromGroup<Scalar>(this->paramGroup(), "RANS.TurbulentPrandtlNumber", 1.0);
208 42232722 return turbulentPrandtlNumber;
209 }
210
211 /*!
212 * \brief Return the turbulent Schmidt number \f$ [-] \f$ which is used to convert
213 * the eddy viscosity to an eddy diffusivity
214 */
215 97708112 Scalar turbulentSchmidtNumber() const
216 {
217
3/4
✓ Branch 0 taken 29 times.
✓ Branch 1 taken 97708083 times.
✓ Branch 3 taken 29 times.
✗ Branch 4 not taken.
97708141 static const Scalar turbulentSchmidtNumber
218
2/4
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
87 = getParamFromGroup<Scalar>(this->paramGroup(), "RANS.TurbulentSchmidtNumber", 1.0);
219 97708112 return turbulentSchmidtNumber;
220 }
221
222 138967752 int wallNormalAxis(const int elementIdx) const
223 {
224
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 138967752 times.
138967752 if (!isFlatWallBounded())
225 DUNE_THROW(Dune::NotImplemented, "\n Due to grid/geometric concerns, models requiring a wallNormalAxis "
226 << "can only be used for flat wall bounded flows. "
227 << "\n If your geometry is a flat channel, "
228 << "please set the runtime parameter RANS.IsFlatWallBounded to true. \n");
229 277935504 return wallNormalAxis_[elementIdx];
230 }
231
232 168660140 int flowDirectionAxis(const int elementIdx) const
233 {
234
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 168660140 times.
168660140 if (!isFlatWallBounded())
235 DUNE_THROW(Dune::NotImplemented, "\n Due to grid/geometric concerns, models requiring a flowDirectionAxis "
236 << "can only be used for flat wall bounded flows. "
237 << "\n If your geometry is a flat channel, "
238 << "please set the runtime parameter RANS.IsFlatWallBounded to true. \n");
239 337320280 return flowDirectionAxis_[elementIdx];
240 }
241
242 594904828 unsigned int wallElementIndex(const int elementIdx) const
243 {
244
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 594904828 times.
594904828 if (!isFlatWallBounded())
245 DUNE_THROW(Dune::NotImplemented, "\n Due to grid/geometric concerns, models requiring a wallElementIndex "
246 << "can only be used for flat wall bounded flows. "
247 << "\n If your geometry is a flat channel, "
248 << "please set the runtime parameter RANS.IsFlatWallBounded to true. \n");
249 1189809656 return wallElementIdx_[elementIdx];
250
251 }
252
253 Scalar wallDistance(const int elementIdx) const
254
6/60
✓ Branch 3 taken 16832 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 16832 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 16832 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 16832 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 16832 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 16832 times.
✗ Branch 19 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 111 not taken.
✗ Branch 112 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 120 not taken.
✗ Branch 121 not taken.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 126 not taken.
✗ Branch 127 not taken.
368053432 { return wallDistance_[elementIdx]; }
255
256 5051124 GlobalPosition cellCenter(const int elementIdx) const
257 {
258 10102248 const auto& element = this->gridGeometry().element(elementIdx);
259 5051124 return element.geometry().center();
260 }
261
262 unsigned int neighborIndex(const int elementIdx, const int axisIdx, const int sideIdx) const
263
0/482
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✗ Branch 151 not taken.
✗ Branch 152 not taken.
✗ Branch 154 not taken.
✗ Branch 155 not taken.
✗ Branch 157 not taken.
✗ Branch 158 not taken.
✗ Branch 160 not taken.
✗ Branch 161 not taken.
✗ Branch 163 not taken.
✗ Branch 164 not taken.
✗ Branch 166 not taken.
✗ Branch 167 not taken.
✗ Branch 169 not taken.
✗ Branch 170 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✗ Branch 175 not taken.
✗ Branch 176 not taken.
✗ Branch 178 not taken.
✗ Branch 179 not taken.
✗ Branch 181 not taken.
✗ Branch 182 not taken.
✗ Branch 184 not taken.
✗ Branch 185 not taken.
✗ Branch 187 not taken.
✗ Branch 188 not taken.
✗ Branch 190 not taken.
✗ Branch 191 not taken.
✗ Branch 193 not taken.
✗ Branch 194 not taken.
✗ Branch 196 not taken.
✗ Branch 197 not taken.
✗ Branch 199 not taken.
✗ Branch 200 not taken.
✗ Branch 202 not taken.
✗ Branch 203 not taken.
✗ Branch 205 not taken.
✗ Branch 206 not taken.
✗ Branch 208 not taken.
✗ Branch 209 not taken.
✗ Branch 211 not taken.
✗ Branch 212 not taken.
✗ Branch 214 not taken.
✗ Branch 215 not taken.
✗ Branch 217 not taken.
✗ Branch 218 not taken.
✗ Branch 220 not taken.
✗ Branch 221 not taken.
✗ Branch 223 not taken.
✗ Branch 224 not taken.
✗ Branch 226 not taken.
✗ Branch 227 not taken.
✗ Branch 229 not taken.
✗ Branch 230 not taken.
✗ Branch 232 not taken.
✗ Branch 233 not taken.
✗ Branch 235 not taken.
✗ Branch 236 not taken.
✗ Branch 238 not taken.
✗ Branch 239 not taken.
✗ Branch 241 not taken.
✗ Branch 242 not taken.
✗ Branch 244 not taken.
✗ Branch 245 not taken.
✗ Branch 247 not taken.
✗ Branch 248 not taken.
✗ Branch 250 not taken.
✗ Branch 251 not taken.
✗ Branch 253 not taken.
✗ Branch 254 not taken.
✗ Branch 256 not taken.
✗ Branch 257 not taken.
✗ Branch 259 not taken.
✗ Branch 260 not taken.
✗ Branch 262 not taken.
✗ Branch 263 not taken.
✗ Branch 265 not taken.
✗ Branch 266 not taken.
✗ Branch 268 not taken.
✗ Branch 269 not taken.
✗ Branch 271 not taken.
✗ Branch 272 not taken.
✗ Branch 274 not taken.
✗ Branch 275 not taken.
✗ Branch 277 not taken.
✗ Branch 278 not taken.
✗ Branch 280 not taken.
✗ Branch 281 not taken.
✗ Branch 283 not taken.
✗ Branch 284 not taken.
✗ Branch 286 not taken.
✗ Branch 287 not taken.
✗ Branch 289 not taken.
✗ Branch 290 not taken.
✗ Branch 292 not taken.
✗ Branch 293 not taken.
✗ Branch 295 not taken.
✗ Branch 296 not taken.
✗ Branch 298 not taken.
✗ Branch 299 not taken.
✗ Branch 301 not taken.
✗ Branch 302 not taken.
✗ Branch 304 not taken.
✗ Branch 305 not taken.
✗ Branch 307 not taken.
✗ Branch 308 not taken.
✗ Branch 310 not taken.
✗ Branch 311 not taken.
✗ Branch 313 not taken.
✗ Branch 314 not taken.
✗ Branch 316 not taken.
✗ Branch 317 not taken.
✗ Branch 319 not taken.
✗ Branch 320 not taken.
✗ Branch 322 not taken.
✗ Branch 323 not taken.
✗ Branch 325 not taken.
✗ Branch 326 not taken.
✗ Branch 328 not taken.
✗ Branch 329 not taken.
✗ Branch 331 not taken.
✗ Branch 332 not taken.
✗ Branch 334 not taken.
✗ Branch 335 not taken.
✗ Branch 337 not taken.
✗ Branch 338 not taken.
✗ Branch 340 not taken.
✗ Branch 341 not taken.
✗ Branch 343 not taken.
✗ Branch 344 not taken.
✗ Branch 346 not taken.
✗ Branch 347 not taken.
✗ Branch 349 not taken.
✗ Branch 350 not taken.
✗ Branch 352 not taken.
✗ Branch 353 not taken.
✗ Branch 355 not taken.
✗ Branch 356 not taken.
✗ Branch 358 not taken.
✗ Branch 359 not taken.
✗ Branch 361 not taken.
✗ Branch 362 not taken.
✗ Branch 364 not taken.
✗ Branch 365 not taken.
✗ Branch 367 not taken.
✗ Branch 368 not taken.
✗ Branch 370 not taken.
✗ Branch 371 not taken.
✗ Branch 373 not taken.
✗ Branch 374 not taken.
✗ Branch 376 not taken.
✗ Branch 377 not taken.
✗ Branch 379 not taken.
✗ Branch 380 not taken.
✗ Branch 382 not taken.
✗ Branch 383 not taken.
✗ Branch 385 not taken.
✗ Branch 386 not taken.
✗ Branch 388 not taken.
✗ Branch 389 not taken.
✗ Branch 391 not taken.
✗ Branch 392 not taken.
✗ Branch 394 not taken.
✗ Branch 395 not taken.
✗ Branch 397 not taken.
✗ Branch 398 not taken.
✗ Branch 400 not taken.
✗ Branch 401 not taken.
✗ Branch 403 not taken.
✗ Branch 404 not taken.
✗ Branch 406 not taken.
✗ Branch 407 not taken.
✗ Branch 409 not taken.
✗ Branch 410 not taken.
✗ Branch 412 not taken.
✗ Branch 413 not taken.
✗ Branch 415 not taken.
✗ Branch 416 not taken.
✗ Branch 418 not taken.
✗ Branch 419 not taken.
✗ Branch 421 not taken.
✗ Branch 422 not taken.
✗ Branch 424 not taken.
✗ Branch 425 not taken.
✗ Branch 427 not taken.
✗ Branch 428 not taken.
✗ Branch 430 not taken.
✗ Branch 431 not taken.
✗ Branch 433 not taken.
✗ Branch 434 not taken.
✗ Branch 436 not taken.
✗ Branch 437 not taken.
✗ Branch 439 not taken.
✗ Branch 440 not taken.
✗ Branch 442 not taken.
✗ Branch 443 not taken.
✗ Branch 445 not taken.
✗ Branch 446 not taken.
✗ Branch 448 not taken.
✗ Branch 449 not taken.
✗ Branch 451 not taken.
✗ Branch 452 not taken.
✗ Branch 454 not taken.
✗ Branch 455 not taken.
✗ Branch 457 not taken.
✗ Branch 458 not taken.
✗ Branch 460 not taken.
✗ Branch 461 not taken.
✗ Branch 463 not taken.
✗ Branch 464 not taken.
✗ Branch 466 not taken.
✗ Branch 467 not taken.
✗ Branch 469 not taken.
✗ Branch 470 not taken.
✗ Branch 472 not taken.
✗ Branch 473 not taken.
✗ Branch 475 not taken.
✗ Branch 476 not taken.
✗ Branch 478 not taken.
✗ Branch 479 not taken.
✗ Branch 481 not taken.
✗ Branch 482 not taken.
✗ Branch 484 not taken.
✗ Branch 485 not taken.
✗ Branch 487 not taken.
✗ Branch 488 not taken.
✗ Branch 490 not taken.
✗ Branch 491 not taken.
✗ Branch 493 not taken.
✗ Branch 494 not taken.
✗ Branch 496 not taken.
✗ Branch 497 not taken.
✗ Branch 499 not taken.
✗ Branch 500 not taken.
✗ Branch 502 not taken.
✗ Branch 503 not taken.
✗ Branch 505 not taken.
✗ Branch 506 not taken.
✗ Branch 508 not taken.
✗ Branch 509 not taken.
✗ Branch 511 not taken.
✗ Branch 512 not taken.
✗ Branch 514 not taken.
✗ Branch 515 not taken.
✗ Branch 517 not taken.
✗ Branch 518 not taken.
✗ Branch 520 not taken.
✗ Branch 521 not taken.
✗ Branch 523 not taken.
✗ Branch 524 not taken.
✗ Branch 526 not taken.
✗ Branch 527 not taken.
✗ Branch 529 not taken.
✗ Branch 530 not taken.
✗ Branch 532 not taken.
✗ Branch 533 not taken.
✗ Branch 535 not taken.
✗ Branch 536 not taken.
✗ Branch 538 not taken.
✗ Branch 539 not taken.
✗ Branch 541 not taken.
✗ Branch 542 not taken.
✗ Branch 544 not taken.
✗ Branch 545 not taken.
✗ Branch 547 not taken.
✗ Branch 548 not taken.
✗ Branch 550 not taken.
✗ Branch 551 not taken.
✗ Branch 553 not taken.
✗ Branch 554 not taken.
✗ Branch 556 not taken.
✗ Branch 557 not taken.
✗ Branch 559 not taken.
✗ Branch 560 not taken.
✗ Branch 562 not taken.
✗ Branch 563 not taken.
✗ Branch 565 not taken.
✗ Branch 566 not taken.
✗ Branch 568 not taken.
✗ Branch 569 not taken.
✗ Branch 571 not taken.
✗ Branch 572 not taken.
✗ Branch 574 not taken.
✗ Branch 575 not taken.
✗ Branch 577 not taken.
✗ Branch 578 not taken.
✗ Branch 580 not taken.
✗ Branch 581 not taken.
✗ Branch 583 not taken.
✗ Branch 584 not taken.
✗ Branch 586 not taken.
✗ Branch 587 not taken.
✗ Branch 589 not taken.
✗ Branch 590 not taken.
✗ Branch 592 not taken.
✗ Branch 593 not taken.
✗ Branch 595 not taken.
✗ Branch 596 not taken.
✗ Branch 598 not taken.
✗ Branch 599 not taken.
✗ Branch 601 not taken.
✗ Branch 602 not taken.
✗ Branch 604 not taken.
✗ Branch 605 not taken.
✗ Branch 607 not taken.
✗ Branch 608 not taken.
✗ Branch 610 not taken.
✗ Branch 611 not taken.
✗ Branch 613 not taken.
✗ Branch 614 not taken.
✗ Branch 616 not taken.
✗ Branch 617 not taken.
✗ Branch 619 not taken.
✗ Branch 620 not taken.
✗ Branch 622 not taken.
✗ Branch 623 not taken.
✗ Branch 625 not taken.
✗ Branch 626 not taken.
✗ Branch 628 not taken.
✗ Branch 629 not taken.
✗ Branch 631 not taken.
✗ Branch 632 not taken.
✗ Branch 634 not taken.
✗ Branch 635 not taken.
✗ Branch 637 not taken.
✗ Branch 638 not taken.
✗ Branch 640 not taken.
✗ Branch 641 not taken.
✗ Branch 643 not taken.
✗ Branch 644 not taken.
✗ Branch 646 not taken.
✗ Branch 647 not taken.
✗ Branch 649 not taken.
✗ Branch 650 not taken.
✗ Branch 652 not taken.
✗ Branch 653 not taken.
✗ Branch 655 not taken.
✗ Branch 656 not taken.
✗ Branch 658 not taken.
✗ Branch 659 not taken.
✗ Branch 661 not taken.
✗ Branch 662 not taken.
✗ Branch 664 not taken.
✗ Branch 665 not taken.
✗ Branch 667 not taken.
✗ Branch 668 not taken.
✗ Branch 670 not taken.
✗ Branch 671 not taken.
✗ Branch 673 not taken.
✗ Branch 674 not taken.
✗ Branch 676 not taken.
✗ Branch 677 not taken.
✗ Branch 679 not taken.
✗ Branch 680 not taken.
✗ Branch 682 not taken.
✗ Branch 683 not taken.
✗ Branch 685 not taken.
✗ Branch 686 not taken.
✗ Branch 688 not taken.
✗ Branch 689 not taken.
✗ Branch 691 not taken.
✗ Branch 692 not taken.
✗ Branch 694 not taken.
✗ Branch 695 not taken.
✗ Branch 697 not taken.
✗ Branch 698 not taken.
✗ Branch 700 not taken.
✗ Branch 701 not taken.
✗ Branch 703 not taken.
✗ Branch 704 not taken.
✗ Branch 706 not taken.
✗ Branch 707 not taken.
✗ Branch 709 not taken.
✗ Branch 710 not taken.
✗ Branch 712 not taken.
✗ Branch 713 not taken.
✗ Branch 715 not taken.
✗ Branch 716 not taken.
✗ Branch 718 not taken.
✗ Branch 719 not taken.
5333052 { return neighborIdx_[elementIdx][axisIdx][sideIdx];}
264
265 DimVector ccVelocityVector(const int elementIdx) const
266 194940128 { return velocity_[elementIdx]; }
267
268 Scalar ccVelocity(const int elementIdx, const int axisIdx) const
269
6/281
✓ Branch 0 taken 251319 times.
✓ Branch 1 taken 167113 times.
✓ Branch 2 taken 209450 times.
✓ Branch 3 taken 208982 times.
✓ Branch 4 taken 3543 times.
✓ Branch 5 taken 64361 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ 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 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 131 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 138 not taken.
✗ Branch 140 not taken.
✗ Branch 141 not taken.
✗ Branch 143 not taken.
✗ Branch 144 not taken.
✗ Branch 146 not taken.
✗ Branch 147 not taken.
✗ Branch 150 not taken.
✗ Branch 151 not taken.
✗ Branch 152 not taken.
✗ Branch 153 not taken.
✗ Branch 154 not taken.
✗ Branch 155 not taken.
✗ Branch 156 not taken.
✗ Branch 157 not taken.
✗ Branch 159 not taken.
✗ Branch 160 not taken.
✗ Branch 162 not taken.
✗ Branch 163 not taken.
✗ Branch 165 not taken.
✗ Branch 166 not taken.
✗ Branch 169 not taken.
✗ Branch 170 not taken.
✗ Branch 171 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✗ Branch 174 not taken.
✗ Branch 175 not taken.
✗ Branch 176 not taken.
✗ Branch 178 not taken.
✗ Branch 179 not taken.
✗ Branch 181 not taken.
✗ Branch 182 not taken.
✗ Branch 184 not taken.
✗ Branch 185 not taken.
✗ Branch 188 not taken.
✗ Branch 189 not taken.
✗ Branch 190 not taken.
✗ Branch 191 not taken.
✗ Branch 192 not taken.
✗ Branch 193 not taken.
✗ Branch 194 not taken.
✗ Branch 195 not taken.
✗ Branch 197 not taken.
✗ Branch 198 not taken.
✗ Branch 200 not taken.
✗ Branch 201 not taken.
✗ Branch 203 not taken.
✗ Branch 204 not taken.
✗ Branch 207 not taken.
✗ Branch 208 not taken.
✗ Branch 209 not taken.
✗ Branch 210 not taken.
✗ Branch 211 not taken.
✗ Branch 212 not taken.
✗ Branch 213 not taken.
✗ Branch 214 not taken.
✗ Branch 216 not taken.
✗ Branch 217 not taken.
✗ Branch 219 not taken.
✗ Branch 220 not taken.
✗ Branch 222 not taken.
✗ Branch 223 not taken.
✗ Branch 226 not taken.
✗ Branch 227 not taken.
✗ Branch 228 not taken.
✗ Branch 229 not taken.
✗ Branch 230 not taken.
✗ Branch 231 not taken.
✗ Branch 232 not taken.
✗ Branch 233 not taken.
✗ Branch 235 not taken.
✗ Branch 236 not taken.
✗ Branch 238 not taken.
✗ Branch 239 not taken.
✗ Branch 241 not taken.
✗ Branch 242 not taken.
✗ Branch 245 not taken.
✗ Branch 246 not taken.
✗ Branch 247 not taken.
✗ Branch 248 not taken.
✗ Branch 249 not taken.
✗ Branch 250 not taken.
✗ Branch 251 not taken.
✗ Branch 252 not taken.
✗ Branch 254 not taken.
✗ Branch 255 not taken.
✗ Branch 257 not taken.
✗ Branch 258 not taken.
✗ Branch 260 not taken.
✗ Branch 261 not taken.
✗ Branch 264 not taken.
✗ Branch 265 not taken.
✗ Branch 266 not taken.
✗ Branch 267 not taken.
✗ Branch 268 not taken.
✗ Branch 269 not taken.
✗ Branch 270 not taken.
✗ Branch 271 not taken.
✗ Branch 273 not taken.
✗ Branch 274 not taken.
✗ Branch 276 not taken.
✗ Branch 277 not taken.
✗ Branch 279 not taken.
✗ Branch 280 not taken.
✗ Branch 283 not taken.
✗ Branch 284 not taken.
✗ Branch 285 not taken.
✗ Branch 286 not taken.
✗ Branch 287 not taken.
✗ Branch 288 not taken.
✗ Branch 289 not taken.
✗ Branch 290 not taken.
✗ Branch 292 not taken.
✗ Branch 293 not taken.
✗ Branch 295 not taken.
✗ Branch 296 not taken.
✗ Branch 298 not taken.
✗ Branch 299 not taken.
✗ Branch 302 not taken.
✗ Branch 303 not taken.
✗ Branch 304 not taken.
✗ Branch 305 not taken.
✗ Branch 306 not taken.
✗ Branch 307 not taken.
✗ Branch 308 not taken.
✗ Branch 309 not taken.
✗ Branch 311 not taken.
✗ Branch 312 not taken.
✗ Branch 314 not taken.
✗ Branch 315 not taken.
✗ Branch 317 not taken.
✗ Branch 318 not taken.
✗ Branch 321 not taken.
✗ Branch 322 not taken.
✗ Branch 323 not taken.
✗ Branch 324 not taken.
✗ Branch 325 not taken.
✗ Branch 326 not taken.
✗ Branch 327 not taken.
✗ Branch 328 not taken.
✗ Branch 330 not taken.
✗ Branch 331 not taken.
✗ Branch 333 not taken.
✗ Branch 334 not taken.
✗ Branch 336 not taken.
✗ Branch 337 not taken.
✗ Branch 340 not taken.
✗ Branch 341 not taken.
✗ Branch 342 not taken.
✗ Branch 343 not taken.
✗ Branch 344 not taken.
✗ Branch 345 not taken.
✗ Branch 346 not taken.
✗ Branch 347 not taken.
✗ Branch 349 not taken.
✗ Branch 350 not taken.
✗ Branch 352 not taken.
✗ Branch 353 not taken.
✗ Branch 355 not taken.
✗ Branch 356 not taken.
✗ Branch 359 not taken.
✗ Branch 360 not taken.
✗ Branch 361 not taken.
✗ Branch 362 not taken.
✗ Branch 363 not taken.
✗ Branch 364 not taken.
✗ Branch 365 not taken.
✗ Branch 366 not taken.
✗ Branch 368 not taken.
✗ Branch 369 not taken.
✗ Branch 371 not taken.
✗ Branch 372 not taken.
✗ Branch 374 not taken.
✗ Branch 375 not taken.
✗ Branch 378 not taken.
✗ Branch 379 not taken.
256735682 { return velocity_[elementIdx][axisIdx]; }
270
271 DimVector velocityMaximum(const int elementIdx) const
272
4/40
✓ Branch 5 taken 33664 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 33664 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 33664 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 33664 times.
✗ Branch 15 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 111 not taken.
✗ Branch 112 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 120 not taken.
✗ Branch 121 not taken.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 126 not taken.
✗ Branch 127 not taken.
364068288 { return velocityMaximum_[elementIdx]; }
273
274 DimVector velocityMinimum(const int elementIdx) const
275
2/20
✓ Branch 5 taken 33664 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 33664 times.
✗ Branch 9 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
364068288 { return velocityMinimum_[elementIdx]; }
276
277 DimMatrix velocityGradientTensor(const int elementIdx) const
278 194940128 { return velocityGradients_[elementIdx]; }
279
280 Scalar velocityGradient(const int elementIdx, const int i, const int j) const
281
19/248
✓ Branch 0 taken 136136 times.
✓ Branch 1 taken 84394280 times.
✓ Branch 2 taken 136136 times.
✓ Branch 3 taken 84394280 times.
✓ Branch 4 taken 136136 times.
✓ Branch 5 taken 84394280 times.
✓ Branch 6 taken 136136 times.
✓ Branch 7 taken 84394280 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 16832 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 16832 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 16832 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✓ Branch 18 taken 16832 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 16832 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 16832 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 16832 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✓ Branch 30 taken 16832 times.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✓ Branch 33 taken 16832 times.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✓ Branch 36 taken 16832 times.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✓ Branch 39 taken 16832 times.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 111 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 120 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 126 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 138 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 141 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
✗ Branch 144 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 147 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✗ Branch 150 not taken.
✗ Branch 151 not taken.
✗ Branch 152 not taken.
✗ Branch 153 not taken.
✗ Branch 154 not taken.
✗ Branch 155 not taken.
✗ Branch 156 not taken.
✗ Branch 157 not taken.
✗ Branch 158 not taken.
✗ Branch 159 not taken.
✗ Branch 161 not taken.
✗ Branch 162 not taken.
✗ Branch 164 not taken.
✗ Branch 165 not taken.
✗ Branch 167 not taken.
✗ Branch 168 not taken.
✗ Branch 170 not taken.
✗ Branch 171 not taken.
✗ Branch 173 not taken.
✗ Branch 174 not taken.
✗ Branch 176 not taken.
✗ Branch 177 not taken.
✗ Branch 179 not taken.
✗ Branch 180 not taken.
✗ Branch 182 not taken.
✗ Branch 183 not taken.
✗ Branch 185 not taken.
✗ Branch 186 not taken.
✗ Branch 188 not taken.
✗ Branch 189 not taken.
✗ Branch 191 not taken.
✗ Branch 192 not taken.
✗ Branch 194 not taken.
✗ Branch 195 not taken.
✗ Branch 197 not taken.
✗ Branch 198 not taken.
✗ Branch 200 not taken.
✗ Branch 201 not taken.
✗ Branch 203 not taken.
✗ Branch 204 not taken.
✗ Branch 206 not taken.
✗ Branch 207 not taken.
✗ Branch 209 not taken.
✗ Branch 210 not taken.
✗ Branch 212 not taken.
✗ Branch 213 not taken.
✗ Branch 215 not taken.
✗ Branch 216 not taken.
✗ Branch 218 not taken.
✗ Branch 219 not taken.
✗ Branch 221 not taken.
✗ Branch 222 not taken.
✗ Branch 224 not taken.
✗ Branch 225 not taken.
✗ Branch 227 not taken.
✗ Branch 228 not taken.
✗ Branch 230 not taken.
✗ Branch 231 not taken.
✗ Branch 233 not taken.
✗ Branch 234 not taken.
✗ Branch 236 not taken.
✗ Branch 237 not taken.
✗ Branch 239 not taken.
✗ Branch 240 not taken.
✗ Branch 242 not taken.
✗ Branch 243 not taken.
✗ Branch 245 not taken.
✗ Branch 246 not taken.
✗ Branch 248 not taken.
✗ Branch 249 not taken.
✗ Branch 251 not taken.
✗ Branch 252 not taken.
✗ Branch 254 not taken.
✗ Branch 255 not taken.
✗ Branch 257 not taken.
✗ Branch 258 not taken.
✗ Branch 260 not taken.
✗ Branch 261 not taken.
✗ Branch 263 not taken.
✗ Branch 264 not taken.
✗ Branch 266 not taken.
✗ Branch 267 not taken.
✗ Branch 269 not taken.
✗ Branch 270 not taken.
✗ Branch 272 not taken.
✗ Branch 273 not taken.
✗ Branch 275 not taken.
✗ Branch 276 not taken.
✗ Branch 278 not taken.
✗ Branch 279 not taken.
✗ Branch 281 not taken.
✗ Branch 282 not taken.
✗ Branch 284 not taken.
✗ Branch 285 not taken.
✗ Branch 287 not taken.
✗ Branch 288 not taken.
✗ Branch 290 not taken.
✗ Branch 291 not taken.
344142848 { return velocityGradients_[elementIdx][i][j]; }
282
283 Scalar stressTensorScalarProduct(const int elementIdx) const
284 184417032 { return stressTensorScalarProduct_[elementIdx]; }
285
286 Scalar vorticityTensorScalarProduct(const int elementIdx) const
287 53731560 { return vorticityTensorScalarProduct_[elementIdx]; }
288
289 Scalar storedViscosity(const int elementIdx) const
290 670515724 { return storedViscosity_[elementIdx]; }
291
292 Scalar storedDensity(const int elementIdx) const
293 670644956 { return storedDensity_[elementIdx]; }
294
295 Scalar kinematicViscosity(const int elementIdx) const
296
6/60
✓ Branch 4 taken 16832 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 16832 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 16832 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 16832 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 16832 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 16832 times.
✗ Branch 20 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
645752388 { return storedViscosity(elementIdx) / storedDensity(elementIdx); }
297
298 bool calledUpdateStaticWallProperties = false;
299
300 private:
301
302 29 bool hasAlignedWalls_() const
303 {
304
7/16
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 29 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 29 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 29 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 29 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 29 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
145 if ( hasParamInGroup(this->paramGroup(), "RANS.IsFlatWallBounded"))
305 {
306
3/6
✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 29 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 29 times.
✗ Branch 7 not taken.
29 static const bool isFlatWallBounded = getParamFromGroup<bool>(this->paramGroup(), "RANS.IsFlatWallBounded");
307 29 return isFlatWallBounded;
308 }
309
310 std::vector<int> wallFaceAxis;
311 wallFaceAxis.reserve(this->gridGeometry().numBoundaryScvf());
312
313 const auto gridView = this->gridGeometry().gridView();
314 auto fvGeometry = localView(this->gridGeometry());
315 for (const auto& element : elements(gridView))
316 {
317 fvGeometry.bindElement(element);
318 for (const auto& scvf : scvfs(fvGeometry))
319 if (!scvf.boundary() && asImp_().boundaryTypes(element, scvf).hasWall()) // only search for walls at a global boundary
320 wallFaceAxis.push_back(scvf.directionIndex());
321 }
322
323 // Returns if all wall directions are the same
324 return std::all_of(wallFaceAxis.begin(), wallFaceAxis.end(), [firstDir=wallFaceAxis[0]](auto dir){ return (dir == firstDir);} ) ;
325 }
326
327 29 void checkForWalls_()
328 {
329
1/4
✓ Branch 3 taken 29 times.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
116 for (const auto& element : elements(this->gridGeometry().gridView()))
330 {
331
0/4
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
58 auto fvGeometry = localView(this->gridGeometry());
332
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
29 fvGeometry.bindElement(element);
333
2/4
✓ Branch 0 taken 87 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 87 times.
✗ Branch 3 not taken.
116 for (auto&& scvf : scvfs(fvGeometry))
334
2/2
✓ Branch 1 taken 29 times.
✓ Branch 2 taken 58 times.
87 if (asImp_().boundaryTypes(element, scvf).hasWall())
335 29 return;
336 }
337 // If reached, no walls were found using the boundary types has wall function.
338 DUNE_THROW(Dune::InvalidStateException, "No walls are are specified with the setWall() function");
339 }
340
341 /*!
342 * \brief Use the boundary search algorithm to find the shortest distance to a wall for each element
343 *
344 * Also store the wall element's index, and its direction in the case of flat wall bounded problems
345 */
346 29 void findWallDistances_()
347 {
348 87 WallDistance wallInformation(this->gridGeometry(), WallDistance<GridGeometry>::atElementCenters,
349 [this] (const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf)
350
2/28
✓ Branch 2 taken 530 times.
✓ Branch 3 taken 1280 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
3620 { return asImp_().boundaryTypes(fvGeometry.element(), scvf).hasWall(); });
351
1/2
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
29 wallDistance_ = wallInformation.wallDistance();
352
1/2
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
29 storeWallElementAndDirectionIndex_(wallInformation.wallData());
353 29 }
354
355 template <class WallData>
356 29 void storeWallElementAndDirectionIndex_(const WallData& wallData)
357 {
358 // The wall Direction Index is used for flat quadrilateral channel problems only
359 if (!(GridGeometry::discMethod == DiscretizationMethods::staggered))
360 DUNE_THROW(Dune::NotImplemented, "The wall direction Index can only be calculated for quadrilateral structured grids");
361
362 // If isFlatWallBounded, the corresponding wall element is stored for each element
363
2/2
✓ Branch 1 taken 26 times.
✓ Branch 2 taken 3 times.
29 if (isFlatWallBounded())
364 {
365 52 wallNormalAxis_.resize(wallData.size());
366 52 wallElementIdx_.resize(wallData.size());
367
368
1/2
✓ Branch 3 taken 5626 times.
✗ Branch 4 not taken.
11304 for (const auto& element : elements(this->gridGeometry().gridView()))
369 {
370 16800 unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
371
2/4
✓ Branch 1 taken 5600 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5600 times.
✗ Branch 5 not taken.
11200 wallElementIdx_[elementIdx] = wallData[elementIdx].eIdx;
372
6/14
✓ Branch 1 taken 5600 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5600 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5600 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 5600 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 5600 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 5600 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
28000 if ( ! (hasParam("RANS.WallNormalAxis")) )
373 {
374 GlobalPosition wallOuterNormal = wallData[elementIdx].scvfOuterNormal;
375 if constexpr (dim == 2) // 2D
376 wallNormalAxis_[elementIdx] = (wallOuterNormal[0] == 1) ? 0 : 1;
377 else // 3D
378 wallNormalAxis_[elementIdx] = (wallOuterNormal[0] == 1) ? 0 : ((wallOuterNormal[1] == 1) ? 1 : 2);
379 }
380 else
381 11200 wallNormalAxis_[elementIdx] = fixedWallNormalAxis_;
382 }
383 }
384 29 }
385
386 /*!
387 * \brief Store all direct neighbor indices for each element
388 */
389 29 void findNeighborIndices_()
390 {
391 // search for neighbor Idxs
392
1/2
✓ Branch 3 taken 6365 times.
✗ Branch 4 not taken.
12759 for (const auto& element : elements(this->gridGeometry().gridView()))
393 {
394 12672 unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
395
2/2
✓ Branch 1 taken 12672 times.
✓ Branch 2 taken 6336 times.
19008 for (unsigned int axisIdx = 0; axisIdx < dim; ++axisIdx)
396 {
397 38016 neighborIdx_[elementIdx][axisIdx][0] = elementIdx;
398 38016 neighborIdx_[elementIdx][axisIdx][1] = elementIdx;
399 }
400
401
2/2
✓ Branch 3 taken 6336 times.
✓ Branch 4 taken 25344 times.
50688 for (const auto& intersection : intersections(this->gridGeometry().gridView(), element))
402 {
403
1/2
✓ Branch 0 taken 25344 times.
✗ Branch 1 not taken.
25344 if (intersection.boundary())
404 continue;
405
406 94136 unsigned int neighborIdx = this->gridGeometry().elementMapper().index(intersection.outside());
407
2/2
✓ Branch 0 taken 47068 times.
✓ Branch 1 taken 23534 times.
70602 for (unsigned int axisIdx = 0; axisIdx < dim; ++axisIdx)
408 {
409
6/6
✓ Branch 3 taken 23534 times.
✓ Branch 4 taken 23534 times.
✓ Branch 5 taken 23534 times.
✓ Branch 6 taken 23534 times.
✓ Branch 7 taken 23534 times.
✓ Branch 8 taken 23534 times.
47068 if (abs(cellCenter(elementIdx)[axisIdx] - cellCenter(neighborIdx)[axisIdx]) > 1e-8)
410 {
411
4/4
✓ Branch 3 taken 11767 times.
✓ Branch 4 taken 11767 times.
✓ Branch 5 taken 11767 times.
✓ Branch 6 taken 11767 times.
23534 if (cellCenter(elementIdx)[axisIdx] > cellCenter(neighborIdx)[axisIdx])
412 47068 neighborIdx_[elementIdx][axisIdx][0] = neighborIdx;
413
414
4/4
✓ Branch 3 taken 11767 times.
✓ Branch 4 taken 11767 times.
✓ Branch 5 taken 11767 times.
✓ Branch 6 taken 11767 times.
23534 if (cellCenter(elementIdx)[axisIdx] < cellCenter(neighborIdx)[axisIdx])
415 47068 neighborIdx_[elementIdx][axisIdx][1] = neighborIdx;
416 }
417 }
418 }
419 }
420 29 }
421
422 template<class SolutionVector>
423 1078 void calculateCCVelocities_(const SolutionVector& curSol)
424 {
425
0/4
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
2156 auto fvGeometry = localView(this->gridGeometry());
426 // calculate cell-center-averaged velocities
427
1/11
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 244246 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
489570 for (const auto& element : elements(this->gridGeometry().gridView()))
428 {
429
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
243168 fvGeometry.bindElement(element);
430 729504 unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
431
432 // calculate velocities
433 243168 DimVector velocityTemp(0.0);
434
4/4
✓ Branch 0 taken 972672 times.
✓ Branch 1 taken 243168 times.
✓ Branch 2 taken 972672 times.
✓ Branch 3 taken 243168 times.
1459008 for (auto&& scvf : scvfs(fvGeometry))
435 {
436 972672 const int dofIdxFace = scvf.dofIndex();
437 1945344 const auto numericalSolutionFace = curSol[GridGeometry::faceIdx()][dofIdxFace][Indices::velocity(scvf.directionIndex())];
438 1945344 velocityTemp[scvf.directionIndex()] += numericalSolutionFace;
439 }
440
2/2
✓ Branch 0 taken 486336 times.
✓ Branch 1 taken 243168 times.
729504 for (unsigned int axisIdx = 0; axisIdx < dim; ++axisIdx)
441 1945344 velocity_[elementIdx][axisIdx] = velocityTemp[axisIdx] * 0.5; // faces are equidistant to cell center
442 }
443 1078 }
444
445
446 1078 void calculateCCVelocityGradients_()
447 {
448 using std::abs;
449
450 // calculate cell-center-averaged velocity gradients, maximum, and minimum values
451
0/4
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
2156 auto fvGeometry = localView(this->gridGeometry());
452
1/9
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 244246 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
489570 for (const auto& element : elements(this->gridGeometry().gridView()))
453 {
454 486336 const unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
455
456
2/2
✓ Branch 1 taken 486336 times.
✓ Branch 2 taken 243168 times.
729504 for (unsigned int j = 0; j < dim; ++j)
457 {
458
2/2
✓ Branch 0 taken 972672 times.
✓ Branch 1 taken 486336 times.
1459008 for (unsigned int i = 0; i < dim; ++i)
459 {
460
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
972672 const unsigned int neighborIndex0 = neighborIndex(elementIdx, j, 0);
461
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
972672 const unsigned int neighborIndex1 = neighborIndex(elementIdx, j, 1);
462
463
0/4
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
1945344 velocityGradients_[elementIdx][i][j]
464
0/4
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
1945344 = (ccVelocity(neighborIndex1, i) - ccVelocity(neighborIndex0, i))
465
0/10
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
972672 / (cellCenter(neighborIndex1)[j] - cellCenter(neighborIndex0)[j]);
466
467
3/14
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 972672 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 972672 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 972672 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
972672 if (abs(cellCenter(neighborIndex1)[j] - cellCenter(neighborIndex0)[j]) < 1e-8)
468 velocityGradients_[elementIdx][i][j] = 0.0;
469 }
470 }
471
472
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
243168 fvGeometry.bindElement(element);
473
6/6
✓ Branch 0 taken 972672 times.
✓ Branch 1 taken 243168 times.
✓ Branch 2 taken 972672 times.
✓ Branch 3 taken 243168 times.
✓ Branch 4 taken 68150 times.
✓ Branch 5 taken 904522 times.
2431680 for (auto&& scvf : scvfs(fvGeometry))
474 {
475 // adapt calculations for Dirichlet condition
476 972672 unsigned int axisIdx = scvf.directionIndex();
477
2/2
✓ Branch 0 taken 68150 times.
✓ Branch 1 taken 904522 times.
972672 if (scvf.boundary())
478 {
479
2/2
✓ Branch 0 taken 136300 times.
✓ Branch 1 taken 68150 times.
204450 for (unsigned int velIdx = 0; velIdx < dim; ++velIdx)
480 {
481
2/2
✓ Branch 1 taken 50960 times.
✓ Branch 2 taken 85340 times.
136300 if (!asImp_().boundaryTypes(element, scvf).isDirichlet(Indices::velocity(velIdx)))
482 50960 continue;
483
484
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
85340 Scalar dirichletVelocity = asImp_().dirichlet(element, scvf)[Indices::velocity(velIdx)];
485
486
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
85340 unsigned int neighborIdx = neighborIndex(elementIdx, axisIdx, 0);
487
4/12
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 68150 times.
✓ Branch 4 taken 17190 times.
✓ Branch 5 taken 68150 times.
✓ Branch 6 taken 17190 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
256020 if (scvf.center()[axisIdx] < cellCenter(elementIdx)[axisIdx])
488 136300 neighborIdx = neighborIndex(elementIdx, axisIdx, 1);
489
490 170680 velocityGradients_[elementIdx][velIdx][axisIdx]
491
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
85340 = (ccVelocity(neighborIdx, velIdx) - dirichletVelocity)
492
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
85340 / (cellCenter(neighborIdx)[axisIdx] - scvf.center()[axisIdx]);
493 }
494 }
495
496 // Calculate the BJS-velocity by accounting for all sub faces.
497
1/7
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 972672 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
2918016 std::vector<int> bjsNumFaces(dim, 0);
498
4/12
✓ Branch 1 taken 972672 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 972672 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 972672 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 972672 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
3890688 std::vector<unsigned int> bjsNeighbor(dim, 0);
499 972672 DimVector bjsVelocityAverage(0.0);
500 972672 DimVector normalNormCoordinate(0.0);
501 972672 unsigned int velCompIdx = Indices::velocity(scvf.directionIndex());
502 972672 const int numSubFaces = scvf.pairData().size();
503
2/2
✓ Branch 0 taken 1945344 times.
✓ Branch 1 taken 972672 times.
2918016 for(int localSubFaceIdx = 0; localSubFaceIdx < numSubFaces; ++localSubFaceIdx)
504 {
505
8/8
✓ Branch 0 taken 136300 times.
✓ Branch 1 taken 1809044 times.
✓ Branch 2 taken 136300 times.
✓ Branch 3 taken 1809044 times.
✓ Branch 4 taken 136300 times.
✓ Branch 5 taken 1809044 times.
✓ Branch 6 taken 136300 times.
✓ Branch 7 taken 1809044 times.
7781376 const auto& lateralFace = fvGeometry.scvf(scvf.insideScvIdx(), scvf.pairData()[localSubFaceIdx].localLateralFaceIdx);
506
507 // adapt calculations for Beavers-Joseph-Saffman condition
508 1945344 unsigned int lateralAxisIdx = lateralFace.directionIndex();
509
4/6
✓ Branch 0 taken 136300 times.
✓ Branch 1 taken 1809044 times.
✓ Branch 3 taken 136300 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 136300 times.
✗ Branch 6 not taken.
1945344 if (lateralFace.boundary() && (asImp_().boundaryTypes(element, lateralFace).isBeaversJoseph(Indices::velocity(velCompIdx))))
510 {
511 unsigned int neighborIdx = neighborIndex(elementIdx, lateralAxisIdx, 0);
512 if (lateralFace.center()[lateralAxisIdx] < cellCenter(elementIdx)[lateralAxisIdx])
513 neighborIdx = neighborIndex(elementIdx, lateralAxisIdx, 1);
514
515 const SubControlVolume& scv = fvGeometry.scv(scvf.insideScvIdx());
516 bjsVelocityAverage[lateralAxisIdx] += ParentType::beaversJosephVelocity(element, scv, scvf, lateralFace, ccVelocity(elementIdx, velCompIdx), 0.0);
517 if (bjsNumFaces[lateralAxisIdx] > 0 && neighborIdx != bjsNeighbor[lateralAxisIdx])
518 DUNE_THROW(Dune::InvalidStateException, "Two different neighborIdx should not occur");
519 bjsNeighbor[lateralAxisIdx] = neighborIdx;
520 normalNormCoordinate[lateralAxisIdx] = lateralFace.center()[lateralAxisIdx];
521 bjsNumFaces[lateralAxisIdx]++;
522 }
523 }
524
2/2
✓ Branch 0 taken 1945344 times.
✓ Branch 1 taken 972672 times.
2918016 for (unsigned axisIdx = 0; axisIdx < dim; ++axisIdx)
525 {
526
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1945344 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1945344 times.
3890688 if (bjsNumFaces[axisIdx] == 0)
527 continue;
528
529 unsigned int neighborIdx = bjsNeighbor[axisIdx];
530 bjsVelocityAverage[axisIdx] /= bjsNumFaces[axisIdx];
531
532 velocityGradients_[elementIdx][velCompIdx][axisIdx]
533 = (ccVelocity(neighborIdx, velCompIdx) - bjsVelocityAverage[axisIdx])
534 / (cellCenter(neighborIdx)[axisIdx] - normalNormCoordinate[axisIdx]);
535 }
536 }
537 }
538 1078 }
539
540 1078 void calculateMaxMinVelocities_()
541 {
542 using std::abs;
543
2/2
✓ Branch 1 taken 941 times.
✓ Branch 2 taken 137 times.
1078 if (isFlatWallBounded())
544 {
545 // If the parameter isFlatWallBounded is set to true,
546 // the maximum/minimum velocities are calculated along a profile perpendicular to the corresponding wall face.
547
548 // re-initialize min and max values
549 4705 velocityMaximum_.assign(this->gridGeometry().elementMapper().size(), DimVector(1e-16));
550 4705 velocityMinimum_.assign(this->gridGeometry().elementMapper().size(), DimVector(std::numeric_limits<Scalar>::max()));
551
552 // For each profile perpendicular to the channel wall, find the max and minimum velocities
553
1/2
✓ Branch 3 taken 210157 times.
✗ Branch 4 not taken.
422196 for (const auto& element : elements(this->gridGeometry().gridView()))
554 {
555 627648 const unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
556 209216 Scalar maxVelocity = 0.0;
557 209216 const unsigned int wallElementIdx = wallElementIndex(elementIdx);
558
559
2/2
✓ Branch 0 taken 418432 times.
✓ Branch 1 taken 209216 times.
627648 for (unsigned int axisIdx = 0; axisIdx < dim; ++axisIdx)
560 {
561
12/12
✓ Branch 0 taken 251319 times.
✓ Branch 1 taken 167113 times.
✓ Branch 2 taken 251319 times.
✓ Branch 3 taken 167113 times.
✓ Branch 4 taken 251319 times.
✓ Branch 5 taken 167113 times.
✓ Branch 6 taken 251319 times.
✓ Branch 7 taken 167113 times.
✓ Branch 8 taken 251319 times.
✓ Branch 9 taken 167113 times.
✓ Branch 10 taken 251319 times.
✓ Branch 11 taken 167113 times.
2510592 if (abs(ccVelocity(elementIdx, axisIdx)) > abs(velocityMaximum_[wallElementIdx][axisIdx]))
562 753957 velocityMaximum_[wallElementIdx][axisIdx] = ccVelocity(elementIdx, axisIdx);
563
564
12/12
✓ Branch 0 taken 107654 times.
✓ Branch 1 taken 310778 times.
✓ Branch 2 taken 107654 times.
✓ Branch 3 taken 310778 times.
✓ Branch 4 taken 107654 times.
✓ Branch 5 taken 310778 times.
✓ Branch 6 taken 107654 times.
✓ Branch 7 taken 310778 times.
✓ Branch 8 taken 107654 times.
✓ Branch 9 taken 310778 times.
✓ Branch 10 taken 107654 times.
✓ Branch 11 taken 310778 times.
2510592 if (abs(ccVelocity(elementIdx, axisIdx)) < abs(velocityMinimum_[wallElementIdx][axisIdx]))
565 322962 velocityMinimum_[wallElementIdx][axisIdx] = ccVelocity(elementIdx, axisIdx);
566
567 // Set the flow direction axis as the direction of the max velocity
568
13/22
✓ Branch 1 taken 418432 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 418432 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 418432 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 418432 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 209450 times.
✓ Branch 12 taken 208982 times.
✓ Branch 13 taken 209450 times.
✓ Branch 14 taken 208982 times.
✓ Branch 15 taken 209450 times.
✓ Branch 16 taken 208982 times.
✓ Branch 17 taken 418432 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 208982 times.
✓ Branch 20 taken 209450 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1883178 if ((hasParam("RANS.FlowDirectionAxis") != 1) && (maxVelocity) < abs(ccVelocity(elementIdx, axisIdx)))
569 {
570 417964 maxVelocity = abs(ccVelocity(elementIdx, axisIdx));
571 417964 flowDirectionAxis_[elementIdx] = axisIdx;
572 }
573 }
574 }
575 }
576 else
577 {
578 // If the parameter isFlatWallBounded is set to false, or not set,
579 // the maximum/minimum velocities are calculated as a global max/min throughout the domain.
580
581 137 DimVector maxVelocity(0.0);
582 137 DimVector minVelocity(std::numeric_limits<Scalar>::max());
583 // Find the max and minimum velocities in the full domain
584
1/2
✓ Branch 3 taken 34089 times.
✗ Branch 4 not taken.
68315 for (const auto& element : elements(this->gridGeometry().gridView()))
585 {
586 67904 const unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
587
588
2/2
✓ Branch 1 taken 67904 times.
✓ Branch 2 taken 33952 times.
101856 for (unsigned int axisIdx = 0; axisIdx < dim; ++axisIdx)
589 {
590
10/10
✓ Branch 0 taken 3543 times.
✓ Branch 1 taken 64361 times.
✓ Branch 2 taken 3543 times.
✓ Branch 3 taken 64361 times.
✓ Branch 4 taken 3543 times.
✓ Branch 5 taken 64361 times.
✓ Branch 6 taken 3543 times.
✓ Branch 7 taken 64361 times.
✓ Branch 8 taken 3543 times.
✓ Branch 9 taken 64361 times.
339520 if (abs(ccVelocity(elementIdx, axisIdx)) > abs(maxVelocity[axisIdx]))
591 10629 maxVelocity[axisIdx] = ccVelocity(elementIdx, axisIdx);
592
593
10/10
✓ Branch 0 taken 2740 times.
✓ Branch 1 taken 65164 times.
✓ Branch 2 taken 2740 times.
✓ Branch 3 taken 65164 times.
✓ Branch 4 taken 2740 times.
✓ Branch 5 taken 65164 times.
✓ Branch 6 taken 2740 times.
✓ Branch 7 taken 65164 times.
✓ Branch 8 taken 2740 times.
✓ Branch 9 taken 65164 times.
339520 if (abs(ccVelocity(elementIdx, axisIdx)) < abs(minVelocity[axisIdx]))
594 8220 minVelocity[axisIdx] = ccVelocity(elementIdx, axisIdx);
595 }
596 }
597 548 velocityMaximum_.assign(this->gridGeometry().elementMapper().size(), maxVelocity);
598 548 velocityMinimum_.assign(this->gridGeometry().elementMapper().size(), minVelocity);
599 }
600 1078 }
601
602 1078 void calculateStressTensor_()
603 {
604
1/2
✓ Branch 3 taken 244246 times.
✗ Branch 4 not taken.
489570 for (const auto& element : elements(this->gridGeometry().gridView()))
605 {
606 729504 unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
607 243168 Dune::FieldMatrix<Scalar, GridView::dimension, GridView::dimension> stressTensor(0.0);
608
2/2
✓ Branch 0 taken 486336 times.
✓ Branch 1 taken 243168 times.
729504 for (unsigned int j = 0; j < dim; ++j)
609 {
610
2/2
✓ Branch 0 taken 972672 times.
✓ Branch 1 taken 486336 times.
1459008 for (unsigned int i = 0; i < dim; ++i)
611 {
612 2918016 stressTensor[j][i] = 0.5 * velocityGradient(elementIdx, j, i)
613 1945344 + 0.5 * velocityGradient(elementIdx, i, j);
614 }
615 }
616 243168 stressTensorScalarProduct_[elementIdx] = 0.0;
617
2/2
✓ Branch 0 taken 486336 times.
✓ Branch 1 taken 243168 times.
729504 for (unsigned int j = 0; j < dim; ++j)
618 {
619
2/2
✓ Branch 0 taken 972672 times.
✓ Branch 1 taken 486336 times.
1459008 for (unsigned int i = 0; i < dim; ++i)
620 {
621 4863360 stressTensorScalarProduct_[elementIdx] += stressTensor[j][i] * stressTensor[j][i];
622 }
623 }
624 }
625 1078 }
626
627 1078 void calculateVorticityTensor_()
628 {
629
1/2
✓ Branch 3 taken 244246 times.
✗ Branch 4 not taken.
489570 for (const auto& element : elements(this->gridGeometry().gridView()))
630 {
631 729504 unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
632 243168 Dune::FieldMatrix<Scalar, GridView::dimension, GridView::dimension> vorticityTensor(0.0);
633
2/2
✓ Branch 0 taken 486336 times.
✓ Branch 1 taken 243168 times.
729504 for (unsigned int j = 0; j < dim; ++j)
634 {
635
2/2
✓ Branch 0 taken 972672 times.
✓ Branch 1 taken 486336 times.
1459008 for (unsigned int i = 0; i < dim; ++i)
636 {
637 2918016 vorticityTensor[j][i] = 0.5 * velocityGradient(elementIdx, j, i)
638 1945344 - 0.5 * velocityGradient(elementIdx, i, j);
639 }
640 }
641 243168 vorticityTensorScalarProduct_[elementIdx] = 0.0;
642
2/2
✓ Branch 0 taken 486336 times.
✓ Branch 1 taken 243168 times.
729504 for (unsigned int j = 0; j < dim; ++j)
643 {
644
2/2
✓ Branch 0 taken 972672 times.
✓ Branch 1 taken 486336 times.
1459008 for (unsigned int i = 0; i < dim; ++i)
645 {
646 4863360 vorticityTensorScalarProduct_[elementIdx] += vorticityTensor[j][i] * vorticityTensor[j][i];
647 }
648 }
649 }
650 1078 }
651
652 template<class SolutionVector>
653 1078 void storeViscosities_(const SolutionVector& curSol)
654 {
655 // calculate or call all secondary variables
656
0/4
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
2156 auto fvGeometry = localView(this->gridGeometry());
657
1/9
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 244246 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
489570 for (const auto& element : elements(this->gridGeometry().gridView()))
658 {
659 729504 unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
660
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
243168 fvGeometry.bindElement(element);
661
4/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 243168 times.
✓ Branch 3 taken 243168 times.
✓ Branch 4 taken 243168 times.
✓ Branch 5 taken 243168 times.
972672 for (auto&& scv : scvs(fvGeometry))
662 {
663 243168 const int dofIdx = scv.dofIndex();
664 // construct a privars object from the cell center solution vector
665 486336 const auto& cellCenterPriVars = curSol[GridGeometry::cellCenterIdx()][dofIdx];
666 243168 PrimaryVariables priVars = makePriVarsFromCellCenterPriVars<PrimaryVariables>(cellCenterPriVars);
667
0/4
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
486336 auto elemSol = elementSolution<typename GridGeometry::LocalView>(std::move(priVars));
668
669 243168 VolumeVariables volVars;
670
1/2
✓ Branch 1 taken 243168 times.
✗ Branch 2 not taken.
243168 volVars.update(elemSol, asImp_(), element, scv);
671
2/4
✓ Branch 0 taken 243168 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 243168 times.
✗ Branch 3 not taken.
486336 storedDensity_[elementIdx] = volVars.density();
672
3/6
✓ Branch 0 taken 243168 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 243168 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 243168 times.
✗ Branch 5 not taken.
729504 storedViscosity_[elementIdx] = volVars.viscosity();
673 }
674 }
675 1078 }
676
677 const int fixedFlowDirectionAxis_ = getParam<int>("RANS.FlowDirectionAxis", 0);
678 const int fixedWallNormalAxis_ = getParam<int>("RANS.WallNormalAxis", 1);
679
680 std::vector<unsigned int> wallNormalAxis_;
681 std::vector<unsigned int> flowDirectionAxis_;
682 std::vector<Scalar> wallDistance_;
683 std::vector<unsigned int> wallElementIdx_;
684 std::vector<std::array<std::array<unsigned int, 2>, dim>> neighborIdx_;
685
686 std::vector<DimVector> velocity_;
687 std::vector<DimVector> velocityMaximum_;
688 std::vector<DimVector> velocityMinimum_;
689 std::vector<DimMatrix> velocityGradients_;
690
691 std::vector<Scalar> stressTensorScalarProduct_;
692 std::vector<Scalar> vorticityTensorScalarProduct_;
693
694 std::vector<Scalar> storedDensity_;
695 std::vector<Scalar> storedViscosity_;
696
697 //! Returns the implementation of the problem (i.e. static polymorphism)
698 Implementation &asImp_()
699 { return *static_cast<Implementation *>(this); }
700
701 //! \copydoc asImp_()
702 const Implementation &asImp_() const
703 { return *static_cast<const Implementation *>(this); }
704 };
705
706 } // end namespace Dumux
707
708 #endif
709