VertexCFD  0.0-dev
VertexCFD_SolidElectricBoundaryState_Factory.hpp
1 #ifndef VERTEXCFD_SOLIDELECTRICBOUNDARYSTATE_FACTORY_HPP
2 #define VERTEXCFD_SOLIDELECTRICBOUNDARYSTATE_FACTORY_HPP
3 
4 #include "boundary_conditions/VertexCFD_BoundaryState_VariableExtrapolate.hpp"
5 #include "boundary_conditions/VertexCFD_BoundaryState_VariableFixed.hpp"
6 
7 #include "induction_less_mhd_solver/closure_models/VertexCFD_Closure_SolidElectricConductivity.hpp"
8 
9 #include "turbulence_models/boundary_conditions/VertexCFD_BoundaryState_TurbulenceSymmetry.hpp"
10 
11 #include <Panzer_Evaluator_WithBaseImpl.hpp>
12 
13 #include <Teuchos_ParameterList.hpp>
14 #include <Teuchos_RCP.hpp>
15 
16 namespace VertexCFD
17 {
18 namespace BoundaryCondition
19 {
20 //---------------------------------------------------------------------------//
21 template<class EvalType, class Traits, int NumSpaceDim>
23 {
24  public:
25  static constexpr int num_space_dim = NumSpaceDim;
26 
27  static std::vector<Teuchos::RCP<PHX::Evaluator<Traits>>>
28  create(const panzer::IntegrationRule& ir,
29  const Teuchos::ParameterList& bc_params,
30  const Teuchos::ParameterList& closure_model)
31  {
32  // Evaluator vector to return
33  std::vector<Teuchos::RCP<PHX::Evaluator<panzer::Traits>>> evaluators;
34 
35  // Get material property. Note: it is assumed that the material
36  // property is listed under 'Material Properties' in the closure model
37  // of the input file.
38  const auto mat_prop_list
39  = closure_model.sublist("Material Properties");
40 
41  // Register electric conductivity to be used on the boundary based on
42  // the material property type set in the input file
43  const auto closure_type = mat_prop_list.get<std::string>("Type");
44  if (closure_type == "SolidElectricConductivity")
45  {
46  const auto mat_prop = Teuchos::rcp(
48  panzer::Traits>(
49  ir, mat_prop_list));
50  evaluators.push_back(mat_prop);
51  }
52 
53  // Loop over boundary conditions found in input file
54  Teuchos::RCP<PHX::Evaluator<Traits>> state;
55  bool found_model = false;
56  if (bc_params.isType<std::string>("Type"))
57  {
58  const auto bc_type = bc_params.get<std::string>("Type");
59 
60  // Extrapolate
61  if (bc_type == "Extrapolate")
62  {
63  state = Teuchos::rcp(new VariableExtrapolate<EvalType, Traits>(
64  ir, "electric_potential"));
65  evaluators.push_back(state);
66  found_model = true;
67  }
68 
69  // Fixed or Dirichlet-like
70  if (bc_type == "Fixed")
71  {
72  state = Teuchos::rcp(new VariableFixed<EvalType, Traits>(
73  ir, bc_params, "electric_potential"));
74  evaluators.push_back(state);
75  found_model = true;
76  }
77 
78  // Insulating wall
79  if (bc_params.get<std::string>("Type") == "InsulatingWall")
80  {
81  state = Teuchos::rcp(new TurbulenceSymmetry<EvalType, Traits>(
82  ir, "electric_potential"));
83  evaluators.push_back(state);
84  found_model = true;
85  }
86 
87  // Error message if model not found
88  if (!found_model)
89  {
90  std::string msg = "\n\nBoundary state " + bc_type
91  + " failed to build.\n";
92  msg += "The boundary conditions implemented in VERTEX-CFD\n";
93  msg += "for the solid induction-less MHD equation are:\n";
94  msg += "Extrapolate,\n";
95  msg += "Fixed,\n";
96  msg += "InsulatingWall,\n";
97  msg += "\n";
98  throw std::runtime_error(msg);
99  }
100  }
101 
102  // Return evaluators
103  return evaluators;
104  }
105 };
106 
107 //---------------------------------------------------------------------------//
108 
109 } // end namespace BoundaryCondition
110 } // end namespace VertexCFD
111 
112 #endif // end VERTEXCFD_SOLIDELECTRICBOUNDARYSTATE_FACTORY_HPP
VertexCFD::ClosureModel::SolidElectricConductivity
Definition: VertexCFD_Closure_SolidElectricConductivity.hpp:27
VertexCFD
Definition: tstMethodManufacturedSolutionBC.cpp:23
VertexCFD::BoundaryCondition::TurbulenceSymmetry
Definition: VertexCFD_BoundaryState_TurbulenceSymmetry.hpp:22
VertexCFD::BoundaryCondition::VariableFixed
Definition: VertexCFD_BoundaryState_VariableFixed.hpp:22
VertexCFD::BoundaryCondition::VariableExtrapolate
Definition: VertexCFD_BoundaryState_VariableExtrapolate.hpp:22
VertexCFD::BoundaryCondition::SolidElectricBoundaryStateFactory
Definition: VertexCFD_SolidElectricBoundaryState_Factory.hpp:23