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 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 | 14 | FlatPlateNCTestProblem(std::shared_ptr<const GridGeometry> gridGeometry) | |
70 |
8/22✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 14 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 14 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 14 times.
✓ Branch 15 taken 14 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 14 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 14 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
|
42 | : ParentType(gridGeometry), eps_(1e-6) |
71 | { | ||
72 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | inletVelocity_ = getParam<Scalar>("Problem.InletVelocity", 0.1); |
73 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | inletTemperature_ = getParam<Scalar>("Problem.InletTemperature", 283.15); |
74 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | wallTemperature_ = getParam<Scalar>("Problem.WallTemperature", 313.15); |
75 |
1/4✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
14 | inletMoleFraction_ = getParam<Scalar>("Problem.InletMoleFraction", 1e-3); |
76 | |||
77 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | FluidSystem::init(); |
78 | Dumux::TurbulenceProperties<Scalar, dimWorld, true> turbulenceProperties; | ||
79 | 14 | FluidState fluidState; | |
80 | 14 | const auto phaseIdx = 0; | |
81 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | fluidState.setPressure(phaseIdx, 1e5); |
82 |
2/4✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
|
28 | fluidState.setTemperature(this->spatialParams().temperatureAtPos({})); |
83 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | fluidState.setMassFraction(phaseIdx, phaseIdx, 1.0); |
84 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | Scalar density = FluidSystem::density(fluidState, phaseIdx); |
85 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | Scalar kinematicViscosity = FluidSystem::viscosity(fluidState, phaseIdx) / density; |
86 |
6/12✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 14 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 14 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 14 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 14 times.
✗ Branch 17 not taken.
|
84 | Scalar diameter = this->gridGeometry().bBoxMax()[1] - this->gridGeometry().bBoxMin()[1]; |
87 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | viscosityTilde_ = 1e-3 * turbulenceProperties.viscosityTilde(inletVelocity_, diameter, kinematicViscosity); |
88 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | turbulentKineticEnergy_ = turbulenceProperties.turbulentKineticEnergy(inletVelocity_, diameter, kinematicViscosity); |
89 | 14 | if (ModelTraits::turbulenceModel() == TurbulenceModel::komega || ModelTraits::turbulenceModel() == TurbulenceModel::sst) | |
90 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | dissipation_ = turbulenceProperties.dissipationRate(inletVelocity_, diameter, kinematicViscosity); |
91 | else | ||
92 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | dissipation_ = turbulenceProperties.dissipation(inletVelocity_, diameter, kinematicViscosity); |
93 |
2/4✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 14 times.
|
14 | turbulenceModelName_ = turbulenceModelToString(ModelTraits::turbulenceModel()); |
94 |
2/4✓ Branch 2 taken 14 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 14 times.
✗ Branch 6 not taken.
|
28 | std::cout << "Using the "<< turbulenceModelName_ << " Turbulence Model. \n"; |
95 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | std::cout << std::endl; |
96 | 14 | } | |
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 | 169636110 | BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const | |
110 | { | ||
111 | 169636110 | BoundaryTypes values; | |
112 | |||
113 | // turbulence model-specific boundary types | ||
114 | 179157519 | setBcTypes_(values, globalPos); | |
115 | |||
116 | 339272220 | if(isInlet_(globalPos)) | |
117 | { | ||
118 | 10887338 | values.setDirichlet(Indices::velocityXIdx); | |
119 | 10887338 | values.setDirichlet(Indices::velocityYIdx); | |
120 | 10887338 | values.setDirichlet(transportCompIdx); | |
121 | #if NONISOTHERMAL | ||
122 | 5944118 | values.setDirichlet(Indices::temperatureIdx); | |
123 | #endif | ||
124 | } | ||
125 | 317497544 | else if(isOutlet_(globalPos)) | |
126 | { | ||
127 | 13668887 | values.setDirichlet(Indices::pressureIdx); | |
128 | 13668887 | values.setOutflow(transportEqIdx); | |
129 | #if NONISOTHERMAL | ||
130 | 7276963 | values.setOutflow(Indices::energyEqIdx); | |
131 | #endif | ||
132 | } | ||
133 | 290159770 | else if(isLowerWall_(globalPos)) | |
134 | { | ||
135 | 5824854 | values.setWall(); | |
136 | 5824854 | values.setNeumann(transportEqIdx); | |
137 | #if NONISOTHERMAL | ||
138 | 3189709 | values.setDirichlet(Indices::temperatureIdx); | |
139 | #endif | ||
140 | } | ||
141 | else | ||
142 | values.setAllSymmetry(); | ||
143 | |||
144 | 169636110 | 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 | ✗ | bool isDirichletCell(const Element& element, | |
157 | const FVElementGeometry& fvGeometry, | ||
158 | const SubControlVolume& scv, | ||
159 | int pvIdx) const | ||
160 | 35230960 | { 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 | 7465220 | PrimaryVariables dirichlet(const Element& element, const SubControlVolumeFace& scvf) const | |
170 | { | ||
171 | 7465220 | const auto globalPos = scvf.ipGlobal(); | |
172 | 14930440 | PrimaryVariables values(initialAtPos(globalPos)); | |
173 | |||
174 | if (isInlet_(globalPos) | ||
175 |
10/10✓ Branch 0 taken 519603 times.
✓ Branch 1 taken 3691245 times.
✓ Branch 2 taken 519603 times.
✓ Branch 3 taken 3691245 times.
✓ Branch 4 taken 519603 times.
✓ Branch 5 taken 3691245 times.
✓ Branch 6 taken 519603 times.
✓ Branch 7 taken 3691245 times.
✓ Branch 8 taken 519603 times.
✓ Branch 9 taken 3691245 times.
|
21054240 | && globalPos[1] > 0.4 * this->gridGeometry().bBoxMax()[1] |
176 |
10/10✓ Branch 0 taken 221061 times.
✓ Branch 1 taken 298542 times.
✓ Branch 2 taken 221061 times.
✓ Branch 3 taken 298542 times.
✓ Branch 4 taken 221061 times.
✓ Branch 5 taken 298542 times.
✓ Branch 6 taken 221061 times.
✓ Branch 7 taken 298542 times.
✓ Branch 8 taken 221061 times.
✓ Branch 9 taken 298542 times.
|
2598015 | && globalPos[1] < 0.6 * this->gridGeometry().bBoxMax()[1]) |
177 | { | ||
178 | 364933 | values[transportCompIdx] = (time() > 10.0) ? inletMoleFraction_ : 0.0; | |
179 | } | ||
180 | |||
181 | #if NONISOTHERMAL | ||
182 | 3609636 | values[Indices::temperatureIdx] = (isLowerWall_(globalPos) && time() > 10.0) ? wallTemperature_ : inletTemperature_; | |
183 | #endif | ||
184 | |||
185 | 7465220 | 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 | ✗ | 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 | 2753116 | 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 | PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const | ||
215 | { | ||
216 | 47486404 | PrimaryVariables values(0.0); | |
217 |
9/12✓ Branch 0 taken 35355750 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1349622 times.
✓ Branch 3 taken 194404 times.
✓ Branch 4 taken 2753516 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4718314 times.
✓ Branch 7 taken 2058890 times.
✓ Branch 8 taken 2100 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 8280 times.
✓ Branch 11 taken 120 times.
|
50153112 | values[Indices::pressureIdx] = 1.0e+5; |
218 |
9/12✓ Branch 0 taken 35355750 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1349622 times.
✓ Branch 3 taken 194404 times.
✓ Branch 4 taken 2753516 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4718314 times.
✓ Branch 7 taken 2058890 times.
✓ Branch 8 taken 2100 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 8280 times.
✓ Branch 11 taken 120 times.
|
50153112 | values[transportCompIdx] = 0.0; |
219 | #if NONISOTHERMAL | ||
220 |
9/12✓ Branch 0 taken 16621056 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 664968 times.
✓ Branch 3 taken 102172 times.
✓ Branch 4 taken 1308590 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2221554 times.
✓ Branch 7 taken 1026670 times.
✓ Branch 8 taken 1050 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 4140 times.
✓ Branch 11 taken 60 times.
|
23896468 | values[Indices::temperatureIdx] = inletTemperature_; |
221 | #endif | ||
222 | // block velocity profile | ||
223 |
9/12✓ Branch 0 taken 35355750 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1349622 times.
✓ Branch 3 taken 194404 times.
✓ Branch 4 taken 2753516 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4718314 times.
✓ Branch 7 taken 2058890 times.
✓ Branch 8 taken 2100 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 8280 times.
✓ Branch 11 taken 120 times.
|
50153112 | values[Indices::velocityXIdx] = 0.0; |
224 | 100479040 | if (!isLowerWall_(globalPos)) | |
225 | 88375164 | values[Indices::velocityXIdx] = inletVelocity_; | |
226 |
7/8✓ Branch 0 taken 401184 times.
✓ Branch 1 taken 3041548 times.
✓ Branch 2 taken 2058870 times.
✓ Branch 3 taken 4716734 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2100 times.
✓ Branch 6 taken 120 times.
✓ Branch 7 taken 8280 times.
|
45586586 | values[Indices::velocityYIdx] = 0.0; |
227 | |||
228 | // turbulence model-specific initial conditions | ||
229 | 3724616 | setInitialAtPos_(values, globalPos); | |
230 | return values; | ||
231 | } | ||
232 | |||
233 | // \} | ||
234 | |||
235 | void setTimeLoop(TimeLoopPtr timeLoop) | ||
236 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | { timeLoop_ = timeLoop; } |
237 | |||
238 | Scalar time() const | ||
239 |
12/12✓ Branch 0 taken 77189 times.
✓ Branch 1 taken 143872 times.
✓ Branch 2 taken 77189 times.
✓ Branch 3 taken 143872 times.
✓ Branch 4 taken 77189 times.
✓ Branch 5 taken 143872 times.
✓ Branch 6 taken 414860 times.
✓ Branch 7 taken 713972 times.
✓ Branch 8 taken 414860 times.
✓ Branch 9 taken 713972 times.
✓ Branch 10 taken 414860 times.
✓ Branch 11 taken 713972 times.
|
4049679 | { return timeLoop_->time(); } |
240 | |||
241 | private: | ||
242 | ✗ | bool isInlet_(const GlobalPosition& globalPos) const | |
243 |
8/8✓ Branch 0 taken 4210848 times.
✓ Branch 1 taken 3254372 times.
✓ Branch 2 taken 4210848 times.
✓ Branch 3 taken 3254372 times.
✓ Branch 4 taken 10887338 times.
✓ Branch 5 taken 158748772 times.
✓ Branch 6 taken 10887338 times.
✓ Branch 7 taken 158748772 times.
|
354202660 | { return globalPos[0] < eps_; } |
244 | |||
245 | bool isOutlet_(const GlobalPosition& globalPos) const | ||
246 |
16/16✓ Branch 0 taken 13668887 times.
✓ Branch 1 taken 155352683 times.
✓ Branch 2 taken 13668887 times.
✓ Branch 3 taken 155352683 times.
✓ Branch 4 taken 13668887 times.
✓ Branch 5 taken 155352683 times.
✓ Branch 6 taken 13668887 times.
✓ Branch 7 taken 145079885 times.
✓ Branch 8 taken 13668887 times.
✓ Branch 9 taken 145079885 times.
✓ Branch 10 taken 12798450 times.
✓ Branch 11 taken 144568605 times.
✓ Branch 12 taken 12798450 times.
✓ Branch 13 taken 144568605 times.
✓ Branch 14 taken 12798450 times.
✓ Branch 15 taken 144568605 times.
|
1296663419 | { return globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_; } |
247 | |||
248 | ✗ | bool isLowerWall_(const GlobalPosition& globalPos) const | |
249 |
30/32✓ Branch 0 taken 35355750 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35355750 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1349622 times.
✓ Branch 5 taken 194404 times.
✓ Branch 6 taken 1349622 times.
✓ Branch 7 taken 194404 times.
✓ Branch 8 taken 2954002 times.
✓ Branch 9 taken 378840 times.
✓ Branch 10 taken 2954002 times.
✓ Branch 11 taken 378840 times.
✓ Branch 12 taken 4827565 times.
✓ Branch 13 taken 2242005 times.
✓ Branch 14 taken 4827565 times.
✓ Branch 15 taken 2242005 times.
✓ Branch 16 taken 66733812 times.
✓ Branch 17 taken 4737119 times.
✓ Branch 18 taken 66733812 times.
✓ Branch 19 taken 4737119 times.
✓ Branch 20 taken 73341364 times.
✓ Branch 21 taken 3006584 times.
✓ Branch 22 taken 73341364 times.
✓ Branch 23 taken 3006584 times.
✓ Branch 24 taken 5190 times.
✓ Branch 25 taken 60 times.
✓ Branch 26 taken 5190 times.
✓ Branch 27 taken 60 times.
✓ Branch 28 taken 4140 times.
✓ Branch 29 taken 60 times.
✓ Branch 30 taken 4140 times.
✓ Branch 31 taken 60 times.
|
397685266 | { return globalPos[1] < eps_; } |
250 | |||
251 | //! Initial conditions for the komega, kepsilon and lowrekepsilon turbulence models | ||
252 | ✗ | 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 |
5/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 289606 times.
✓ Branch 3 taken 735768 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 400 times.
✓ Branch 6 taken 20 times.
✓ Branch 7 taken 1580 times.
|
6534138 | values[Indices::viscosityTildeIdx] = viscosityTilde_; |
260 |
10/16✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 289606 times.
✓ Branch 5 taken 735768 times.
✓ Branch 6 taken 289606 times.
✓ Branch 7 taken 735768 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 400 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 400 times.
✓ Branch 12 taken 20 times.
✓ Branch 13 taken 1580 times.
✓ Branch 14 taken 20 times.
✓ Branch 15 taken 1580 times.
|
13068276 | if (isLowerWall_(globalPos)) |
261 | 579252 | 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 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 2753116 times.
✓ Branch 2 taken 1769264 times.
✓ Branch 3 taken 3980966 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1700 times.
✓ Branch 6 taken 100 times.
✓ Branch 7 taken 6700 times.
|
38360832 | values[Indices::turbulentKineticEnergyIdx] = turbulentKineticEnergy_; |
267 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 2753116 times.
✓ Branch 2 taken 1769264 times.
✓ Branch 3 taken 3980966 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1700 times.
✓ Branch 6 taken 100 times.
✓ Branch 7 taken 6700 times.
|
38360832 | values[Indices::dissipationIdx] = dissipation_; |
268 |
12/16✗ Branch 0 not taken.
✓ Branch 1 taken 2753116 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2753116 times.
✓ Branch 4 taken 1769264 times.
✓ Branch 5 taken 3980966 times.
✓ Branch 6 taken 1769264 times.
✓ Branch 7 taken 3980966 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1700 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1700 times.
✓ Branch 12 taken 100 times.
✓ Branch 13 taken 6700 times.
✓ Branch 14 taken 100 times.
✓ Branch 15 taken 6700 times.
|
76721664 | if (isLowerWall_(globalPos)) |
269 | { | ||
270 | 1769364 | values[Indices::turbulentKineticEnergyIdx] = 0.0; | |
271 | 3538728 | values[Indices::dissipationIdx] = 0.0; | |
272 | } | ||
273 | } | ||
274 | } | ||
275 | |||
276 | //! Boundary condition types for the one-eq turbulence model | ||
277 | 158118444 | 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 |
4/4✓ Branch 0 taken 1448019 times.
✓ Branch 1 taken 8073390 times.
✓ Branch 2 taken 1448019 times.
✓ Branch 3 taken 8073390 times.
|
19042818 | 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 |
4/4✓ Branch 0 taken 11350431 times.
✓ Branch 1 taken 146768013 times.
✓ Branch 2 taken 11350431 times.
✓ Branch 3 taken 146768013 times.
|
316236888 | if(isOutlet_(pos)) |
293 | { | ||
294 | 11350431 | values.setOutflow(Indices::turbulentKineticEnergyEqIdx); | |
295 | 11350431 | values.setOutflow(Indices::dissipationEqIdx); | |
296 | } | ||
297 | else | ||
298 | { | ||
299 | // walls and inflow | ||
300 | 146768013 | values.setDirichlet(Indices::turbulentKineticEnergyIdx); | |
301 | 146768013 | values.setDirichlet(Indices::dissipationIdx); | |
302 | } | ||
303 | } | ||
304 | 158118444 | } | |
305 | |||
306 | template<class Element, class FVElementGeometry, class SubControlVolume> | ||
307 | 35230960 | 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 | 20102080 | 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 |
4/4✓ Branch 0 taken 100482724 times.
✓ Branch 1 taken 24942964 times.
✓ Branch 2 taken 100482724 times.
✓ Branch 3 taken 24942964 times.
|
250851376 | for (const auto& scvf : scvfs(fvGeometry)) |
327 |
4/4✓ Branch 1 taken 1063984 times.
✓ Branch 2 taken 99418740 times.
✓ Branch 3 taken 236956 times.
✓ Branch 4 taken 827028 times.
|
100482724 | if (this->boundaryTypes(element, scvf).hasWall() && pvIdx == Indices::dissipationIdx) |
328 | 236956 | return true; | |
329 | 24942964 | 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 | 2753116 | PrimaryVariables dirichletTurbulentTwoEq_(const Element& element, | |
338 | const SubControlVolume& scv) const | ||
339 | { | ||
340 | 2753116 | const auto globalPos = scv.center(); | |
341 | 2753116 | PrimaryVariables values(initialAtPos(globalPos)); | |
342 | 8259348 | 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 | 463092 | const auto wallDistance = ParentType::wallDistance(elementIdx); | |
357 | using std::pow; | ||
358 | 926184 | values[Indices::dissipationEqIdx] = 6.0 * ParentType::kinematicViscosity(elementIdx) | |
359 | 231546 | / (ParentType::betaOmega() * wallDistance * wallDistance); | |
360 | 231546 | 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 |