GRINS-0.6.0
Public Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | List of all members
GRINS::HeatTransfer< Conductivity > Class Template Reference

Physics class for Heat Transfer. More...

#include <heat_transfer.h>

Inheritance diagram for GRINS::HeatTransfer< Conductivity >:
Inheritance graph
[legend]
Collaboration diagram for GRINS::HeatTransfer< Conductivity >:
Collaboration graph
[legend]

Public Member Functions

 HeatTransfer (const std::string &physics_name, const GetPot &input)
 
 ~HeatTransfer ()
 
virtual void read_input_options (const GetPot &input)
 Read options from GetPot input file. More...
 
virtual void register_postprocessing_vars (const GetPot &input, PostProcessedQuantities< libMesh::Real > &postprocessing)
 Register postprocessing variables for HeatTransfer. More...
 
virtual void element_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Time dependent part(s) of physics for element interiors. More...
 
virtual void side_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Time dependent part(s) of physics for boundaries of elements on the domain boundary. More...
 
virtual void mass_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Mass matrix part(s) for element interiors. All boundary terms lie within the time_derivative part. More...
 
virtual void compute_postprocessed_quantity (unsigned int quantity_index, const AssemblyContext &context, const libMesh::Point &point, libMesh::Real &value)
 Compute value of postprocessed quantities at libMesh::Point. More...
 
virtual void init_variables (libMesh::FEMSystem *system)
 Initialization Heat Transfer variables. More...
 
virtual void set_time_evolving_vars (libMesh::FEMSystem *system)
 Sets velocity variables to be time-evolving. More...
 
virtual void init_context (AssemblyContext &context)
 Initialize context for added physics variables. More...
 
virtual void register_parameter (const std::string &param_name, libMesh::ParameterMultiPointer< libMesh::Number > &param_pointer) const
 Each subclass will register its copy of an independent. More...
 
virtual bool enabled_on_elem (const libMesh::Elem *elem)
 Find if current physics is active on supplied element. More...
 
void set_is_steady (bool is_steady)
 Sets whether this physics is to be solved with a steady solver or not. More...
 
bool is_steady () const
 Returns whether or not this physics is being solved with a steady solver. More...
 
virtual void auxiliary_init (MultiphysicsSystem &system)
 Any auxillary initialization a Physics class may need. More...
 
virtual void nonlocal_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Time dependent part(s) of physics for scalar variables. More...
 
virtual void element_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for element interiors. More...
 
virtual void side_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for boundaries of elements on the domain boundary. More...
 
virtual void nonlocal_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for scalar variables. More...
 
virtual void nonlocal_mass_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Mass matrix part(s) for scalar variables. More...
 
void init_bcs (libMesh::FEMSystem *system)
 
void init_ics (libMesh::FEMSystem *system, libMesh::CompositeFunction< libMesh::Number > &all_ics)
 
void attach_neumann_bound_func (GRINS::NBCContainer &neumann_bcs)
 
void attach_dirichlet_bound_func (const GRINS::DBCContainer &dirichlet_bc)
 
virtual void compute_element_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_side_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_element_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_side_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_mass_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_mass_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
BCHandlingBaseget_bc_handler ()
 
ICHandlingBaseget_ic_handler ()
 
virtual void set_parameter (libMesh::Number &param_variable, const GetPot &input, const std::string &param_name, libMesh::Number param_default)
 Each subclass can simultaneously read a parameter value from. More...
 

Protected Attributes

unsigned int _dim
 Physical dimension of problem. More...
 
PrimitiveFlowFEVariables _flow_vars
 
PrimitiveTempFEVariables _temp_vars
 
libMesh::Number _rho
 Material parameters, read from input. More...
 
libMesh::Number _Cp
 
Conductivity _k
 Conductivity. More...
 
const PhysicsName _physics_name
 Name of the physics object. Used for reading physics specific inputs. More...
 
GRINS::BCHandlingBase_bc_handler
 
GRINS::ICHandlingBase_ic_handler
 
std::set< libMesh::subdomain_id_type > _enabled_subdomains
 Subdomains on which the current Physics class is enabled. More...
 
bool _is_axisymmetric
 

Static Protected Attributes

static bool _is_steady = false
 Caches whether or not the solver that's being used is steady or not. More...
 

Private Member Functions

 HeatTransfer ()
 

Private Attributes

unsigned int _k_index
 Index from registering this postprocessed quantity. More...
 

Detailed Description

template<class Conductivity>
class GRINS::HeatTransfer< Conductivity >

Physics class for Heat Transfer.

Definition at line 40 of file heat_transfer.h.

Constructor & Destructor Documentation

template<class K >
GRINS::HeatTransfer< K >::HeatTransfer ( const std::string &  physics_name,
const GetPot &  input 
)

Definition at line 46 of file heat_transfer.C.

