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-FileCopyrightText: 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 RANSNCTests | ||
10 | * \brief Flat plate test for the multi-component staggered grid Reynolds-averaged Navier-Stokes model. | ||
11 | */ | ||
12 | #ifndef DUMUX_RANS_NC_TEST_PROBLEM_HH | ||
13 | #define DUMUX_RANS_NC_TEST_PROBLEM_HH | ||
14 | |||
15 | #include <dumux/common/properties.hh> | ||
16 | #include <dumux/common/parameters.hh> | ||
17 | #include <dumux/common/timeloop.hh> | ||
18 | #include <dumux/common/numeqvector.hh> | ||
19 | |||
20 | #include <dumux/freeflow/rans/boundarytypes.hh> | ||
21 | #include <dumux/freeflow/turbulencemodel.hh> | ||
22 | #include <dumux/freeflow/turbulenceproperties.hh> | ||
23 | #include <dumux/freeflow/rans/zeroeq/problem.hh> | ||
24 | #include <dumux/freeflow/rans/oneeq/problem.hh> | ||
25 | #include <dumux/freeflow/rans/twoeq/komega/problem.hh> | ||
26 | #include <dumux/freeflow/rans/twoeq/sst/problem.hh> | ||
27 | #include <dumux/freeflow/rans/twoeq/lowrekepsilon/problem.hh> | ||
28 | #include <dumux/freeflow/rans/twoeq/kepsilon/problem.hh> | ||
29 | |||
30 | namespace Dumux { | ||
31 | |||
32 | /*! | ||
33 | * \ingroup RANSNCTests | ||
34 | * \brief Test problem for the one-phase model. | ||
35 | * | ||
36 | * Dry air is entering from the left side and flows above a 1-D a flat plate. | ||
37 | * In the middle of the inlet, water vapor is injected, which spreads by turbulent diffusion. | ||
38 | * For the non-isothermal model the bottom has a constant temperature | ||
39 | * which is higher than the initial and inlet temperature. | ||
40 | */ | ||
41 | template <class TypeTag> | ||
42 | class FlatPlateNCTestProblem : public RANSProblem<TypeTag> | ||
43 | { | ||
44 | using ParentType = RANSProblem<TypeTag>; | ||
45 | |||
46 | using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; | ||
47 | using FluidState = GetPropType<TypeTag, Properties::FluidState>; | ||
48 | using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; | ||
49 | using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; | ||
50 | using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; | ||
51 | using Scalar = GetPropType<TypeTag, Properties::Scalar>; | ||
52 | |||
53 | static constexpr auto dimWorld = GridGeometry::GridView::dimensionworld; | ||
54 | using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; | ||
55 | using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; | ||
56 | using BoundaryTypes = Dumux::RANSBoundaryTypes<ModelTraits, ModelTraits::numEq()>; | ||
57 | using Element = typename GridGeometry::GridView::template Codim<0>::Entity; | ||
58 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
59 | using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; | ||
60 | using SubControlVolume = typename FVElementGeometry::SubControlVolume; | ||
61 | using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; | ||
62 | |||
63 | using TimeLoopPtr = std::shared_ptr<CheckPointTimeLoop<Scalar>>; | ||
64 | |||
65 | static constexpr auto transportEqIdx = Indices::conti0EqIdx + 1; | ||
66 | static constexpr auto transportCompIdx = Indices::conti0EqIdx + 1; | ||
67 | |||
68 | public: | ||
69 | 15 | FlatPlateNCTestProblem(std::shared_ptr<const GridGeometry> gridGeometry) | |
70 |
2/4✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 15 times.
✗ Branch 7 not taken.
|
45 | : ParentType(gridGeometry), eps_(1e-6) |
71 | { | ||
72 |
1/2✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
|
15 | inletVelocity_ = getParam<Scalar>("Problem.InletVelocity", 0.1); |
73 |
1/2✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
|
15 | inletTemperature_ = getParam<Scalar>("Problem.InletTemperature", 283.15); |
74 |
1/2✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
|
15 | wallTemperature_ = getParam<Scalar>("Problem.WallTemperature", 313.15); |
75 |
2/4✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
|
15 | inletMoleFraction_ = getParam<Scalar>("Problem.InletMoleFraction", 1e-3); |
76 | |||
77 | FluidSystem::init(); | ||
78 | Dumux::TurbulenceProperties<Scalar, dimWorld, true> turbulenceProperties; | ||
79 | 15 | FluidState fluidState; | |
80 |
1/2✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
|
15 | const auto phaseIdx = 0; |
81 | 15 | fluidState.setPressure(phaseIdx, 1e5); | |
82 |
1/2✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
|
15 | fluidState.setTemperature(this->spatialParams().temperatureAtPos({})); |
83 |
1/2✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
|
15 | fluidState.setMassFraction(phaseIdx, phaseIdx, 1.0); |
84 |
1/2✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
|
15 | Scalar density = FluidSystem::density(fluidState, phaseIdx); |
85 | 15 | Scalar kinematicViscosity = FluidSystem::viscosity(fluidState, phaseIdx) / density; | |
86 |
1/2✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
|
15 | Scalar diameter = this->gridGeometry().bBoxMax()[1] - this->gridGeometry().bBoxMin()[1]; |
87 |
1/2✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
|
15 | viscosityTilde_ = 1e-3 * turbulenceProperties.viscosityTilde(inletVelocity_, diameter, kinematicViscosity); |
88 |
1/2✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
|
15 | turbulentKineticEnergy_ = turbulenceProperties.turbulentKineticEnergy(inletVelocity_, diameter, kinematicViscosity); |
89 | if (ModelTraits::turbulenceModel() == TurbulenceModel::komega || ModelTraits::turbulenceModel() == TurbulenceModel::sst) | ||
90 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | dissipation_ = turbulenceProperties.dissipationRate(inletVelocity_, diameter, kinematicViscosity); |
91 | else | ||
92 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
10 | dissipation_ = turbulenceProperties.dissipation(inletVelocity_, diameter, kinematicViscosity); |
93 |
1/2✓ Branch 3 taken 15 times.
✗ Branch 4 not taken.
|
15 | turbulenceModelName_ = turbulenceModelToString(ModelTraits::turbulenceModel()); |
94 |
2/4✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
|
15 | std::cout << "Using the "<< turbulenceModelName_ << " Turbulence Model. \n"; |
95 | 15 | std::cout << std::endl; | |
96 | 15 | } | |
97 | |||
98 | /*! | ||
99 | * \name Boundary conditions | ||
100 | */ | ||
101 | // \{ | ||
102 | |||
103 | /*! | ||
104 | * \brief Specifies which kind of boundary condition should be | ||
105 | * used for which equation on a given boundary control volume. | ||
106 | * | ||
107 | * \param globalPos The position of the center of the finite volume | ||
108 | */ | ||
109 | 176974608 | BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const | |
110 | { | ||
111 | 176974608 | BoundaryTypes values; | |
112 | |||
113 | // turbulence model-specific boundary types | ||
114 |
2/2✓ Branch 0 taken 1059880 times.
✓ Branch 1 taken 8461529 times.
|
176974608 | setBcTypes_(values, globalPos); |
115 | |||
116 |
2/2✓ Branch 0 taken 1059880 times.
✓ Branch 1 taken 8461529 times.
|
176974608 | if(isInlet_(globalPos)) |
117 | { | ||
118 | 11206829 | values.setDirichlet(Indices::velocityXIdx); | |
119 | 11206829 | values.setDirichlet(Indices::velocityYIdx); | |
120 | 11206829 | values.setDirichlet(transportCompIdx); | |
121 | #if NONISOTHERMAL | ||
122 | 6263609 | values.setDirichlet(Indices::temperatureIdx); | |
123 | #endif | ||
124 | } | ||
125 |
2/2✓ Branch 0 taken 14050302 times.
✓ Branch 1 taken 151717477 times.
|
165767779 | else if(isOutlet_(globalPos)) |
126 | { | ||
127 | 14050302 | values.setDirichlet(Indices::pressureIdx); | |
128 | 14050302 | values.setOutflow(transportEqIdx); | |
129 | #if NONISOTHERMAL | ||
130 | 7658378 | values.setOutflow(Indices::energyEqIdx); | |
131 | #endif | ||
132 | } | ||
133 | 151717477 | else if(isLowerWall_(globalPos)) | |
134 | { | ||
135 | 5981400 | values.setWall(); | |
136 | 5981400 | values.setNeumann(transportEqIdx); | |
137 | #if NONISOTHERMAL | ||
138 | 3346255 | values.setDirichlet(Indices::temperatureIdx); | |
139 | #endif | ||
140 | } | ||
141 | else | ||
142 | 145736077 | values.setAllSymmetry(); | |
143 | |||
144 | 176974608 | return values; | |
145 | } | ||
146 | |||
147 | /*! | ||
148 | * \brief Returns whether a fixed Dirichlet value shall be used inside a given cell. | ||
149 | * | ||
150 | * \param element The finite element | ||
151 | * \param fvGeometry The finite-volume geometry | ||
152 | * \param scv The sub control volume | ||
153 | * \param pvIdx The primary variable index in the solution vector | ||
154 | */ | ||
155 | template<class Element, class FVElementGeometry, class SubControlVolume> | ||
156 | 36655960 | bool isDirichletCell(const Element& element, | |
157 | const FVElementGeometry& fvGeometry, | ||
158 | const SubControlVolume& scv, | ||
159 | int pvIdx) const | ||
160 |
4/4✓ Branch 0 taken 243296 times.
✓ Branch 1 taken 25855424 times.
✓ Branch 2 taken 199460 times.
✓ Branch 3 taken 500540 times.
|
36655960 | { return isDirichletCell_(element, fvGeometry, scv, pvIdx); } |
161 | |||
162 | /*! | ||
163 | * \brief Evaluate the boundary conditions for dirichlet values at the given boundary. | ||
164 | * | ||
165 | * \param element The finite element | ||
166 | * \param scvf the sub control volume face | ||
167 | * \note used for cell-centered discretization schemes | ||
168 | */ | ||
169 | 7625060 | PrimaryVariables dirichlet(const Element& element, const SubControlVolumeFace& scvf) const | |
170 | { | ||
171 | 7625060 | const auto globalPos = scvf.ipGlobal(); | |
172 | 7625060 | PrimaryVariables values(initialAtPos(globalPos)); | |
173 | |||
174 | 7625060 | if (isInlet_(globalPos) | |
175 |
2/2✓ Branch 0 taken 530302 times.
✓ Branch 1 taken 3773106 times.
|
4303408 | && globalPos[1] > 0.4 * this->gridGeometry().bBoxMax()[1] |
176 |
2/2✓ Branch 0 taken 225894 times.
✓ Branch 1 taken 304408 times.
|
530302 | && globalPos[1] < 0.6 * this->gridGeometry().bBoxMax()[1]) |
177 | { | ||
178 |
2/2✓ Branch 0 taken 81242 times.
✓ Branch 1 taken 144652 times.
|
225894 | values[transportCompIdx] = (time() > 10.0) ? inletMoleFraction_ : 0.0; |
179 | } | ||
180 | |||
181 | #if NONISOTHERMAL | ||
182 |
4/4✓ Branch 0 taken 1174012 times.
✓ Branch 1 taken 2595464 times.
✓ Branch 2 taken 452758 times.
✓ Branch 3 taken 721254 times.
|
3769476 | values[Indices::temperatureIdx] = (isLowerWall_(globalPos) && time() > 10.0) ? wallTemperature_ : inletTemperature_; |
183 | #endif | ||
184 | |||
185 | 7625060 | return values; | |
186 | } | ||
187 | |||
188 | /*! | ||
189 | * \brief Evaluate the boundary conditions for fixed values at cell centers | ||
190 | * | ||
191 | * \param element The finite element | ||
192 | * \param scv the sub control volume | ||
193 | * \note used for cell-centered discretization schemes | ||
194 | */ | ||
195 | 2764866 | PrimaryVariables dirichlet([[maybe_unused]] const Element& element, const SubControlVolume& scv) const | |
196 | { | ||
197 | if constexpr (ModelTraits::turbulenceModel() == TurbulenceModel::kepsilon | ||
198 | || ModelTraits::turbulenceModel() == TurbulenceModel::komega | ||
199 | || ModelTraits::turbulenceModel() == TurbulenceModel::sst) | ||
200 | 2764866 | return dirichletTurbulentTwoEq_(element, scv); | |
201 | else | ||
202 | { | ||
203 | const auto globalPos = scv.center(); | ||
204 | PrimaryVariables values(initialAtPos(globalPos)); | ||
205 | return values; | ||
206 | } | ||
207 | } | ||
208 | |||
209 | /*! | ||
210 | * \brief Evaluates the initial value for a given position. | ||
211 | * | ||
212 | * \param globalPos The global position | ||
213 | */ | ||
214 | 40293574 | PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const | |
215 | { | ||
216 |
6/6✓ Branch 0 taken 5326606 times.
✓ Branch 1 taken 2298454 times.
✓ Branch 2 taken 1580 times.
✓ Branch 3 taken 2320 times.
✓ Branch 4 taken 9070 times.
✓ Branch 5 taken 130 times.
|
9404468 | PrimaryVariables values(0.0); |
217 | 10403426 | values[Indices::pressureIdx] = 1.0e+5; | |
218 | values[transportCompIdx] = 0.0; | ||
219 | #if NONISOTHERMAL | ||
220 | 5096866 | values[Indices::temperatureIdx] = inletTemperature_; | |
221 | #endif | ||
222 | // block velocity profile | ||
223 | 39925066 | values[Indices::velocityXIdx] = 0.0; | |
224 | 51289810 | if (!isLowerWall_(globalPos)) | |
225 | 8102122 | values[Indices::velocityXIdx] = inletVelocity_; | |
226 | 50513786 | values[Indices::velocityYIdx] = 0.0; | |
227 | |||
228 | // turbulence model-specific initial conditions | ||
229 | 36224050 | setInitialAtPos_(values, globalPos); | |
230 | return values; | ||
231 | } | ||
232 | |||
233 | // \} | ||
234 | |||
235 | 15 | void setTimeLoop(TimeLoopPtr timeLoop) | |
236 |
1/2✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
|
15 | { timeLoop_ = timeLoop; } |
237 | |||
238 | 1399906 | Scalar time() const | |
239 |
4/4✓ Branch 0 taken 81242 times.
✓ Branch 1 taken 144652 times.
✓ Branch 2 taken 452758 times.
✓ Branch 3 taken 721254 times.
|
1399906 | { return timeLoop_->time(); } |
240 | |||
241 | private: | ||
242 |
4/4✓ Branch 0 taken 4303408 times.
✓ Branch 1 taken 3321652 times.
✓ Branch 2 taken 10146949 times.
✓ Branch 3 taken 157306250 times.
|
175078259 | bool isInlet_(const GlobalPosition& globalPos) const |
243 |
4/4✓ Branch 0 taken 4303408 times.
✓ Branch 1 taken 3321652 times.
✓ Branch 2 taken 10146949 times.
✓ Branch 3 taken 157306250 times.
|
175078259 | { return globalPos[0] < eps_; } |
244 | |||
245 |
2/2✓ Branch 0 taken 12602283 times.
✓ Branch 1 taken 144703967 times.
|
166827659 | bool isOutlet_(const GlobalPosition& globalPos) const |
246 |
4/4✓ Branch 0 taken 14050302 times.
✓ Branch 1 taken 162309766 times.
✓ Branch 2 taken 13179865 times.
✓ Branch 3 taken 151206197 times.
|
340746130 | { return globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_; } |
247 | |||
248 |
10/10✓ Branch 0 taken 4764594 times.
✓ Branch 1 taken 786806 times.
✓ Branch 2 taken 4706709 times.
✓ Branch 3 taken 15402713 times.
✓ Branch 4 taken 4603149 times.
✓ Branch 5 taken 131845832 times.
✓ Branch 6 taken 3160 times.
✓ Branch 7 taken 1540 times.
✓ Branch 8 taken 5910 times.
✓ Branch 9 taken 90 times.
|
162120503 | bool isLowerWall_(const GlobalPosition& globalPos) const |
249 |
8/8✓ Branch 0 taken 4764594 times.
✓ Branch 1 taken 786806 times.
✓ Branch 2 taken 4706709 times.
✓ Branch 3 taken 15402713 times.
✓ Branch 4 taken 4606309 times.
✓ Branch 5 taken 131845072 times.
✓ Branch 6 taken 5910 times.
✓ Branch 7 taken 90 times.
|
162118203 | { return globalPos[1] < eps_; } |
250 | |||
251 | //! Initial conditions for the komega, kepsilon and lowrekepsilon turbulence models | ||
252 | 9711810 | void setInitialAtPos_([[maybe_unused]] PrimaryVariables& values, | |
253 | [[maybe_unused]] const GlobalPosition &globalPos) const | ||
254 | { | ||
255 | if constexpr (numTurbulenceEq(ModelTraits::turbulenceModel()) == 0) // zero equation models | ||
256 | return; | ||
257 | else if constexpr (numTurbulenceEq(ModelTraits::turbulenceModel()) == 1) // one equation models | ||
258 | { | ||
259 |
4/4✓ Branch 0 taken 289606 times.
✓ Branch 1 taken 735768 times.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 1580 times.
|
1026974 | values[Indices::viscosityTildeIdx] = viscosityTilde_; |
260 |
5/6✓ Branch 0 taken 289606 times.
✓ Branch 1 taken 735768 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 400 times.
✓ Branch 4 taken 20 times.
✓ Branch 5 taken 1580 times.
|
1027374 | if (isLowerWall_(globalPos)) |
261 | 289626 | values[Indices::viscosityTildeIdx] = 0.0; | |
262 | } | ||
263 | else // two equation models | ||
264 | { | ||
265 | static_assert(numTurbulenceEq(ModelTraits::turbulenceModel()) == 2, "Only reached by 2eq models"); | ||
266 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 243296 times.
|
2795512 | values[Indices::turbulentKineticEnergyIdx] = turbulentKineticEnergy_; |
267 |
6/6✓ Branch 0 taken 1253202 times.
✓ Branch 1 taken 5702266 times.
✓ Branch 2 taken 561312 times.
✓ Branch 3 taken 920460 times.
✓ Branch 4 taken 40 times.
✓ Branch 5 taken 1960 times.
|
8439240 | values[Indices::dissipationIdx] = dissipation_; |
268 |
8/8✓ Branch 0 taken 302796 times.
✓ Branch 1 taken 3533614 times.
✓ Branch 2 taken 1511648 times.
✓ Branch 3 taken 3327278 times.
✓ Branch 4 taken 20 times.
✓ Branch 5 taken 3080 times.
✓ Branch 6 taken 90 times.
✓ Branch 7 taken 5910 times.
|
8684436 | if (isLowerWall_(globalPos)) |
269 | { | ||
270 | 864098 | values[Indices::turbulentKineticEnergyIdx] = 0.0; | |
271 | 1814554 | values[Indices::dissipationIdx] = 0.0; | |
272 | } | ||
273 | } | ||
274 | } | ||
275 | |||
276 | //! Boundary condition types for the one-eq turbulence model | ||
277 |
2/2✓ Branch 0 taken 13179865 times.
✓ Branch 1 taken 161798486 times.
|
174978351 | void setBcTypes_([[maybe_unused]] BoundaryTypes& values, |
278 | [[maybe_unused]] const GlobalPosition& pos) const | ||
279 | { | ||
280 | if constexpr (numTurbulenceEq(ModelTraits::turbulenceModel()) == 0) // zero equation models | ||
281 | return; | ||
282 | else if constexpr (numTurbulenceEq(ModelTraits::turbulenceModel()) == 1) // one equation models | ||
283 | { | ||
284 |
2/2✓ Branch 0 taken 1448019 times.
✓ Branch 1 taken 8073390 times.
|
9521409 | if(isOutlet_(pos)) |
285 | 1448019 | values.setOutflow(Indices::viscosityTildeIdx); | |
286 | else // walls and inflow | ||
287 | 8073390 | values.setDirichlet(Indices::viscosityTildeIdx); | |
288 | } | ||
289 | else // two equation models | ||
290 | { | ||
291 | static_assert(numTurbulenceEq(ModelTraits::turbulenceModel()) == 2, "Only reached by 2eq models"); | ||
292 |
2/2✓ Branch 0 taken 11731846 times.
✓ Branch 1 taken 153725096 times.
|
165456942 | if(isOutlet_(pos)) |
293 | { | ||
294 | 11731846 | values.setOutflow(Indices::turbulentKineticEnergyEqIdx); | |
295 | 11731846 | values.setOutflow(Indices::dissipationEqIdx); | |
296 | } | ||
297 | else | ||
298 | { | ||
299 | // walls and inflow | ||
300 | 153725096 | values.setDirichlet(Indices::turbulentKineticEnergyIdx); | |
301 | 153725096 | values.setDirichlet(Indices::dissipationIdx); | |
302 | } | ||
303 | } | ||
304 | 165456942 | } | |
305 | |||
306 | template<class Element, class FVElementGeometry, class SubControlVolume> | ||
307 | 36655960 | bool isDirichletCell_([[maybe_unused]] const Element& element, | |
308 | const FVElementGeometry& fvGeometry, | ||
309 | [[maybe_unused]] const SubControlVolume& scv, | ||
310 | const int& pvIdx) const | ||
311 | { | ||
312 | if constexpr (ModelTraits::turbulenceModel() == TurbulenceModel::kepsilon) | ||
313 | { | ||
314 | 10051040 | const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element); | |
315 | // For the kepsilon model we set fixed values within the matching point and at the wall | ||
316 |
2/2✓ Branch 1 taken 5421184 times.
✓ Branch 2 taken 4629856 times.
|
10051040 | if (this->inNearWallRegion(eIdx)) |
317 | 5421184 | return pvIdx == Indices::turbulentKineticEnergyEqIdx || pvIdx == Indices::dissipationEqIdx; | |
318 |
2/2✓ Branch 1 taken 658302 times.
✓ Branch 2 taken 3971554 times.
|
4629856 | if (this->isMatchingPoint(eIdx)) |
319 | 658302 | return pvIdx == Indices::dissipationEqIdx; | |
320 | return false; | ||
321 | } | ||
322 | else if constexpr (ModelTraits::turbulenceModel() == TurbulenceModel::komega || | ||
323 | ModelTraits::turbulenceModel() == TurbulenceModel::sst ) | ||
324 | { | ||
325 | // For the komega model we set a fixed dissipation (omega) for all cells at the wall | ||
326 |
2/2✓ Branch 0 taken 106170724 times.
✓ Branch 1 taken 26355964 times.
|
132526688 | for (const auto& scvf : scvfs(fvGeometry)) |
327 |
4/4✓ Branch 0 taken 1123984 times.
✓ Branch 1 taken 105046740 times.
✓ Branch 2 taken 248956 times.
✓ Branch 3 taken 875028 times.
|
106170724 | if (this->boundaryTypes(element, scvf).hasWall() && pvIdx == Indices::dissipationIdx) |
328 | 248956 | return true; | |
329 | return false; | ||
330 | } | ||
331 | else | ||
332 | return ParentType::isDirichletCell(element, fvGeometry, scv, pvIdx); | ||
333 | } | ||
334 | |||
335 | //! Specialization for the kepsilon and komega | ||
336 | template<class Element, class SubControlVolume> | ||
337 | 2764866 | PrimaryVariables dirichletTurbulentTwoEq_(const Element& element, | |
338 | const SubControlVolume& scv) const | ||
339 | { | ||
340 |
1/2✓ Branch 0 taken 2764866 times.
✗ Branch 1 not taken.
|
2764866 | const auto globalPos = scv.center(); |
341 | 2764866 | PrimaryVariables values(initialAtPos(globalPos)); | |
342 | 2764866 | unsigned int elementIdx = this->gridGeometry().elementMapper().index(element); | |
343 | |||
344 | if constexpr (ModelTraits::turbulenceModel() == TurbulenceModel::kepsilon) | ||
345 | { | ||
346 | // For the kepsilon model we set a fixed value for the turbulent kinetic energy and the dissipation | ||
347 | 2521570 | values[Indices::turbulentKineticEnergyEqIdx] = this->turbulentKineticEnergyWallFunction(elementIdx); | |
348 | 2521570 | values[Indices::dissipationEqIdx] = this->dissipationWallFunction(elementIdx); | |
349 | 2521570 | return values; | |
350 | } | ||
351 | else | ||
352 | { | ||
353 | static_assert(ModelTraits::turbulenceModel() == TurbulenceModel::komega || | ||
354 | ModelTraits::turbulenceModel() == TurbulenceModel::sst, "Only valid for SST and KOmega Models"); | ||
355 | // For the komega model we set a fixed value for the dissipation | ||
356 | 243296 | const auto wallDistance = ParentType::wallDistance(elementIdx); | |
357 | using std::pow; | ||
358 | 243296 | values[Indices::dissipationEqIdx] = 6.0 * ParentType::kinematicViscosity(elementIdx) | |
359 | 243296 | / (ParentType::betaOmega() * wallDistance * wallDistance); | |
360 | 243296 | return values; | |
361 | } | ||
362 | } | ||
363 | |||
364 | const Scalar eps_; | ||
365 | Scalar inletVelocity_; | ||
366 | Scalar inletMoleFraction_; | ||
367 | Scalar inletTemperature_; | ||
368 | Scalar wallTemperature_; | ||
369 | Scalar viscosityTilde_; | ||
370 | Scalar turbulentKineticEnergy_; | ||
371 | Scalar dissipation_; | ||
372 | TimeLoopPtr timeLoop_; | ||
373 | std::string turbulenceModelName_; | ||
374 | }; | ||
375 | } // end namespace Dumux | ||
376 | |||
377 | #endif | ||
378 |