1 #ifndef VERTEXCFD_TURBULENCECLOSUREMODELFACTORY_IMPL_HPP
2 #define VERTEXCFD_TURBULENCECLOSUREMODELFACTORY_IMPL_HPP
4 #include "closure_models/VertexCFD_Closure_ElementLength.hpp"
5 #include "closure_models/VertexCFD_Closure_MeasureElementLength.hpp"
6 #include "closure_models/VertexCFD_Closure_MetricTensorElementLength.hpp"
7 #include "closure_models/VertexCFD_Closure_SingularValueElementLength.hpp"
8 #include "closure_models/VertexCFD_Closure_VariableConvectiveFlux.hpp"
9 #include "closure_models/VertexCFD_Closure_VariableDiffusionFlux.hpp"
10 #include "closure_models/VertexCFD_Closure_VariableSUPGFlux.hpp"
11 #include "closure_models/VertexCFD_Closure_VariableTauSUPG.hpp"
13 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleChienKEpsilonEddyViscosity.hpp"
14 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleChienKEpsilonSource.hpp"
15 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleKEpsilonDiffusivityCoefficient.hpp"
16 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleKEpsilonEddyViscosity.hpp"
17 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleKEpsilonSource.hpp"
18 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleKOmegaDiffusivityCoefficient.hpp"
19 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleKOmegaEddyViscosity.hpp"
20 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleKOmegaSource.hpp"
21 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleKTauDiffusivityCoefficient.hpp"
22 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleKTauEddyViscosity.hpp"
23 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleKTauSource.hpp"
24 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleRealizableKEpsilonEddyViscosity.hpp"
25 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleRealizableKEpsilonSource.hpp"
26 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleSSTDiffusivityCoefficient.hpp"
27 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleSSTEddyViscosity.hpp"
28 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleSSTSource.hpp"
29 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleSpalartAllmarasDiffusivityCoefficient.hpp"
30 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleSpalartAllmarasEddyViscosity.hpp"
31 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleSpalartAllmarasSource.hpp"
32 #include "turbulence_models/closure_models/VertexCFD_Closure_IncompressibleWALEEddyViscosity.hpp"
33 #include "turbulence_models/closure_models/VertexCFD_TurbulenceClosureModelFactory.hpp"
35 #include "incompressible_solver/closure_models/VertexCFD_Closure_IncompressibleVariableTimeDerivative.hpp"
39 namespace ClosureModel
42 template<
class EvalType,
int NumSpaceDim>
43 void TurbulenceFactory<EvalType, NumSpaceDim>::buildClosureModel(
44 const Teuchos::RCP<panzer::IntegrationRule>& ir,
45 const Teuchos::RCP<panzer::GlobalData>& global_data,
46 const Teuchos::ParameterList& user_params,
47 const std::string& turbulence_model_name,
48 Teuchos::RCP<std::vector<Teuchos::RCP<PHX::Evaluator<panzer::Traits>>>>
52 const auto turb_params = user_params.isSublist(
"Turbulence Parameters")
53 ? user_params.sublist(
"Turbulence Parameters")
54 : Teuchos::ParameterList();
57 std::vector<Teuchos::ParameterList> turb_names_list_vct;
59 if (std::string::npos != turbulence_model_name.find(
"Spalart-Allmaras"))
61 Teuchos::ParameterList sa_names_list;
62 sa_names_list.set(
"Field Name",
"spalart_allmaras_variable");
63 sa_names_list.set(
"Equation Name",
"spalart_allmaras_equation");
64 turb_names_list_vct.push_back(sa_names_list);
66 else if (std::string::npos != turbulence_model_name.find(
"K-Epsilon"))
68 Teuchos::ParameterList k_names_list;
69 k_names_list.set(
"Field Name",
"turb_kinetic_energy");
70 k_names_list.set(
"Equation Name",
"turb_kinetic_energy_equation");
71 turb_names_list_vct.push_back(k_names_list);
73 Teuchos::ParameterList epsilon_names_list;
74 epsilon_names_list.set(
"Field Name",
"turb_dissipation_rate");
75 epsilon_names_list.set(
"Equation Name",
76 "turb_dissipation_rate_equation");
77 turb_names_list_vct.push_back(epsilon_names_list);
79 else if (std::string::npos != turbulence_model_name.find(
"K-Omega"))
81 Teuchos::ParameterList k_names_list;
82 k_names_list.set(
"Field Name",
"turb_kinetic_energy");
83 k_names_list.set(
"Equation Name",
"turb_kinetic_energy_equation");
84 turb_names_list_vct.push_back(k_names_list);
86 Teuchos::ParameterList omega_names_list;
87 omega_names_list.set(
"Field Name",
"turb_specific_dissipation_rate");
88 omega_names_list.set(
"Equation Name",
89 "turb_specific_dissipation_rate_equation");
90 turb_names_list_vct.push_back(omega_names_list);
92 else if (std::string::npos != turbulence_model_name.find(
"SST"))
94 Teuchos::ParameterList k_names_list;
95 k_names_list.set(
"Field Name",
"turb_kinetic_energy");
96 k_names_list.set(
"Equation Name",
"turb_kinetic_energy_equation");
97 turb_names_list_vct.push_back(k_names_list);
99 Teuchos::ParameterList omega_names_list;
100 omega_names_list.set(
"Field Name",
"turb_specific_dissipation_rate");
101 omega_names_list.set(
"Equation Name",
102 "turb_specific_dissipation_rate_equation");
103 turb_names_list_vct.push_back(omega_names_list);
105 else if (std::string::npos != turbulence_model_name.find(
"K-Tau"))
107 Teuchos::ParameterList k_names_list;
108 k_names_list.set(
"Field Name",
"turb_kinetic_energy");
109 k_names_list.set(
"Equation Name",
"turb_kinetic_energy_equation");
110 turb_names_list_vct.push_back(k_names_list);
112 Teuchos::ParameterList tau_names_list;
113 tau_names_list.set(
"Field Name",
"turb_specific_dissipation_rate");
114 tau_names_list.set(
"Equation Name",
115 "turb_specific_dissipation_rate_equation");
116 turb_names_list_vct.push_back(tau_names_list);
120 for (
const auto& turb_names_list : turb_names_list_vct)
122 auto eval_time = Teuchos::rcp(
123 new IncompressibleVariableTimeDerivative<EvalType, panzer::Traits>(
124 *ir, turb_names_list));
125 evaluators->push_back(eval_time);
127 auto eval_conv = Teuchos::rcp(
128 new VariableConvectiveFlux<EvalType, panzer::Traits, num_space_dim>(
129 *ir, turb_names_list));
130 evaluators->push_back(eval_conv);
133 = Teuchos::rcp(
new VariableDiffusionFlux<EvalType, panzer::Traits>(
134 *ir, turb_names_list));
135 evaluators->push_back(eval_diff);
138 if (turb_params.isSublist(
"SUPG Parameters"))
140 const auto& supg_params = turb_params.sublist(
"SUPG Parameters");
141 auto eval_tau_supg = Teuchos::rcp(
142 new VariableTauSUPG<EvalType, panzer::Traits, num_space_dim>(
143 *ir, turb_names_list, supg_params));
144 evaluators->push_back(eval_tau_supg);
146 auto eval_supg_flux = Teuchos::rcp(
147 new VariableSUPGFlux<EvalType, panzer::Traits, num_space_dim>(
148 *ir, turb_names_list));
149 evaluators->push_back(eval_supg_flux);
154 if (std::string::npos != turbulence_model_name.find(
"Spalart-Allmaras"))
156 auto eval_coeff = Teuchos::rcp(
157 new IncompressibleSpalartAllmarasDiffusivityCoefficient<EvalType,
160 evaluators->push_back(eval_coeff);
162 auto eval_source = Teuchos::rcp(
163 new IncompressibleSpalartAllmarasSource<EvalType,
165 num_space_dim>(*ir));
166 evaluators->push_back(eval_source);
168 auto eval_eddy = Teuchos::rcp(
169 new IncompressibleSpalartAllmarasEddyViscosity<EvalType,
170 panzer::Traits>(*ir));
171 evaluators->push_back(eval_eddy);
174 else if (std::string::npos != turbulence_model_name.find(
"K-Epsilon"))
177 if (std::string::npos
178 != turbulence_model_name.find(
"Realizable K-Epsilon"))
180 auto eval_coeff = Teuchos::rcp(
181 new IncompressibleKEpsilonDiffusivityCoefficient<EvalType,
184 evaluators->push_back(eval_coeff);
186 auto eval_eddy = Teuchos::rcp(
187 new IncompressibleRealizableKEpsilonEddyViscosity<EvalType,
191 evaluators->push_back(eval_eddy);
193 auto eval_source = Teuchos::rcp(
194 new IncompressibleRealizableKEpsilonSource<EvalType,
196 num_space_dim>(*ir));
197 evaluators->push_back(eval_source);
200 else if (std::string::npos
201 != turbulence_model_name.find(
"Chien K-Epsilon"))
203 auto eval_coeff = Teuchos::rcp(
204 new IncompressibleKEpsilonDiffusivityCoefficient<EvalType,
207 evaluators->push_back(eval_coeff);
209 auto eval_eddy = Teuchos::rcp(
210 new IncompressibleChienKEpsilonEddyViscosity<EvalType,
212 *ir, global_data, user_params));
213 evaluators->push_back(eval_eddy);
215 auto eval_source = Teuchos::rcp(
216 new IncompressibleChienKEpsilonSource<EvalType,
219 *ir, global_data, user_params));
220 evaluators->push_back(eval_source);
225 auto eval_coeff = Teuchos::rcp(
226 new IncompressibleKEpsilonDiffusivityCoefficient<EvalType,
229 evaluators->push_back(eval_coeff);
231 auto eval_eddy = Teuchos::rcp(
232 new IncompressibleKEpsilonEddyViscosity<EvalType, panzer::Traits>(
234 evaluators->push_back(eval_eddy);
236 auto eval_source = Teuchos::rcp(
237 new IncompressibleKEpsilonSource<EvalType,
239 num_space_dim>(*ir));
240 evaluators->push_back(eval_source);
244 else if (std::string::npos != turbulence_model_name.find(
"K-Omega"))
246 auto eval_coeff = Teuchos::rcp(
247 new IncompressibleKOmegaDiffusivityCoefficient<EvalType,
250 evaluators->push_back(eval_coeff);
252 auto eval_source = Teuchos::rcp(
253 new IncompressibleKOmegaSource<EvalType, panzer::Traits, num_space_dim>(
255 evaluators->push_back(eval_source);
257 auto eval_eddy = Teuchos::rcp(
258 new IncompressibleKOmegaEddyViscosity<EvalType,
262 evaluators->push_back(eval_eddy);
264 else if (std::string::npos != turbulence_model_name.find(
"SST"))
266 auto eval_coeff = Teuchos::rcp(
267 new IncompressibleSSTDiffusivityCoefficient<EvalType, panzer::Traits>(
269 evaluators->push_back(eval_coeff);
271 auto eval_source = Teuchos::rcp(
272 new IncompressibleSSTSource<EvalType, panzer::Traits, num_space_dim>(
274 evaluators->push_back(eval_source);
277 = Teuchos::rcp(
new IncompressibleSSTEddyViscosity<EvalType,
281 evaluators->push_back(eval_eddy);
284 else if (std::string::npos != turbulence_model_name.find(
"K-Tau"))
286 auto eval_coeff = Teuchos::rcp(
287 new IncompressibleKTauDiffusivityCoefficient<EvalType, panzer::Traits>(
289 evaluators->push_back(eval_coeff);
291 auto eval_source = Teuchos::rcp(
292 new IncompressibleKTauSource<EvalType, panzer::Traits, num_space_dim>(
294 evaluators->push_back(eval_source);
296 auto eval_eddy = Teuchos::rcp(
297 new IncompressibleKTauEddyViscosity<EvalType,
299 num_space_dim>(*ir));
300 evaluators->push_back(eval_eddy);
303 else if (std::string::npos != turbulence_model_name.find(
"WALE"))
307 = Teuchos::rcp(
new IncompressibleWALEEddyViscosity<EvalType,
311 evaluators->push_back(eval_eddy);
314 const std::string delta_prefix =
"les_";
315 const std::string delta_type
316 = turb_params.isType<std::string>(
"LES Element Length")
317 ? turb_params.get<std::string>(
"LES Element Length")
320 if (delta_type ==
"ElementLength")
322 auto eval_delta = Teuchos::rcp(
323 new ElementLength<EvalType, panzer::Traits>(*ir, delta_prefix));
325 evaluators->push_back(eval_delta);
327 else if (delta_type ==
"MeasureElementLength")
329 auto eval_delta = Teuchos::rcp(
330 new MeasureElementLength<EvalType, panzer::Traits>(
333 evaluators->push_back(eval_delta);
335 else if (delta_type ==
"MetricTensorElementLength")
337 auto eval_delta = Teuchos::rcp(
338 new MetricTensorElementLength<EvalType, panzer::Traits>(
341 evaluators->push_back(eval_delta);
343 else if (delta_type ==
"SingularValueElementLength")
346 = turb_params.get<std::string>(
"Element Length Method");
348 auto eval_delta = Teuchos::rcp(
349 new SingularValueElementLength<EvalType, panzer::Traits>(
350 *ir, method, delta_prefix));
352 evaluators->push_back(eval_delta);
356 std::string msg =
"Unknown Delta Closure Model:\n";
360 msg +=
"Please choose from:\n";
361 msg +=
"ElementLength\n";
362 msg +=
"MeasureElementLength\n";
363 msg +=
"MetricTensorElementLength\n";
364 msg +=
"SingularValueElementLength\n";
366 throw std::runtime_error(msg);
376 #endif // end VERTEXCFD_TURBULENCECLOSUREMODELFACTORY_IMPL_HPP