References GRINS::Physics::_bc_handler, GRINS::Physics::_ic_handler, GRINS::Physics::_is_axisymmetric, GRINS::BCHandlingBase::is_axisymmetric(), and GRINS::HeatTransfer< Conductivity >::read_input_options().

47  : HeatTransferBase<K>(physics_name, input),
48  _k_index(0)
49  {
50  this->read_input_options(input);
51 
52  // This is deleted in the base class
53  this->_bc_handler = new HeatTransferBCHandling( physics_name, input );
54 
55  if( this->_bc_handler->is_axisymmetric() )
56  {
57  this->_is_axisymmetric = true;
58  }
59 
60  this->_ic_handler = new GenericICHandler( physics_name, input );
61 
62  return;
63  }
GRINS::ICHandlingBase * _ic_handler
Definition: physics.h:258
GRINS::BCHandlingBase * _bc_handler
Definition: physics.h:256
unsigned int _k_index
Index from registering this postprocessed quantity.
Definition: heat_transfer.h:83
virtual void read_input_options(const GetPot &input)
Read options from GetPot input file.
Definition: heat_transfer.C:72
bool is_axisymmetric() const
bool _is_axisymmetric
Definition: physics.h:268
template<class K >
GRINS::HeatTransfer< K >::~HeatTransfer ( )

Definition at line 66 of file heat_transfer.C.

67  {
68  return;
69  }
template<class Conductivity >
GRINS::HeatTransfer< Conductivity >::HeatTransfer ( )
private

Member Function Documentation

void GRINS::Physics::attach_dirichlet_bound_func ( const GRINS::DBCContainer dirichlet_bc)
inherited

Definition at line 150 of file physics.C.

References GRINS::Physics::_bc_handler, and GRINS::BCHandlingBase::attach_dirichlet_bound_func().

151  {
152  _bc_handler->attach_dirichlet_bound_func( dirichlet_bc );
153  return;
154  }
GRINS::BCHandlingBase * _bc_handler
Definition: physics.h:256
void attach_dirichlet_bound_func(const GRINS::DBCContainer &dirichlet_bc)
void GRINS::Physics::attach_neumann_bound_func ( GRINS::NBCContainer neumann_bcs)
inherited

Definition at line 144 of file physics.C.

References GRINS::Physics::_bc_handler, and GRINS::BCHandlingBase::attach_neumann_bound_func().

145  {
146  _bc_handler->attach_neumann_bound_func( neumann_bcs );
147  return;
148  }
GRINS::BCHandlingBase * _bc_handler
Definition: physics.h:256
void attach_neumann_bound_func(GRINS::NBCContainer &neumann_bcs)
void GRINS::Physics::auxiliary_init ( MultiphysicsSystem system)
virtualinherited

Any auxillary initialization a Physics class may need.

This is called after all variables are added, so this method can safely query the MultiphysicsSystem about variable information.

Definition at line 113 of file physics.C.

114  {
115  return;
116  }
void GRINS::Physics::compute_element_constraint_cache ( const AssemblyContext context,
CachedValues cache 
)
virtualinherited

Definition at line 185 of file physics.C.

Referenced by GRINS::MultiphysicsSystem::element_constraint().

187  {
188  return;
189  }
void GRINS::Physics::compute_element_time_derivative_cache ( const AssemblyContext context,
CachedValues cache 
)
virtualinherited
void GRINS::Physics::compute_mass_residual_cache ( const AssemblyContext context,
CachedValues cache 
)
virtualinherited

Definition at line 203 of file physics.C.

Referenced by GRINS::MultiphysicsSystem::mass_residual().

205  {
206  return;
207  }
void GRINS::Physics::compute_nonlocal_constraint_cache ( const AssemblyContext context,
CachedValues cache 
)
virtualinherited

Definition at line 197 of file physics.C.

Referenced by GRINS::MultiphysicsSystem::nonlocal_constraint().

199  {
200  return;
201  }
void GRINS::Physics::compute_nonlocal_mass_residual_cache ( const AssemblyContext context,
CachedValues cache 
)
virtualinherited

Definition at line 209 of file physics.C.

Referenced by GRINS::MultiphysicsSystem::nonlocal_mass_residual().

211  {
212  return;
213  }
void GRINS::Physics::compute_nonlocal_time_derivative_cache ( const AssemblyContext context,
CachedValues cache 
)
virtualinherited

Definition at line 179 of file physics.C.

Referenced by GRINS::MultiphysicsSystem::nonlocal_time_derivative().

181  {
182  return;
183  }
template<class K >
void GRINS::HeatTransfer< K >::compute_postprocessed_quantity ( unsigned int  quantity_index,
const AssemblyContext context,
const libMesh::Point &  point,
libMesh::Real &  value 
)
virtual

Compute value of postprocessed quantities at libMesh::Point.

Reimplemented from GRINS::Physics.

Definition at line 336 of file heat_transfer.C.

