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 ZeroEqModel | ||
10 | * \copydoc Dumux::ZeroEqVolumeVariables | ||
11 | */ | ||
12 | #ifndef DUMUX_ZEROEQ_VOLUME_VARIABLES_HH | ||
13 | #define DUMUX_ZEROEQ_VOLUME_VARIABLES_HH | ||
14 | |||
15 | #include <string> | ||
16 | |||
17 | #include <dune/common/exceptions.hh> | ||
18 | #include <dumux/freeflow/rans/volumevariables.hh> | ||
19 | |||
20 | namespace Dumux { | ||
21 | |||
22 | /*! | ||
23 | * \ingroup ZeroEqModel | ||
24 | * \brief Volume variables for the single-phase 0-Eq. model. | ||
25 | */ | ||
26 | template <class Traits, class NSVolumeVariables> | ||
27 |
2/20✓ Branch 3 taken 57428 times.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 29032 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
|
87340 | class ZeroEqVolumeVariables |
28 | : public RANSVolumeVariables< Traits, NSVolumeVariables> | ||
29 | { | ||
30 | using RANSParentType = RANSVolumeVariables<Traits, NSVolumeVariables>; | ||
31 | |||
32 | using Scalar = typename Traits::PrimaryVariables::value_type; | ||
33 | |||
34 | public: | ||
35 | //! export the indices type | ||
36 | using Indices = typename Traits::ModelTraits::Indices; | ||
37 | |||
38 | /*! | ||
39 | * \brief Update all quantities for a given control volume | ||
40 | * | ||
41 | * \param elemSol A vector containing all primary variables connected to the element | ||
42 | * \param problem The object specifying the problem which ought to | ||
43 | * be simulated | ||
44 | * \param element An element which contains part of the control volume | ||
45 | * \param scv The sub-control volume | ||
46 | */ | ||
47 | template<class ElementSolution, class Problem, class Element, class SubControlVolume> | ||
48 | 5261548 | void update(const ElementSolution &elemSol, | |
49 | const Problem &problem, | ||
50 | const Element &element, | ||
51 | const SubControlVolume& scv) | ||
52 | { | ||
53 | 5261548 | RANSParentType::updateNavierStokesVolVars(elemSol, problem, element, scv); | |
54 | 5261548 | updateRANSProperties(elemSol, problem, element, scv); | |
55 | 5261548 | } | |
56 | |||
57 | /*! | ||
58 | * \brief Update all turbulent quantities for a given control volume | ||
59 | * | ||
60 | * \param elemSol A vector containing all primary variables connected to the element | ||
61 | * \param problem The object specifying the problem which ought to be simulated | ||
62 | * \param element An element which contains part of the control volume | ||
63 | * \param scv The sub-control volume | ||
64 | */ | ||
65 | template<class ElementSolution, class Problem, class Element, class SubControlVolume> | ||
66 | 5261548 | void updateRANSProperties(const ElementSolution &elemSol, | |
67 | const Problem &problem, | ||
68 | const Element &element, | ||
69 | const SubControlVolume& scv) | ||
70 | { | ||
71 | 5261548 | RANSParentType::updateRANSProperties(elemSol, problem, element, scv); | |
72 | 5261548 | additionalRoughnessLength_ = problem.additionalRoughnessLength(RANSParentType::elementIdx()); | |
73 | 15784644 | yPlusRough_ = wallDistanceRough() * RANSParentType::uStar() / RANSParentType::kinematicViscosity(); | |
74 |
3/8✓ Branch 2 taken 5261548 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5261548 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5261548 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
5261548 | RANSParentType::setDynamicEddyViscosity_(calculateEddyViscosity(elemSol, problem, element, scv, problem.eddyViscosityModel())); |
75 | 5261548 | RANSParentType::calculateEddyDiffusivity(problem); | |
76 | 5261548 | RANSParentType::calculateEddyThermalConductivity(problem); | |
77 | 5261548 | } | |
78 | |||
79 | /*! | ||
80 | * \brief Calculate and set the dynamic eddy viscosity. | ||
81 | * | ||
82 | * \param elemSol A vector containing all primary variables connected to the element | ||
83 | * \param problem The object specifying the problem which ought to be simulated | ||
84 | * \param element An element which contains part of the control volume | ||
85 | * \param scv The sub-control volume | ||
86 | * \param modelName The name of the used model | ||
87 | */ | ||
88 | template<class ElementSolution, class Problem, class Element, class SubControlVolume> | ||
89 | 5261548 | Scalar calculateEddyViscosity(const ElementSolution &elemSol, | |
90 | const Problem &problem, | ||
91 | const Element &element, | ||
92 | const SubControlVolume& scv, | ||
93 | const std::string modelName) | ||
94 | { | ||
95 | using std::abs; | ||
96 | using std::exp; | ||
97 | using std::sqrt; | ||
98 | 5261548 | Scalar kinematicEddyViscosity = 0.0; | |
99 | 5261548 | unsigned int flowDirectionAxis = problem.flowDirectionAxis(RANSParentType::elementIdx()); | |
100 | 5261548 | unsigned int wallNormalAxis = problem.wallNormalAxis(RANSParentType::elementIdx()); | |
101 | 21046192 | Scalar velGrad = abs(RANSParentType::velocityGradients()[flowDirectionAxis][wallNormalAxis]); | |
102 | |||
103 |
1/2✓ Branch 1 taken 5261548 times.
✗ Branch 2 not taken.
|
5261548 | if (modelName.compare("none") == 0) |
104 | { | ||
105 | // kinematicEddyViscosity = 0.0 | ||
106 | } | ||
107 |
2/2✓ Branch 1 taken 2616420 times.
✓ Branch 2 taken 2645128 times.
|
5261548 | else if (modelName.compare("prandtl") == 0) |
108 | { | ||
109 | 5232840 | Scalar mixingLength = problem.karmanConstant() * wallDistanceRough(); | |
110 | 2616420 | kinematicEddyViscosity = mixingLength * mixingLength * velGrad; | |
111 | } | ||
112 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2645128 times.
|
2645128 | else if (modelName.compare("vanDriest") == 0) |
113 | { | ||
114 | ✗ | Scalar mixingLength = problem.karmanConstant() * wallDistanceRough() | |
115 | ✗ | * (1.0 - exp(-yPlusRough() / 26.0)) | |
116 | ✗ | / sqrt(1.0 - exp(-0.26 * yPlusRough())); | |
117 | ✗ | kinematicEddyViscosity = mixingLength * mixingLength * velGrad; | |
118 | } | ||
119 |
1/2✓ Branch 1 taken 2645128 times.
✗ Branch 2 not taken.
|
2645128 | else if (modelName.compare("baldwinLomax") == 0) |
120 | { | ||
121 | 5290256 | kinematicEddyViscosity = problem.kinematicEddyViscosity(RANSParentType::elementIdx()); | |
122 | } | ||
123 | else | ||
124 | { | ||
125 | ✗ | DUNE_THROW(Dune::NotImplemented, | |
126 | "The eddy viscosity model \"" << modelName << "\" is not implemented."); | ||
127 | } | ||
128 | |||
129 | 10523096 | return kinematicEddyViscosity * RANSParentType::density(); | |
130 | } | ||
131 | |||
132 | /*! | ||
133 | * \brief Return the wall distance \f$\mathrm{[m]}\f$ including an additional roughness length | ||
134 | */ | ||
135 | Scalar wallDistanceRough() const | ||
136 | 7877968 | { return RANSParentType::wallDistance() + additionalRoughnessLength_; } | |
137 | |||
138 | /*! | ||
139 | * \brief Return the dimensionless wall distance \f$\mathrm{[-]}\f$ including an additional roughness length | ||
140 | */ | ||
141 | ✗ | Scalar yPlusRough() const | |
142 | ✗ | { return yPlusRough_; } | |
143 | |||
144 | protected: | ||
145 | Scalar additionalRoughnessLength_ = 0.0; | ||
146 | Scalar yPlusRough_ = 0.0; | ||
147 | }; | ||
148 | |||
149 | } // end namespace Dumux | ||
150 | |||
151 | #endif | ||
152 |