1 #ifndef VERTEXCFD_SOLIDELECTRICPOTENTIALCLOSUREMODELFACTORY_IMPL_HPP
2 #define VERTEXCFD_SOLIDELECTRICPOTENTIALCLOSUREMODELFACTORY_IMPL_HPP
4 #include "induction_less_mhd_solver/closure_models/VertexCFD_Closure_SolidElectricConductivity.hpp"
5 #include "induction_less_mhd_solver/closure_models/VertexCFD_Closure_SolidElectricPotentialDiffusionFlux.hpp"
6 #include "induction_less_mhd_solver/closure_models/VertexCFD_Closure_SolidElectricPotentialErrorNorms.hpp"
7 #include "induction_less_mhd_solver/closure_models/VertexCFD_Closure_SolidElectricPotentialExactSolution.hpp"
8 #include "induction_less_mhd_solver/closure_models/VertexCFD_SolidElectricPotentialClosureModelFactory.hpp"
10 #include "closure_models/VertexCFD_Closure_ConstantScalarField.hpp"
16 namespace ClosureModel
20 template<
class EvalType,
int NumSpaceDim>
21 Teuchos::RCP<std::vector<Teuchos::RCP<PHX::Evaluator<panzer::Traits>>>>
23 const std::string& model_id,
24 const Teuchos::ParameterList& model_params,
25 const panzer::FieldLayoutLibrary&,
26 const Teuchos::RCP<panzer::IntegrationRule>& ir,
27 const Teuchos::ParameterList& ,
28 const Teuchos::ParameterList& ,
29 const Teuchos::RCP<panzer::GlobalData>& ,
30 PHX::FieldManager<panzer::Traits>&)
const
32 auto evaluators = Teuchos::rcp(
33 new std::vector<Teuchos::RCP<PHX::Evaluator<panzer::Traits>>>);
35 if (!model_params.isSublist(model_id))
37 throw std::runtime_error(
"SolidElectricPotential closure model id "
38 + model_id +
"not in list.");
41 constexpr
int num_space_dim = NumSpaceDim;
44 const Teuchos::ParameterList& closure_model_list
45 = model_params.sublist(model_id);
49 const std::string factory_type
50 = closure_model_list.isType<std::string>(
"Closure Factory Type")
51 ? closure_model_list.get<std::string>(
"Closure Factory Type")
54 if (factory_type !=
"SolidElectricPotential")
58 const std::string default_closure_models
59 =
"SolidElectricPotentialDiffusionFlux,\n";
63 auto eval_conduction = Teuchos::rcp(
66 evaluators->push_back(eval_conduction);
70 std::vector<std::string> needed_cm = {
"Material Properties"};
71 for (std::string cm : needed_cm)
73 if (!closure_model_list.isSublist(cm))
75 throw std::runtime_error(
76 "\n\nERROR: the required sublist '" + cm
77 +
"' could not be found in the closure model list '" + model_id
83 for (
const auto& closure_model : closure_model_list)
85 bool found_model =
false;
87 const auto closure_name = closure_model.first;
88 if (closure_name ==
"Closure Factory Type")
92 const auto& closure_params
93 = Teuchos::getValue<Teuchos::ParameterList>(closure_model.second);
95 if (closure_params.isType<std::string>(
"Type"))
97 const auto closure_type = closure_params.get<std::string>(
"Type");
100 if (default_closure_models.find(closure_type) != std::string::npos)
102 std::string msg =
"\n\nSolidElectricPotential closure model/type '" + closure_name +
"'/'" + closure_type
103 +
"' found in model id '" + model_id +
"' is a default closure model and should not be added to the input file.\n";
104 msg +=
"The list of default closure models for the conduction equation is:\n";
105 msg += default_closure_models;
106 throw std::runtime_error(msg);
110 if (closure_type ==
"SolidElectricConductivity")
112 auto eval = Teuchos::rcp(
114 *ir, closure_params));
115 evaluators->push_back(eval);
120 if (closure_type ==
"SolidElectricPotentialErrorNorms")
122 auto eval = Teuchos::rcp(
125 num_space_dim>(*ir));
126 evaluators->push_back(eval);
131 if (closure_type ==
"SolidElectricPotentialExactSolution")
133 auto eval = Teuchos::rcp(
137 *ir, closure_params));
138 evaluators->push_back(eval);
145 if (closure_type ==
"SolidElectricTimeStepSize")
147 auto eval = Teuchos::rcp(
149 *ir,
"local_dt", 10e10));
150 evaluators->push_back(eval);
158 =
"\n\nSolidElectricPotential closure model/type "
159 + closure_name +
"/" + closure_type
160 +
" failed to build in model id " + model_id +
".\n";
161 msg +=
"The conduction closure models available in Vertex-CFD are:\n";
162 msg +=
"SolidElectricConductivity,\n";
163 msg +=
"SolidElectricPotentialErrorNorms,\n";
164 msg +=
"SolidElectricPotentialExactSolution,\n";
165 msg +=
"SolidElectricTimeStepSize,\n";
168 throw std::runtime_error(msg);
181 #endif // end VERTEXCFD_SOLIDELECTRICPOTENTIALCLOSUREMODELFACTORY_IMPL_HPP