340  {
341  if( quantity_index == this->_k_index )
342  {
343  value = this->_k(point, context.get_time());
344  }
345 
346  return;
347  }
unsigned int _k_index
Index from registering this postprocessed quantity.
Definition: heat_transfer.h:83
Conductivity _k
Conductivity.
void GRINS::Physics::compute_side_constraint_cache ( const AssemblyContext context,
CachedValues cache 
)
virtualinherited

Definition at line 191 of file physics.C.

Referenced by GRINS::MultiphysicsSystem::side_constraint().

193  {
194  return;
195  }
void GRINS::Physics::compute_side_time_derivative_cache ( const AssemblyContext context,
CachedValues cache 
)
virtualinherited

Reimplemented in GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >.

Definition at line 173 of file physics.C.

Referenced by GRINS::MultiphysicsSystem::side_time_derivative().

175  {
176  return;
177  }
void GRINS::Physics::element_constraint ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtualinherited
template<class K >
void GRINS::HeatTransfer< K >::element_time_derivative ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtual

Time dependent part(s) of physics for element interiors.

Reimplemented from GRINS::Physics.

Definition at line 109 of file heat_transfer.C.

112  {
113 #ifdef GRINS_USE_GRVY_TIMERS
114  this->_timer->BeginTimer("HeatTransfer::element_time_derivative");
115 #endif
116 
117  // The number of local degrees of freedom in each variable.
118  const unsigned int n_T_dofs = context.get_dof_indices(this->_temp_vars.T_var()).size();
119  const unsigned int n_u_dofs = context.get_dof_indices(this->_flow_vars.u_var()).size();
120 
121  //TODO: check n_T_dofs is same as n_u_dofs, n_v_dofs, n_w_dofs
122 
123  // We get some references to cell-specific data that
124  // will be used to assemble the linear system.
125 
126  // Element Jacobian * quadrature weights for interior integration.
127  const std::vector<libMesh::Real> &JxW =
128  context.get_element_fe(this->_temp_vars.T_var())->get_JxW();
129 
130  // The temperature shape functions at interior quadrature points.
131  const std::vector<std::vector<libMesh::Real> >& T_phi =
132  context.get_element_fe(this->_temp_vars.T_var())->get_phi();
133 
134  // The velocity shape functions at interior quadrature points.
135  const std::vector<std::vector<libMesh::Real> >& vel_phi =
136  context.get_element_fe(this->_flow_vars.u_var())->get_phi();
137 
138  // The temperature shape function gradients (in global coords.)
139  // at interior quadrature points.
140  const std::vector<std::vector<libMesh::RealGradient> >& T_gradphi =
141  context.get_element_fe(this->_temp_vars.T_var())->get_dphi();
142 
143  const std::vector<libMesh::Point>& u_qpoint =
144  context.get_element_fe(this->_flow_vars.u_var())->get_xyz();
145 
146  libMesh::DenseSubMatrix<libMesh::Number> &KTT = context.get_elem_jacobian(this->_temp_vars.T_var(), this->_temp_vars.T_var()); // R_{T},{T}
147 
148  libMesh::DenseSubMatrix<libMesh::Number> &KTu = context.get_elem_jacobian(this->_temp_vars.T_var(), this->_flow_vars.u_var()); // R_{T},{u}
149  libMesh::DenseSubMatrix<libMesh::Number> &KTv = context.get_elem_jacobian(this->_temp_vars.T_var(), this->_flow_vars.v_var()); // R_{T},{v}
150  libMesh::DenseSubMatrix<libMesh::Number>* KTw = NULL;
151 
152  libMesh::DenseSubVector<libMesh::Number> &FT = context.get_elem_residual(this->_temp_vars.T_var()); // R_{T}
153 
154  if( this->_dim == 3 )
155  {
156  KTw = &context.get_elem_jacobian(this->_temp_vars.T_var(), this->_flow_vars.w_var()); // R_{T},{w}
157  }
158 
159  // Now we will build the element Jacobian and residual.
160  // Constructing the residual requires the solution and its
161  // gradient from the previous timestep. This must be
162  // calculated at each quadrature point by summing the
163  // solution degree-of-freedom values by the appropriate
164  // weight functions.
165  unsigned int n_qpoints = context.get_element_qrule().n_points();
166 
167  for (unsigned int qp=0; qp != n_qpoints; qp++)
168  {
169  // Compute the solution & its gradient at the old Newton iterate.
170  libMesh::Number u, v;
171  u = context.interior_value(this->_flow_vars.u_var(), qp);
172  v = context.interior_value(this->_flow_vars.v_var(), qp);
173 
174  libMesh::Gradient grad_T;
175  grad_T = context.interior_gradient(this->_temp_vars.T_var(), qp);
176 
177  libMesh::NumberVectorValue U (u,v);
178  if (this->_dim == 3)
179  U(2) = context.interior_value(this->_flow_vars.w_var(), qp);
180 
181  const libMesh::Number r = u_qpoint[qp](0);
182 
183  libMesh::Real jac = JxW[qp];
184 
185  // Compute the conductivity at this qp
186  libMesh::Real _k_qp = this->_k(context, qp);
187 
188  if( this->_is_axisymmetric )
189  {
190  jac *= r;
191  }
192 
193  // First, an i-loop over the degrees of freedom.
194  for (unsigned int i=0; i != n_T_dofs; i++)
195  {
196  FT(i) += jac *
197  (-this->_rho*this->_Cp*T_phi[i][qp]*(U*grad_T) // convection term
198  -_k_qp*(T_gradphi[i][qp]*grad_T) ); // diffusion term
199 
200  if (compute_jacobian)
201  {
202  for (unsigned int j=0; j != n_T_dofs; j++)
203  {
204  // TODO: precompute some terms like:
205  // this->_rho*this->_Cp*T_phi[i][qp]*(vel_phi[j][qp]*T_grad_phi[j][qp])
206 
207  KTT(i,j) += jac * context.get_elem_solution_derivative() *
208  (-this->_rho*this->_Cp*T_phi[i][qp]*(U*T_gradphi[j][qp]) // convection term
209  -_k_qp*(T_gradphi[i][qp]*T_gradphi[j][qp])); // diffusion term
210  } // end of the inner dof (j) loop
211 
212  // Matrix contributions for the Tu, Tv and Tw couplings (n_T_dofs same as n_u_dofs, n_v_dofs and n_w_dofs)
213  for (unsigned int j=0; j != n_u_dofs; j++)
214  {
215  KTu(i,j) += jac * context.get_elem_solution_derivative()*(-this->_rho*this->_Cp*T_phi[i][qp]*(vel_phi[j][qp]*grad_T(0)));
216  KTv(i,j) += jac * context.get_elem_solution_derivative()*(-this->_rho*this->_Cp*T_phi[i][qp]*(vel_phi[j][qp]*grad_T(1)));
217  if (this->_dim == 3)
218  (*KTw)(i,j) += jac * context.get_elem_solution_derivative()*(-this->_rho*this->_Cp*T_phi[i][qp]*(vel_phi[j][qp]*grad_T(2)));
219  } // end of the inner dof (j) loop
220 
221  } // end - if (compute_jacobian && context.get_elem_solution_derivative())
222 
223  } // end of the outer dof (i) loop
224  } // end of the quadrature point (qp) loop
225 
226 #ifdef GRINS_USE_GRVY_TIMERS
227  this->_timer->EndTimer("HeatTransfer::element_time_derivative");
228 #endif
229 
230  return;
231  }
libMesh::Number _rho
Material parameters, read from input.
Conductivity _k
Conductivity.
PrimitiveFlowFEVariables _flow_vars
PrimitiveTempFEVariables _temp_vars
unsigned int _dim
Physical dimension of problem.
bool _is_axisymmetric
Definition: physics.h:268
bool GRINS::Physics::enabled_on_elem ( const libMesh::Elem *  elem)
virtualinherited

