VertexCFD  0.0-dev
VertexCFD_FullInductionBoundaryState_Factory.hpp
1 #ifndef VERTEXCFD_FULLINDUCTIONBOUNDARYSTATE_FACTORY_HPP
2 #define VERTEXCFD_FULLINDUCTIONBOUNDARYSTATE_FACTORY_HPP
3 
4 #include "closure_models/VertexCFD_Closure_ConstantScalarField.hpp"
5 
6 #include "full_induction_mhd_solver/boundary_conditions/VertexCFD_BoundaryState_FullInductionConducting.hpp"
7 #include "full_induction_mhd_solver/boundary_conditions/VertexCFD_BoundaryState_FullInductionFixed.hpp"
8 
9 #include "full_induction_mhd_solver/mhd_properties/VertexCFD_FullInductionMHDProperties.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 Teuchos::RCP<PHX::Evaluator<Traits>>
28  create(const panzer::IntegrationRule& ir,
29  const Teuchos::ParameterList& bc_params,
31  {
32  // Loop over boundary conditions found in input file for the
33  // induced magnetic field and scalar magnetic potential
34  Teuchos::RCP<PHX::Evaluator<Traits>> state;
35  bool found_model = false;
36 
37  if (bc_params.isType<std::string>("Type"))
38  {
39  const auto bc_type = bc_params.get<std::string>("Type");
40 
41  if (bc_type == "Conducting")
42  {
43  state = Teuchos::rcp(
45  ir, bc_params, mhd_props));
46  found_model = true;
47  }
48 
49  if (bc_type == "Fixed")
50  {
51  state = Teuchos::rcp(
53  ir, bc_params, mhd_props));
54  found_model = true;
55  }
56 
57  // Error message if model not found
58  if (!found_model)
59  {
60  std::string msg = "\n\nBoundary state " + bc_type
61  + " failed to build.\n";
62  msg += "The boundary conditions implemented in VERTEX-CFD\n";
63  msg += "for the full induction equations are:\n";
64  msg += "Conducting,\n";
65  msg += "Fixed,\n";
66  msg += "\n";
67  throw std::runtime_error(msg);
68  }
69  }
70 
71  // Return vector of evaluators
72  return state;
73  }
74 };
75 
76 //---------------------------------------------------------------------------//
77 
78 } // end namespace BoundaryCondition
79 } // end namespace VertexCFD
80 
81 #endif // end VERTEXCFD_FULLINDUCTIONBOUNDARYSTATE_FACTORY_HPP
VertexCFD
Definition: tstMethodManufacturedSolutionBC.cpp:23
VertexCFD::MHDProperties::FullInductionMHDProperties
Definition: VertexCFD_FullInductionMHDProperties.hpp:17
VertexCFD::BoundaryCondition::FullInductionFixed
Definition: VertexCFD_BoundaryState_FullInductionFixed.hpp:22
VertexCFD::BoundaryCondition::FullInductionConducting
Definition: VertexCFD_BoundaryState_FullInductionConducting.hpp:22
VertexCFD::BoundaryCondition::FullInductionBoundaryStateFactory
Definition: VertexCFD_FullInductionBoundaryState_Factory.hpp:23