VertexCFD  0.0-dev
VertexCFD_ConductionBoundaryState_Factory.hpp
1 #ifndef VERTEXCFD_CONDUCTIONBOUNDARYSTATE_FACTORY_HPP
2 #define VERTEXCFD_CONDUCTIONBOUNDARYSTATE_FACTORY_HPP
3 
4 #include "closure_models/VertexCFD_Closure_ConstantScalarField.hpp"
5 
6 #include "conduction/boundary_conditions/VertexCFD_BoundaryState_AdiabaticWall.hpp"
7 #include "conduction/closure_models/VertexCFD_Closure_ConductionThermalConductivity.hpp"
8 
9 #include "boundary_conditions/VertexCFD_BoundaryState_VariableExtrapolate.hpp"
10 #include "boundary_conditions/VertexCFD_BoundaryState_VariableFixed.hpp"
11 
12 #include <Panzer_Evaluator_WithBaseImpl.hpp>
13 
14 #include <Teuchos_ParameterList.hpp>
15 #include <Teuchos_RCP.hpp>
16 
17 namespace VertexCFD
18 {
19 namespace BoundaryCondition
20 {
21 //--------------------------------------------------------------------------//
37 template<class EvalType, class Traits, int NumSpaceDim>
39 {
40  public:
42  static constexpr int num_space_dim = NumSpaceDim;
43 
62  static std::vector<Teuchos::RCP<PHX::Evaluator<Traits>>>
63  create(const panzer::IntegrationRule& ir,
64  const Teuchos::ParameterList& bc_params,
65  const Teuchos::ParameterList& closure_model)
66  {
67  // Evaluator vector to return
68  std::vector<Teuchos::RCP<PHX::Evaluator<panzer::Traits>>> evaluators;
69 
70  // Get material property. Note: it is assumed that the material
71  // property is listed under 'Material Properties' in the closure model
72  // of the input file.
73  const auto mat_prop_list
74  = closure_model.sublist("Material Properties");
75 
76  // Register thermal conductivity to be used on the boundary based on
77  // the material property type set in the input file
78  const auto closure_type = mat_prop_list.get<std::string>("Type");
79  if (closure_type == "ConstantMaterialProperties")
80  {
81  const auto mat_prop = Teuchos::rcp(
83  panzer::Traits>(
84  ir, mat_prop_list));
85  evaluators.push_back(mat_prop);
86  }
87 
88  // Loop over boundary conditions found in input file
89  Teuchos::RCP<PHX::Evaluator<Traits>> state;
90  bool found_model = false;
91  if (bc_params.isType<std::string>("Type"))
92  {
93  const auto bc_type = bc_params.get<std::string>("Type");
94 
95  if (bc_type == "AdiabaticWall")
96  {
97  state = Teuchos::rcp(new AdiabaticWall<EvalType, Traits>(ir));
98  evaluators.push_back(state);
99  found_model = true;
100  }
101 
102  if (bc_type == "Extrapolate")
103  {
104  state = Teuchos::rcp(new VariableExtrapolate<EvalType, Traits>(
105  ir, "temperature"));
106  evaluators.push_back(state);
107  found_model = true;
108  }
109 
110  if (bc_type == "Fixed")
111  {
112  state = Teuchos::rcp(new VariableFixed<EvalType, Traits>(
113  ir, bc_params, "temperature"));
114  evaluators.push_back(state);
115  found_model = true;
116  }
117 
118  // Error message if model not found
119  if (!found_model)
120  {
121  std::string msg = "\n\nBoundary state " + bc_type
122  + " failed to build.\n";
123  msg += "The boundary conditions implemented in VERTEX-CFD\n";
124  msg += "for the conduction equation are:\n";
125  msg += "AdiabaticWall,\n";
126  msg += "Extrapolate,\n";
127  msg += "Fixed,\n";
128  msg += "\n";
129  throw std::runtime_error(msg);
130  }
131  }
132 
133  // Return evaluators
134  return evaluators;
135  }
136 };
137 
138 //--------------------------------------------------------------------------//
139 
140 } // end namespace BoundaryCondition
141 } // end namespace VertexCFD
142 
143 #endif // end VERTEXCFD_CONDUCTIONBOUNDARYSTATE_FACTORY_HPP
VertexCFD
Definition: tstMethodManufacturedSolutionBC.cpp:23
VertexCFD::BoundaryCondition::ConductionBoundaryStateFactory
Factory for creating boundary‑state evaluators for the conduction equation.
Definition: VertexCFD_ConductionBoundaryState_Factory.hpp:39
VertexCFD::ClosureModel::ConductionThermalConductivity
Evaluates temperature‑dependent thermal conductivity for conduction models.
Definition: VertexCFD_Closure_ConductionThermalConductivity.hpp:38
VertexCFD::BoundaryCondition::AdiabaticWall
Boundary condition evaluator for an adiabatic wall.
Definition: VertexCFD_BoundaryState_AdiabaticWall.hpp:36
VertexCFD::BoundaryCondition::VariableFixed
Definition: VertexCFD_BoundaryState_VariableFixed.hpp:22
VertexCFD::BoundaryCondition::ConductionBoundaryStateFactory::num_space_dim
static constexpr int num_space_dim
Number of spatial dimensions (alias for the template parameter).
Definition: VertexCFD_ConductionBoundaryState_Factory.hpp:42
VertexCFD::BoundaryCondition::VariableExtrapolate
Definition: VertexCFD_BoundaryState_VariableExtrapolate.hpp:22
VertexCFD::BoundaryCondition::ConductionBoundaryStateFactory::create
static std::vector< Teuchos::RCP< PHX::Evaluator< Traits > > > create(const panzer::IntegrationRule &ir, const Teuchos::ParameterList &bc_params, const Teuchos::ParameterList &closure_model)
Create a set of boundary‑state evaluators for a given integration rule.
Definition: VertexCFD_ConductionBoundaryState_Factory.hpp:63