Find if current physics is active on supplied element.

Definition at line 83 of file physics.C.

References GRINS::Physics::_enabled_subdomains.

84  {
85  // Check if enabled_subdomains flag has been set and if we're
86  // looking at a real element (rather than a nonlocal evaluation)
87  if( !elem || _enabled_subdomains.empty() )
88  return true;
89 
90  // Check if current physics is enabled on elem
91  if( _enabled_subdomains.find( elem->subdomain_id() ) == _enabled_subdomains.end() )
92  return false;
93 
94  return true;
95  }
std::set< libMesh::subdomain_id_type > _enabled_subdomains
Subdomains on which the current Physics class is enabled.
Definition: physics.h:261
BCHandlingBase * GRINS::Physics::get_bc_handler ( )
inlineinherited

Definition at line 282 of file physics.h.

References GRINS::Physics::_bc_handler.

283  {
284  return _bc_handler;
285  }
GRINS::BCHandlingBase * _bc_handler
Definition: physics.h:256
ICHandlingBase * GRINS::Physics::get_ic_handler ( )
inlineinherited

Definition at line 288 of file physics.h.

References GRINS::Physics::_ic_handler.

289  {
290  return _ic_handler;
291  }
GRINS::ICHandlingBase * _ic_handler
Definition: physics.h:258
void GRINS::Physics::init_bcs ( libMesh::FEMSystem *  system)
inherited

Definition at line 118 of file physics.C.

References GRINS::Physics::_bc_handler, GRINS::BCHandlingBase::init_bc_data(), GRINS::BCHandlingBase::init_dirichlet_bc_func_objs(), GRINS::BCHandlingBase::init_dirichlet_bcs(), and GRINS::BCHandlingBase::init_periodic_bcs().

