GRINS-0.6.0
axisym_heat_transfer_bc_handling.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2015 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 
26 // This class
28 
29 // libMesh
30 #include "libmesh/const_function.h"
31 #include "libmesh/fem_context.h"
32 #include "libmesh/dirichlet_boundaries.h"
33 #include "libmesh/dof_map.h"
34 #include "libmesh/fem_system.h"
35 
36 namespace GRINS
37 {
38 
40  const GetPot& input)
41  : BCHandlingBase(physics_name)
42  {
43  _T_var_name = input("Physics/VariableNames/Temperature", T_var_name_default );
44 
45  std::string id_str = "Physics/"+_physics_name+"/bc_ids";
46  std::string bc_str = "Physics/"+_physics_name+"/bc_types";
47  std::string var_str = "Physics/"+_physics_name+"/bc_variables";
48  std::string val_str = "Physics/"+_physics_name+"/bc_values";
49 
50  this->read_bc_data( input, id_str, bc_str, var_str, val_str );
51 
52  return;
53  }
54 
56  {
57  return;
58  }
59 
60  int AxisymmetricHeatTransferBCHandling::string_to_int( const std::string& bc_type ) const
61  {
62  AHT_BC_TYPES bc_type_out;
63 
64  if( bc_type == "isothermal_wall" )
65  bc_type_out = ISOTHERMAL_WALL;
66 
67  else if( bc_type == "adiabatic_wall" )
68  bc_type_out = ADIABATIC_WALL;
69 
70  else if( bc_type == "prescribed_heat_flux" )
71  bc_type_out = PRESCRIBED_HEAT_FLUX;
72 
73  else if( bc_type == "general_heat_flux" )
74  bc_type_out = GENERAL_HEAT_FLUX;
75 
76  else if( bc_type == "axisymmetric" )
77  {
78  bc_type_out = AXISYMMETRIC;
79  }
80  else
81  {
82  std::cerr << "==========================================================" << std::endl
83  << "Error: Invalid bc_type " << bc_type << std::endl
84  << " Physics class is " << _physics_name << std::endl
85  << "==========================================================" << std::endl;
86  libmesh_error();
87  }
88 
89  return bc_type_out;
90  }
91 
92  void AxisymmetricHeatTransferBCHandling::init_bc_data( const libMesh::FEMSystem& system )
93  {
94  _T_var = system.variable_number( _T_var_name );
95  }
96 
98  const std::string& bc_id_string,
99  const int bc_type,
100  const std::string& bc_vars,
101  const std::string& bc_value,
102  const GetPot& input )
103  {
104  switch(bc_type)
105  {
106  case(AXISYMMETRIC):
107  {
108  this->set_neumann_bc_type( bc_id, bc_type );
109  }
110  break;
111  case(ISOTHERMAL_WALL):
112  {
113  this->set_dirichlet_bc_type( bc_id, bc_type );
114 
115  this->set_dirichlet_bc_value( bc_id, input("Physics/"+_physics_name+"/T_wall_"+bc_id_string, 0.0 ) );
116  }
117  break;
118 
119  case(ADIABATIC_WALL):
120  {
121  this->set_neumann_bc_type( bc_id, bc_type );
122  }
123  break;
124 
125  case(PRESCRIBED_HEAT_FLUX):
126  {
127  this->set_neumann_bc_type( bc_id, bc_type );
128 
129  libMesh::RealGradient q_in;
130 
131  int num_q_components = input.vector_variable_size("Physics/"+_physics_name+"/q_wall_"+bc_id_string);
132 
133  for( int i = 0; i < num_q_components; i++ )
134  {
135  q_in(i) = input("Physics/"+_physics_name+"/q_wall_"+bc_id_string, 0.0, i );
136  }
137 
138  this->set_neumann_bc_value( bc_id, q_in );
139  }
140  break;
141  case(GENERAL_HEAT_FLUX):
142  {
143  this->set_neumann_bc_type( bc_id, bc_type );
144  }
145  break;
146  default:
147  {
148  // Call base class to detect any physics-common boundary conditions
149  BCHandlingBase::init_bc_types( bc_id, bc_id_string, bc_type,
150  bc_vars, bc_value, input );
151  }
152  }// End switch(bc_type)
153 
154  return;
155  }
156 
158  const GRINS::CachedValues& cache,
159  const bool request_jacobian,
160  const BoundaryID bc_id,
161  const BCType bc_type ) const
162  {
163  switch( bc_type )
164  {
165  case(AXISYMMETRIC):
166  // Don't need to do anything for dT/dr = 0
167  break;
168  // Zero heat flux
169  case(ADIABATIC_WALL):
170  // Don't need to do anything: q = 0 in this case
171  break;
172 
173  // Prescribed constant heat flux
174  case(PRESCRIBED_HEAT_FLUX):
175  {
177  this->get_neumann_bc_value(bc_id) );
178  }
179  break;
180  // General heat flux from user specified function
181  case(GENERAL_HEAT_FLUX):
182  {
183  _bound_conds.apply_neumann_axisymmetric( context, cache, request_jacobian, _T_var, -1.0,
184  this->get_neumann_bound_func( bc_id, _T_var ) );
185  }
186  break;
187  default:
188  {
189  std::cerr << "Error: Invalid Neumann BC type for " << _physics_name
190  << std::endl;
191  libmesh_error();
192  }
193  }
194  return;
195  }
196 
198  libMesh::DofMap& dof_map,
199  BoundaryID bc_id,
200  BCType bc_type ) const
201  {
202  switch( bc_type )
203  {
204  case(ISOTHERMAL_WALL):
205  {
206  std::set<BoundaryID> dbc_ids;
207  dbc_ids.insert(bc_id);
208 
209  std::vector<VariableIndex> dbc_vars;
210  dbc_vars.push_back(_T_var);
211 
212  libMesh::ConstFunction<libMesh::Number> t_func(this->get_dirichlet_bc_value(bc_id));
213 
214  libMesh::DirichletBoundary t_dbc( dbc_ids, dbc_vars, &t_func );
215 
216  dof_map.add_dirichlet_boundary( t_dbc );
217  }
218  break;
219  default:
220  {
221  std::cerr << "Error: Invalid Dirichlet BC type for " << _physics_name
222  << std::endl;
223  libmesh_error();
224  }
225  }// end switch
226 
227  return;
228  }
229 
230 } // namespace GRINS
virtual void read_bc_data(const GetPot &input, const std::string &id_str, const std::string &bc_str, const std::string &var_str, const std::string &val_str)
virtual int string_to_int(const std::string &bc_type_in) const
virtual void init_bc_types(const GRINS::BoundaryID bc_id, const std::string &bc_id_string, const int bc_type, const std::string &bc_vars, const std::string &bc_value, const GetPot &input)
libMesh::boundary_id_type BoundaryID
More descriptive name of the type used for boundary ids.
Definition: var_typedefs.h:54
virtual void init_bc_data(const libMesh::FEMSystem &system)
Override this method to initialize any system-dependent data.
std::tr1::shared_ptr< GRINS::NeumannFuncObj > get_neumann_bound_func(GRINS::BoundaryID bc_id, GRINS::VariableIndex var_id) const
void apply_neumann_axisymmetric(AssemblyContext &context, const VariableIndex var, const libMesh::Real sign, const typename libMesh::TensorTools::IncrementRank< FEShape >::type &value) const
Applies Neumann boundary conditions for the constant case.
void set_dirichlet_bc_value(GRINS::BoundaryID bc_id, libMesh::Real value, int component=0)
void set_neumann_bc_value(GRINS::BoundaryID bc_id, const libMesh::Point &q_in)
GRINS namespace.
const libMesh::Point & get_neumann_bc_value(GRINS::BoundaryID bc_id) const
const std::string T_var_name_default
temperature
virtual void user_apply_neumann_bcs(AssemblyContext &context, const GRINS::CachedValues &cache, const bool request_jacobian, const GRINS::BoundaryID bc_id, const GRINS::BCType bc_type) const
virtual void init_bc_types(const GRINS::BoundaryID bc_id, const std::string &bc_id_string, const int bc_type, const std::string &bc_vars, const std::string &bc_value, const GetPot &input)
virtual void user_init_dirichlet_bcs(libMesh::FEMSystem *system, libMesh::DofMap &dof_map, GRINS::BoundaryID bc_id, GRINS::BCType bc_type) const
GRINS::BoundaryConditions _bound_conds
Object that stashes generic boundary condition types.
Base class for reading and handling boundary conditions for physics classes.
void set_neumann_bc_type(GRINS::BoundaryID bc_id, int bc_type)
int BCType
Definition: bc_types.h:32
void set_dirichlet_bc_type(GRINS::BoundaryID bc_id, int bc_type)
libMesh::Real get_dirichlet_bc_value(GRINS::BoundaryID bc_id, int component=0) const

Generated on Mon Jun 22 2015 21:32:19 for GRINS-0.6.0 by  doxygen 1.8.9.1