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 FreeflowModels | ||
10 | * \brief The available free flow turbulence models in Dumux | ||
11 | */ | ||
12 | #ifndef DUMUX_FREEFLOW_TURBLENCEMODEL_HH | ||
13 | #define DUMUX_FREEFLOW_TURBLENCEMODEL_HH | ||
14 | |||
15 | #include <string> | ||
16 | #include <dumux/common/exceptions.hh> | ||
17 | |||
18 | namespace Dumux { | ||
19 | |||
20 | /*! | ||
21 | * \brief The available free flow turbulence models in Dumux | ||
22 | * \ingroup FreeflowModels | ||
23 | * \note Use none for plain (Navier-) Stokes models (DNS) | ||
24 | */ | ||
25 | enum class TurbulenceModel | ||
26 | { | ||
27 | none, zeroeq, oneeq, kepsilon, lowrekepsilon, komega, sst | ||
28 | }; | ||
29 | |||
30 | constexpr unsigned int numTurbulenceEq(TurbulenceModel model) | ||
31 | { | ||
32 | if (model == TurbulenceModel::none || model == TurbulenceModel::zeroeq) | ||
33 | return 0; | ||
34 | else if (model == TurbulenceModel::oneeq) | ||
35 | return 1; | ||
36 | else | ||
37 | return 2; | ||
38 | } | ||
39 | |||
40 | /** | ||
41 | * \brief return the name of the Turbulence Model | ||
42 | */ | ||
43 | 29 | std::string turbulenceModelToString(TurbulenceModel turbulenceModel) | |
44 | { | ||
45 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 5 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
|
29 | switch (turbulenceModel) |
46 | { | ||
47 | ✗ | case TurbulenceModel::none: return "No_TurbModel"; | |
48 | 8 | case TurbulenceModel::zeroeq: return "ZeroEq"; | |
49 | 8 | case TurbulenceModel::oneeq: return "OneEq"; | |
50 | 16 | case TurbulenceModel::kepsilon: return "KEpsilon"; | |
51 | 8 | case TurbulenceModel::lowrekepsilon: return "LowReKEpsilon"; | |
52 | 10 | case TurbulenceModel::komega: return "KOmega"; | |
53 | 8 | case TurbulenceModel::sst: return "KOmegaSST"; | |
54 | ✗ | default: return "Invalid"; // should never be reached | |
55 | } | ||
56 | } | ||
57 | |||
58 | /*! | ||
59 | * \brief The available variations of the SST Turbulence Model | ||
60 | * \ingroup SSTModel | ||
61 | */ | ||
62 | enum class SSTModel | ||
63 | { BSL, SST }; | ||
64 | |||
65 | /** | ||
66 | * \brief return the name of the sst Model as a string | ||
67 | */ | ||
68 | ✗ | std::string sstModelToString(SSTModel sstModel) | |
69 | { | ||
70 | ✗ | switch (sstModel) | |
71 | { | ||
72 | ✗ | case SSTModel::BSL: return "BSL"; | |
73 | ✗ | case SSTModel::SST: return "SST"; | |
74 | ✗ | default: return "Invalid"; | |
75 | } | ||
76 | } | ||
77 | |||
78 | /** | ||
79 | * \brief Convenience function to convert user input given as std::string | ||
80 | * to the corresponding enum class used for choosing the SST Model | ||
81 | */ | ||
82 | 4 | SSTModel sstModelFromString(const std::string& sstModel) | |
83 | { | ||
84 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | if (sstModel == "BSL") return SSTModel::BSL; |
85 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
4 | if (sstModel == "SST") return SSTModel::SST; |
86 | ✗ | DUNE_THROW(ParameterException, "\nThis SST Model approach : \"" << sstModel << "\" is not implemented.\n" | |
87 | << "The available SST models are as follows: \n" | ||
88 | << sstModelToString(SSTModel::BSL) << ": The Baseline SST Model n\n" | ||
89 | << sstModelToString(SSTModel::SST) << ": The full standard SST Model"); | ||
90 | } | ||
91 | |||
92 | } // end namespace Dumux | ||
93 | |||
94 | #endif | ||
95 |