119  {
120  // Only need to init BC's if the physics actually created a handler
121  if( _bc_handler )
122  {
123  _bc_handler->init_bc_data( *system );
124  _bc_handler->init_dirichlet_bcs( system );
126  _bc_handler->init_periodic_bcs( system );
127  }
128 
129  return;
130  }
GRINS::BCHandlingBase * _bc_handler
Definition: physics.h:256
virtual void init_dirichlet_bcs(libMesh::FEMSystem *system) const
virtual void init_periodic_bcs(libMesh::FEMSystem *system) const
virtual void init_dirichlet_bc_func_objs(libMesh::FEMSystem *system) const
virtual void init_bc_data(const libMesh::FEMSystem &system)
Override this method to initialize any system-dependent data.
template<class K >
void GRINS::HeatTransferBase< K >::init_context ( AssemblyContext context)
virtualinherited

Initialize context for added physics variables.

Reimplemented from GRINS::Physics.

Reimplemented in GRINS::HeatTransferStabilizationBase< Conductivity >.

Definition at line 92 of file heat_transfer_base.C.

Referenced by GRINS::HeatTransferStabilizationBase< Conductivity >::init_context().

93  {
94  // We should prerequest all the data
95  // we will need to build the linear system
96  // or evaluate a quantity of interest.
97  context.get_element_fe(_temp_vars.T_var())->get_JxW();
98  context.get_element_fe(_temp_vars.T_var())->get_phi();
99  context.get_element_fe(_temp_vars.T_var())->get_dphi();
100  context.get_element_fe(_temp_vars.T_var())->get_xyz();
101 
102  context.get_side_fe(_temp_vars.T_var())->get_JxW();
103  context.get_side_fe(_temp_vars.T_var())->get_phi();
104  context.get_side_fe(_temp_vars.T_var())->get_dphi();
105  context.get_side_fe(_temp_vars.T_var())->get_xyz();
106 
107  return;
108  }
PrimitiveTempFEVariables _temp_vars
void GRINS::Physics::init_ics ( libMesh::FEMSystem *  system,
libMesh::CompositeFunction< libMesh::Number > &  all_ics 
)
inherited

Definition at line 133 of file physics.C.

References GRINS::Physics::_ic_handler, and GRINS::ICHandlingBase::init_ic_data().

135  {
136  if( _ic_handler )
137  {
138  _ic_handler->init_ic_data( *system, all_ics );
139  }
140 
141  return;
142  }
GRINS::ICHandlingBase * _ic_handler
Definition: physics.h:258
virtual void init_ic_data(const libMesh::FEMSystem &system, libMesh::CompositeFunction< libMesh::Number > &all_ics)
Override this method to initialize any system-dependent data.
template<class K >
void GRINS::HeatTransferBase< K >::init_variables ( libMesh::FEMSystem *  system)
virtualinherited

Initialization Heat Transfer variables.

Add velocity and pressure variables to system.

Implements GRINS::Physics.

Reimplemented in GRINS::HeatTransferStabilizationBase< Conductivity >.

Definition at line 71 of file heat_transfer_base.C.

Referenced by GRINS::HeatTransferStabilizationBase< Conductivity >::init_variables().

72  {
73  // Get libMesh to assign an index for each variable
74  this->_dim = system->get_mesh().mesh_dimension();
75 
76  _flow_vars.init(system);
77  _temp_vars.init(system);
78 
79  return;
80  }
virtual void init(libMesh::FEMSystem *system)
PrimitiveFlowFEVariables _flow_vars
PrimitiveTempFEVariables _temp_vars
unsigned int _dim
Physical dimension of problem.
virtual void init(libMesh::FEMSystem *system)
bool GRINS::Physics::is_steady ( ) const
inherited

Returns whether or not this physics is being solved with a steady solver.

Definition at line 103 of file physics.C.

References GRINS::Physics::_is_steady.

Referenced by GRINS::Physics::set_is_steady().

104  {
105  return _is_steady;
106  }
static bool _is_steady
Caches whether or not the solver that's being used is steady or not.
Definition: physics.h:266
template<class K >
void GRINS::HeatTransfer< K >::mass_residual ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtual

Mass matrix part(s) for element interiors. All boundary terms lie within the time_derivative part.

Reimplemented from GRINS::Physics.

Definition at line 260 of file heat_transfer.C.

