1 #ifndef VERTEXCFD_CONDUCTIONCLOSUREMODELFACTORY_IMPL_HPP
2 #define VERTEXCFD_CONDUCTIONCLOSUREMODELFACTORY_IMPL_HPP
4 #include "conduction/closure_models/VertexCFD_ConductionClosureModelFactory.hpp"
6 #include "closure_models/VertexCFD_Closure_ConstantScalarField.hpp"
7 #include "closure_models/VertexCFD_Closure_ElementLength.hpp"
9 #include "conduction/closure_models/VertexCFD_Closure_ConductionErrorNorms.hpp"
10 #include "conduction/closure_models/VertexCFD_Closure_ConductionExactSolution.hpp"
11 #include "conduction/closure_models/VertexCFD_Closure_ConductionFlux.hpp"
12 #include "conduction/closure_models/VertexCFD_Closure_ConductionThermalConductivity.hpp"
13 #include "conduction/closure_models/VertexCFD_Closure_ConductionTimeDerivative.hpp"
14 #include "conduction/closure_models/VertexCFD_Closure_ConductionTimeStepSize.hpp"
15 #include "conduction/closure_models/VertexCFD_Closure_ConductionVolumetricSource.hpp"
19 namespace ClosureModel
23 template<
class EvalType,
int NumSpaceDim>
24 Teuchos::RCP<std::vector<Teuchos::RCP<PHX::Evaluator<panzer::Traits>>>>
26 const std::string& model_id,
27 const Teuchos::ParameterList& model_params,
28 const panzer::FieldLayoutLibrary&,
29 const Teuchos::RCP<panzer::IntegrationRule>& ir,
30 const Teuchos::ParameterList& ,
31 const Teuchos::ParameterList& ,
32 const Teuchos::RCP<panzer::GlobalData>& ,
33 PHX::FieldManager<panzer::Traits>&)
const
35 constexpr
int num_space_dim = NumSpaceDim;
37 auto evaluators = Teuchos::rcp(
38 new std::vector<Teuchos::RCP<PHX::Evaluator<panzer::Traits>>>);
40 if (!model_params.isSublist(model_id))
42 throw std::runtime_error(
"Conduction closure model id " + model_id
47 const Teuchos::ParameterList& closure_model_list
48 = model_params.sublist(model_id);
52 const std::string factory_type
53 = closure_model_list.isType<std::string>(
"Closure Factory Type")
54 ? closure_model_list.get<std::string>(
"Closure Factory Type")
57 if (factory_type !=
"Conduction")
61 const std::string default_closure_models
62 =
"ConductionTimeDerivative,\nConductionFlux,\n"
63 "ConductionTimeStepSize,\n"
68 auto eval_conduction = Teuchos::rcp(
70 evaluators->push_back(eval_conduction);
77 evaluators->push_back(eval_conduction);
82 auto eval_conduction = Teuchos::rcp(
84 evaluators->push_back(eval_conduction);
91 evaluators->push_back(eval);
95 for (
const auto& closure_model : closure_model_list)
97 bool found_model =
false;
99 const auto closure_name = closure_model.first;
100 if (closure_name ==
"Closure Factory Type")
104 const auto& closure_params
105 = Teuchos::getValue<Teuchos::ParameterList>(closure_model.second);
107 if (closure_params.isType<std::string>(
"Type"))
109 const auto closure_type = closure_params.get<std::string>(
"Type");
112 if (default_closure_models.find(closure_type) != std::string::npos)
114 std::string msg =
"\n\nConduction closure model/type '" + closure_name +
"'/'" + closure_type
115 +
"' found in model id '" + model_id +
"' is a default closure model and should not be added to the input file.\n";
116 msg +=
"The list of default closure models for the conduction equation is:\n";
117 msg += default_closure_models;
118 throw std::runtime_error(msg);
122 if (closure_type ==
"ConductionErrorNorms")
124 auto eval = Teuchos::rcp(
127 evaluators->push_back(eval);
132 if (closure_type ==
"ConductionExactSolution")
138 *ir, closure_params));
139 evaluators->push_back(eval);
144 if (closure_type ==
"ConductionVolumetricSource")
146 auto eval = Teuchos::rcp(
148 *ir, closure_params));
149 evaluators->push_back(eval);
154 if (closure_type ==
"ConstantMaterialProperties")
157 auto eval_rho = Teuchos::rcp(
161 closure_params.get<
double>(
"Density Value")));
162 evaluators->push_back(eval_rho);
165 auto eval_cp = Teuchos::rcp(
168 "solid_specific_heat_capacity",
169 closure_params.get<
double>(
"Specific Heat Capacity "
171 evaluators->push_back(eval_cp);
174 auto eval_k = Teuchos::rcp(
176 *ir, closure_params));
177 evaluators->push_back(eval_k);
184 std::string msg =
"\n\nConduction closure model/type "
185 + closure_name +
"/" + closure_type
186 +
" failed to build in model id " + model_id
188 msg +=
"The conduction closure models available in Vertex-CFD are:\n";
189 msg +=
"ConductionErrorNorms,\n";
190 msg +=
"ConductionExactSolution,\n";
191 msg +=
"ConductionVolumetricSource,\n";
192 msg +=
"ConstantMaterialProperties,\n";
195 throw std::runtime_error(msg);
208 #endif // end VERTEXCFD_CONDUCTIONCLOSUREMODELFACTORY_IMPL_HPP