263  {
264 #ifdef GRINS_USE_GRVY_TIMERS
265  this->_timer->BeginTimer("HeatTransfer::mass_residual");
266 #endif
267 
268  // First we get some references to cell-specific data that
269  // will be used to assemble the linear system.
270 
271  // Element Jacobian * quadrature weights for interior integration
272  const std::vector<libMesh::Real> &JxW =
273  context.get_element_fe(this->_temp_vars.T_var())->get_JxW();
274 
275  // The shape functions at interior quadrature points.
276  const std::vector<std::vector<libMesh::Real> >& phi =
277  context.get_element_fe(this->_temp_vars.T_var())->get_phi();
278 
279  const std::vector<libMesh::Point>& u_qpoint =
280  context.get_element_fe(this->_flow_vars.u_var())->get_xyz();
281 
282  // The number of local degrees of freedom in each variable
283  const unsigned int n_T_dofs = context.get_dof_indices(this->_temp_vars.T_var()).size();
284 
285  // The subvectors and submatrices we need to fill:
286  libMesh::DenseSubVector<libMesh::Real> &F = context.get_elem_residual(this->_temp_vars.T_var());
287 
288  libMesh::DenseSubMatrix<libMesh::Real> &M = context.get_elem_jacobian(this->_temp_vars.T_var(), this->_temp_vars.T_var());
289 
290  unsigned int n_qpoints = context.get_element_qrule().n_points();
291 
292  for (unsigned int qp = 0; qp != n_qpoints; ++qp)
293  {
294  // For the mass residual, we need to be a little careful.
295  // The time integrator is handling the time-discretization
296  // for us so we need to supply M(u_fixed)*u' for the residual.
297  // u_fixed will be given by the fixed_interior_value function
298  // while u' will be given by the interior_rate function.
299  libMesh::Real T_dot;
300  context.interior_rate(this->_temp_vars.T_var(), qp, T_dot);
301 
302  const libMesh::Number r = u_qpoint[qp](0);
303 
304  libMesh::Real jac = JxW[qp];
305 
306  if( this->_is_axisymmetric )
307  {
308  jac *= r;
309  }
310 
311  for (unsigned int i = 0; i != n_T_dofs; ++i)
312  {
313  F(i) -= this->_rho*this->_Cp*T_dot*phi[i][qp]*jac;
314 
315  if( compute_jacobian )
316  {
317  for (unsigned int j=0; j != n_T_dofs; j++)
318  {
319  // We're assuming rho, cp are constant w.r.t. T here.
320  M(i,j) -= this->_rho*this->_Cp*phi[j][qp]*phi[i][qp]*jac * context.get_elem_solution_rate_derivative();
321  }
322  }// End of check on Jacobian
323 
324  } // End of element dof loop
325 
326  } // End of the quadrature point loop
327 
328 #ifdef GRINS_USE_GRVY_TIMERS
329  this->_timer->EndTimer("HeatTransfer::mass_residual");
330 #endif
331 
332  return;
333  }
libMesh::Number _rho
Material parameters, read from input.
PrimitiveFlowFEVariables _flow_vars
PrimitiveTempFEVariables _temp_vars
bool _is_axisymmetric
Definition: physics.h:268
void GRINS::Physics::nonlocal_constraint ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtualinherited

Constraint part(s) of physics for scalar variables.

Reimplemented in GRINS::ScalarODE.

Definition at line 250 of file physics.C.

Referenced by GRINS::MultiphysicsSystem::nonlocal_constraint().

253  {
254  return;
255  }
void GRINS::Physics::nonlocal_mass_residual ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtualinherited

Mass matrix part(s) for scalar variables.

Reimplemented in GRINS::ScalarODE, and GRINS::AveragedTurbine< Viscosity >.

Definition at line 264 of file physics.C.

Referenced by GRINS::MultiphysicsSystem::nonlocal_mass_residual().

267  {
268  return;
269  }
void GRINS::Physics::nonlocal_time_derivative ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtualinherited

Time dependent part(s) of physics for scalar variables.

Reimplemented in GRINS::AveragedTurbine< Viscosity >, and GRINS::ScalarODE.

Definition at line 229 of file physics.C.

Referenced by GRINS::MultiphysicsSystem::nonlocal_time_derivative().

232  {
233  return;
234  }
template<class K >
void GRINS::HeatTransfer< K >::read_input_options ( const GetPot &  input)
virtual

Read options from GetPot input file.

Reimplemented from GRINS::Physics.

Definition at line 72 of file heat_transfer.C.

Referenced by GRINS::HeatTransfer< Conductivity >::HeatTransfer().

73  {
74  return;
75  }
template<class K >
void GRINS::HeatTransferBase< K >::register_parameter ( const std::string &  param_name,
libMesh::ParameterMultiPointer< libMesh::Number > &  param_pointer 
) const
virtualinherited

Each subclass will register its copy of an independent.

Reimplemented from GRINS::ParameterUser.

Definition at line 112 of file heat_transfer_base.C.

References GRINS::ParameterUser::register_parameter().

115  {
116  ParameterUser::register_parameter(param_name, param_pointer);
117  _k.register_parameter(param_name, param_pointer);
118  }
virtual void register_parameter(const std::string &param_name, libMesh::ParameterMultiPointer< libMesh::Number > &param_pointer) const
Each subclass will register its copy of an independent.
Conductivity _k
Conductivity.
template<class K >
void GRINS::HeatTransfer< K >::register_postprocessing_vars ( const GetPot &  input,
PostProcessedQuantities< libMesh::Real > &  postprocessing 
)
virtual

Register postprocessing variables for HeatTransfer.

Reimplemented from GRINS::Physics.

Definition at line 78 of file heat_transfer.C.

References GRINS::heat_transfer, and GRINS::PostProcessedQuantities< NumericType >::register_quantity().

80  {
81  std::string section = "Physics/"+heat_transfer+"/output_vars";
82 
83  if( input.have_variable(section) )
84  {
85  unsigned int n_vars = input.vector_variable_size(section);
86 
87  for( unsigned int v = 0; v < n_vars; v++ )
88  {
89  std::string name = input(section,"DIE!",v);
90 
91  if( name == std::string("k") )
92  {
93  this->_k_index = postprocessing.register_quantity( name );
94  }
95  else
96  {
97  std::cerr << "Error: Invalid output_vars value for "+heat_transfer << std::endl
98  << " Found " << name << std::endl
99  << " Acceptable values are: k" << std::endl;
100  libmesh_error();
101  }
102  }
103  }
104 
105  return;
106  }
unsigned int _k_index
Index from registering this postprocessed quantity.
Definition: heat_transfer.h:83
const PhysicsName heat_transfer
void GRINS::Physics::set_is_steady ( bool  is_steady)
inherited

Sets whether this physics is to be solved with a steady solver or not.

Since the member variable is static, only needs to be called on a single physics.

Definition at line 97 of file physics.C.

References GRINS::Physics::_is_steady, and GRINS::Physics::is_steady().

98  {
100  return;
101  }
bool is_steady() const
Returns whether or not this physics is being solved with a steady solver.
Definition: physics.C:103
static bool _is_steady
Caches whether or not the solver that's being used is steady or not.
Definition: physics.h:266
void GRINS::ParameterUser::set_parameter ( libMesh::Number &  param_variable,
const GetPot &  input,
const std::string &  param_name,
libMesh::Number  param_default 
)
virtualinherited

Each subclass can simultaneously read a parameter value from.

Definition at line 35 of file parameter_user.C.

References GRINS::ParameterUser::_my_name, and GRINS::ParameterUser::_my_parameters.

Referenced by GRINS::AveragedFanAdjointStabilization< Viscosity >::AveragedFanAdjointStabilization(), GRINS::AveragedTurbineAdjointStabilization< Viscosity >::AveragedTurbineAdjointStabilization(), GRINS::BoussinesqBuoyancyAdjointStabilization< Viscosity >::BoussinesqBuoyancyAdjointStabilization(), GRINS::BoussinesqBuoyancyBase::BoussinesqBuoyancyBase(), GRINS::BoussinesqBuoyancySPGSMStabilization< Viscosity >::BoussinesqBuoyancySPGSMStabilization(), GRINS::ConstantConductivity::ConstantConductivity(), GRINS::ConstantPrandtlConductivity::ConstantPrandtlConductivity(), GRINS::ConstantSourceFunction::ConstantSourceFunction(), GRINS::ConstantSourceTerm::ConstantSourceTerm(), GRINS::ConstantSpecificHeat::ConstantSpecificHeat(), GRINS::ConstantViscosity::ConstantViscosity(), GRINS::ElasticCable< StressStrainLaw >::ElasticCable(), GRINS::ElasticCableConstantGravity::ElasticCableConstantGravity(), GRINS::ElasticMembrane< StressStrainLaw >::ElasticMembrane(), GRINS::ElasticMembraneConstantPressure::ElasticMembraneConstantPressure(), GRINS::HeatConduction< Conductivity >::HeatConduction(), GRINS::HeatTransferBase< Conductivity >::HeatTransferBase(), GRINS::IncompressibleNavierStokesBase< Viscosity >::IncompressibleNavierStokesBase(), GRINS::AverageNusseltNumber::init(), GRINS::MooneyRivlin::MooneyRivlin(), GRINS::ReactingLowMachNavierStokesBase< Mixture, Evaluator >::ReactingLowMachNavierStokesBase(), GRINS::HookesLaw1D::read_input_options(), GRINS::HookesLaw::read_input_options(), GRINS::AxisymmetricBoussinesqBuoyancy::read_input_options(), and GRINS::VelocityDragAdjointStabilization< Viscosity >::VelocityDragAdjointStabilization().

39  {
40  param_variable = input(param_name, param_default);
41 
42  libmesh_assert_msg(!_my_parameters.count(param_name),
43  "ERROR: " << _my_name << " double-registered parameter " <<
44  param_name);
45 
46  _my_parameters[param_name] = &param_variable;
47  }
std::map< std::string, libMesh::Number * > _my_parameters
template<class K >
void GRINS::HeatTransferBase< K >::set_time_evolving_vars ( libMesh::FEMSystem *  system)
virtualinherited

Sets velocity variables to be time-evolving.

Reimplemented from GRINS::Physics.

Definition at line 83 of file heat_transfer_base.C.

84  {
85  // Tell the system to march temperature forward in time
86  system->time_evolving(_temp_vars.T_var());
87 
88  return;
89  }
PrimitiveTempFEVariables _temp_vars
void GRINS::Physics::side_constraint ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtualinherited

Constraint part(s) of physics for boundaries of elements on the domain boundary.

Reimplemented in GRINS::IncompressibleNavierStokes< Viscosity >, GRINS::LowMachNavierStokes< Viscosity, SpecificHeat, ThermalConductivity >, and GRINS::ReactingLowMachNavierStokes< Mixture, Evaluator >.

Definition at line 243 of file physics.C.

Referenced by GRINS::MultiphysicsSystem::side_constraint().

246  {
247  return;
248  }
template<class K >
void GRINS::HeatTransfer< K >::side_time_derivative ( bool  compute_jacobian,
AssemblyContext context,
CachedValues cache 
)
virtual

Time dependent part(s) of physics for boundaries of elements on the domain boundary.

Reimplemented from GRINS::Physics.

Definition at line 234 of file heat_transfer.C.

237  {
238 #ifdef GRINS_USE_GRVY_TIMERS
239  this->_timer->BeginTimer("HeatTransfer::side_time_derivative");
240 #endif
241 
242  std::vector<BoundaryID> ids = context.side_boundary_ids();
243 
244  for( std::vector<BoundaryID>::const_iterator it = ids.begin();
245  it != ids.end(); it++ )
246  {
247  libmesh_assert (*it != libMesh::BoundaryInfo::invalid_id);
248 
249  this->_bc_handler->apply_neumann_bcs( context, cache, compute_jacobian, *it );
250  }
251 
252 #ifdef GRINS_USE_GRVY_TIMERS
253  this->_timer->EndTimer("HeatTransfer::side_time_derivative");
254 #endif
255 
256  return;
257  }
GRINS::BCHandlingBase * _bc_handler
Definition: physics.h:256
virtual void apply_neumann_bcs(AssemblyContext &context, const GRINS::CachedValues &cache, const bool request_jacobian, const GRINS::BoundaryID bc_id) const

Member Data Documentation

GRINS::BCHandlingBase* GRINS::Physics::_bc_handler
protectedinherited
template<class Conductivity >
libMesh::Number GRINS::HeatTransferBase< Conductivity >::_Cp
protectedinherited
template<class Conductivity >
unsigned int GRINS::HeatTransferBase< Conductivity >::_dim
protectedinherited

Physical dimension of problem.

Todo:
Make this static member of base class?

Definition at line 73 of file heat_transfer_base.h.

std::set<libMesh::subdomain_id_type> GRINS::Physics::_enabled_subdomains
protectedinherited

Subdomains on which the current Physics class is enabled.

Definition at line 261 of file physics.h.

Referenced by GRINS::Physics::enabled_on_elem(), and GRINS::Physics::read_input_options().

template<class Conductivity >
PrimitiveFlowFEVariables GRINS::HeatTransferBase< Conductivity >::_flow_vars
protectedinherited

Definition at line 75 of file heat_transfer_base.h.

GRINS::ICHandlingBase* GRINS::Physics::_ic_handler
protectedinherited
bool GRINS::Physics::_is_axisymmetric
protectedinherited
bool GRINS::Physics::_is_steady = false
staticprotectedinherited

Caches whether or not the solver that's being used is steady or not.

This is need, for example, in flow stabilization as the tau terms change depending on whether the solver is steady or unsteady.

Definition at line 266 of file physics.h.

Referenced by GRINS::Physics::is_steady(), and GRINS::Physics::set_is_steady().

template<class Conductivity >
Conductivity GRINS::HeatTransferBase< Conductivity >::_k
protectedinherited

Conductivity.

Definition at line 87 of file heat_transfer_base.h.

template<class Conductivity >
unsigned int GRINS::HeatTransfer< Conductivity >::_k_index
private

Index from registering this postprocessed quantity.

Definition at line 83 of file heat_transfer.h.

const PhysicsName GRINS::Physics::_physics_name
protectedinherited

Name of the physics object. Used for reading physics specific inputs.

We use a reference because the physics names are const global objects in GRINS namespace

No, we use a copy, because otherwise as soon as the memory in std::set<std::string> requested_physics gets overwritten we get in trouble.

Definition at line 254 of file physics.h.

Referenced by GRINS::SourceTermBase::parse_var_info(), and GRINS::Physics::read_input_options().

template<class Conductivity >
libMesh::Number GRINS::HeatTransferBase< Conductivity >::_rho
protectedinherited

Material parameters, read from input.

Todo:
Need to generalize material parameters. Right now they are assumed constant
Todo:
Shouldn't this rho be the same as the one in the flow? Need to figure out how to have those shared

Definition at line 84 of file heat_transfer_base.h.

Referenced by GRINS::HeatTransferBase< Conductivity >::HeatTransferBase().

template<class Conductivity >
PrimitiveTempFEVariables GRINS::HeatTransferBase< Conductivity >::_temp_vars
protectedinherited

Definition at line 77 of file heat_transfer_base.h.


The documentation for this class was generated from the following files:

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