GRINS-0.8.0
List of all members | Public Member Functions | Protected Attributes
GRINS::HeatTransferStabilizationHelper Class Reference

#include <heat_transfer_stab_helper.h>

Inheritance diagram for GRINS::HeatTransferStabilizationHelper:
Inheritance graph
[legend]
Collaboration diagram for GRINS::HeatTransferStabilizationHelper:
Collaboration graph
[legend]

Public Member Functions

 HeatTransferStabilizationHelper (const std::string &helper_name, const GetPot &input)
 
 ~HeatTransferStabilizationHelper ()
 
libMesh::Real compute_res_energy_steady (AssemblyContext &context, unsigned int qp, const libMesh::Real rho, const libMesh::Real Cp, const libMesh::Real k) const
 
void compute_res_energy_steady_and_derivs (AssemblyContext &context, unsigned int qp, const libMesh::Real rho, const libMesh::Real Cp, const libMesh::Real k, libMesh::Real &res, libMesh::Real &d_res_dT, libMesh::Gradient &d_res_dgradT, libMesh::Tensor &d_res_dhessT, libMesh::Gradient &d_res_dU) const
 
libMesh::Real compute_res_energy_transient (AssemblyContext &context, unsigned int qp, const libMesh::Real rho, const libMesh::Real Cp) const
 
void compute_res_energy_transient_and_derivs (AssemblyContext &context, unsigned int qp, const libMesh::Real rho, const libMesh::Real Cp, libMesh::Real &res, libMesh::Real &d_res_dTdot) const
 
libMesh::Real compute_tau_energy (AssemblyContext &c, libMesh::RealTensor &G, libMesh::Real rho, libMesh::Real cp, libMesh::Real k, libMesh::Gradient U, bool is_steady) const
 
void compute_tau_energy_and_derivs (AssemblyContext &c, libMesh::RealTensor &G, libMesh::Real rho, libMesh::Real cp, libMesh::Real k, libMesh::Gradient U, libMesh::Real &tau_E, libMesh::Real &d_tau_E_d_rho, libMesh::Gradient &d_tau_E_d_U, bool is_steady) const
 
- Public Member Functions inherited from GRINS::StabilizationHelper
 StabilizationHelper (const std::string &helper_name)
 
 ~StabilizationHelper ()
 
libMesh::RealGradient compute_g (libMesh::FEBase *fe, AssemblyContext &c, unsigned int qp) const
 
libMesh::RealTensor compute_G (libMesh::FEBase *fe, AssemblyContext &c, unsigned int qp) const
 
- Public Member Functions inherited from GRINS::ParameterUser
 ParameterUser (const std::string &user_name)
 
virtual ~ParameterUser ()
 
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...
 
virtual void set_parameter (libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &func, const GetPot &input, const std::string &func_param_name, const std::string &param_default)
 Each subclass can simultaneously read a parsed function from. More...
 
virtual void set_parameter (libMesh::ParsedFEMFunction< libMesh::Number > &func, const GetPot &input, const std::string &func_param_name, const std::string &param_default)
 Each subclass can simultaneously read a parsed function from. More...
 
virtual void move_parameter (const libMesh::Number &old_parameter, libMesh::Number &new_parameter)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void move_parameter (const libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &old_func, libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &new_func)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void move_parameter (const libMesh::ParsedFEMFunction< libMesh::Number > &old_func, libMesh::ParsedFEMFunction< libMesh::Number > &new_func)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void register_parameter (const std::string &param_name, libMesh::ParameterMultiAccessor< libMesh::Number > &param_pointer) const
 Each subclass will register its copy of an independent. More...
 

Protected Attributes

libMesh::Real _C
 
libMesh::Real _tau_factor
 
const PrimitiveTempFEVariables_temp_vars
 
const VelocityVariable_flow_vars
 
const PressureFEVariable_press_var
 

Additional Inherited Members

- Static Public Attributes inherited from GRINS::ParameterUser
static std::string zero_vector_function = std::string("{0}")
 A parseable function string with LIBMESH_DIM components, all 0. More...
 

Detailed Description

Definition at line 42 of file heat_transfer_stab_helper.h.

Constructor & Destructor Documentation

GRINS::HeatTransferStabilizationHelper::HeatTransferStabilizationHelper ( const std::string &  helper_name,
const GetPot &  input 
)

Definition at line 45 of file heat_transfer_stab_helper.C.

47  : StabilizationHelper(helper_name),
48  _C(1),
49  _tau_factor(0.5),
50  _temp_vars(GRINSPrivate::VariableWarehouse::get_variable_subclass<PrimitiveTempFEVariables>(VariablesParsing::temp_variable_name(input,PhysicsNaming::heat_transfer(),VariablesParsing::PHYSICS))),
51  _flow_vars(GRINSPrivate::VariableWarehouse::get_variable_subclass<VelocityVariable>(VariablesParsing::velocity_variable_name(input,PhysicsNaming::heat_transfer(),VariablesParsing::PHYSICS))),
52  _press_var(GRINSPrivate::VariableWarehouse::get_variable_subclass<PressureFEVariable>(VariablesParsing::press_variable_name(input,PhysicsNaming::heat_transfer(),VariablesParsing::PHYSICS)))
53  {
54  if (input.have_variable("Stabilization/tau_constant_T"))
55  this->set_parameter
56  (_C, input, "Stabilization/tau_constant_T", _C );
57  else
58  this->set_parameter
59  (_C, input, "Stabilization/tau_constant", _C );
60 
61  if (input.have_variable("Stabilization/tau_factor_T"))
62  this->set_parameter
63  (_tau_factor, input, "Stabilization/tau_factor_T", _tau_factor );
64  else
65  this->set_parameter
66  (_tau_factor, input, "Stabilization/tau_factor", _tau_factor );
67  }
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.
static PhysicsName heat_transfer()
static std::string velocity_variable_name(const GetPot &input, const std::string &subsection_name, const SECTION_TYPE section_type)
const PrimitiveTempFEVariables & _temp_vars
static std::string press_variable_name(const GetPot &input, const std::string &subsection_name, const SECTION_TYPE section_type)
static std::string temp_variable_name(const GetPot &input, const std::string &subsection_name, const SECTION_TYPE section_type)
StabilizationHelper(const std::string &helper_name)
Definition: stab_helper.C:36
GRINS::HeatTransferStabilizationHelper::~HeatTransferStabilizationHelper ( )

Definition at line 69 of file heat_transfer_stab_helper.C.

70  {
71  return;
72  }

Member Function Documentation

libMesh::Real GRINS::HeatTransferStabilizationHelper::compute_res_energy_steady ( AssemblyContext context,
unsigned int  qp,
const libMesh::Real  rho,
const libMesh::Real  Cp,
const libMesh::Real  k 
) const

Definition at line 74 of file heat_transfer_stab_helper.C.

References _flow_vars, _temp_vars, GRINS::MultcomponentVectorVariable::dim(), GRINS::PrimitiveTempFEVariables::T(), and GRINS::MultcomponentVectorVariable::w().

79  {
80  libMesh::Gradient grad_T = context.fixed_interior_gradient(this->_temp_vars.T(), qp);
81  libMesh::Tensor hess_T = context.fixed_interior_hessian(this->_temp_vars.T(), qp);
82 
83  libMesh::RealGradient rhocpU( rho*Cp*context.fixed_interior_value(this->_flow_vars.u(), qp),
84  rho*Cp*context.fixed_interior_value(this->_flow_vars.v(), qp) );
85  if(this->_flow_vars.dim() == 3)
86  rhocpU(2) = rho*Cp*context.fixed_interior_value(this->_flow_vars.w(), qp);
87 
88  return rhocpU*grad_T - k*(hess_T(0,0) + hess_T(1,1) + hess_T(2,2));
89  }
VariableIndex T() const
const PrimitiveTempFEVariables & _temp_vars
unsigned int dim() const
Number of components.
void GRINS::HeatTransferStabilizationHelper::compute_res_energy_steady_and_derivs ( AssemblyContext context,
unsigned int  qp,
const libMesh::Real  rho,
const libMesh::Real  Cp,
const libMesh::Real  k,
libMesh::Real &  res,
libMesh::Real &  d_res_dT,
libMesh::Gradient &  d_res_dgradT,
libMesh::Tensor &  d_res_dhessT,
libMesh::Gradient &  d_res_dU 
) const

Definition at line 92 of file heat_transfer_stab_helper.C.

103  {
104  libMesh::Gradient grad_T = context.fixed_interior_gradient(this->_temp_vars.T(), qp);
105  libMesh::Tensor hess_T = context.fixed_interior_hessian(this->_temp_vars.T(), qp);
106 
107  libMesh::RealGradient rhocpU( rho*Cp*context.fixed_interior_value(this->_flow_vars.u(), qp),
108  rho*Cp*context.fixed_interior_value(this->_flow_vars.v(), qp) );
109  if(this->_flow_vars.dim() == 3)
110  rhocpU(2) = rho*Cp*context.fixed_interior_value(this->_flow_vars.w(), qp);
111 
112  res = rhocpU*grad_T - k*(hess_T(0,0) + hess_T(1,1) + hess_T(2,2));
113  d_res_dT = 0;
114  d_res_dgradT = rhocpU;
115  d_res_dhessT = 0;
116  d_res_dhessT(0,0) = -k;
117  d_res_dhessT(1,1) = -k;
118  d_res_dhessT(2,2) = -k;
119  d_res_dU = rho * Cp * grad_T;
120  }
VariableIndex T() const
const PrimitiveTempFEVariables & _temp_vars
unsigned int dim() const
Number of components.
libMesh::Real GRINS::HeatTransferStabilizationHelper::compute_res_energy_transient ( AssemblyContext context,
unsigned int  qp,
const libMesh::Real  rho,
const libMesh::Real  Cp 
) const

Definition at line 123 of file heat_transfer_stab_helper.C.

References _temp_vars, and GRINS::PrimitiveTempFEVariables::T().

127  {
128  libMesh::Real T_dot;
129  context.interior_rate(this->_temp_vars.T(), qp, T_dot);
130 
131  return rho*Cp*T_dot;
132  }
VariableIndex T() const
const PrimitiveTempFEVariables & _temp_vars
void GRINS::HeatTransferStabilizationHelper::compute_res_energy_transient_and_derivs ( AssemblyContext context,
unsigned int  qp,
const libMesh::Real  rho,
const libMesh::Real  Cp,
libMesh::Real &  res,
libMesh::Real &  d_res_dTdot 
) const

Definition at line 136 of file heat_transfer_stab_helper.C.

143  {
144  libMesh::Real T_dot;
145  context.interior_rate(this->_temp_vars.T(), qp, T_dot);
146 
147  res = rho*Cp*T_dot;
148  d_res_dTdot = rho*Cp;
149  }
VariableIndex T() const
const PrimitiveTempFEVariables & _temp_vars
libMesh::Real GRINS::HeatTransferStabilizationHelper::compute_tau_energy ( AssemblyContext c,
libMesh::RealTensor &  G,
libMesh::Real  rho,
libMesh::Real  cp,
libMesh::Real  k,
libMesh::Gradient  U,
bool  is_steady 
) const
inline

Definition at line 117 of file heat_transfer_stab_helper.h.

References _C, and _tau_factor.

124  {
125  libMesh::Real tau = (rho*cp*U)*(G*(rho*cp*U)) + this->_C*k*k*G.contract(G);
126 
127  if(!is_steady)
128  tau += (2.0*rho*cp/c.get_deltat_value())*(2.0*rho*cp/c.get_deltat_value());
129 
130  return this->_tau_factor/std::sqrt(tau);
131  }
void GRINS::HeatTransferStabilizationHelper::compute_tau_energy_and_derivs ( AssemblyContext c,
libMesh::RealTensor &  G,
libMesh::Real  rho,
libMesh::Real  cp,
libMesh::Real  k,
libMesh::Gradient  U,
libMesh::Real &  tau_E,
libMesh::Real &  d_tau_E_d_rho,
libMesh::Gradient &  d_tau_E_d_U,
bool  is_steady 
) const
inline

Definition at line 136 of file heat_transfer_stab_helper.h.

146  {
147  libMesh::Gradient rhocpU = rho*cp*U;
148  libMesh::Gradient GrhocpU = G*rhocpU;
149  libMesh::Real rhocpUGrhocpU = rhocpU * GrhocpU;
150  libMesh::Real GG = G.contract(G);
151  tau_E = (rhocpU)*(GrhocpU) + this->_C*k*k*GG;
152  d_tau_E_d_rho = rhocpUGrhocpU*2/rho/cp;
153  d_tau_E_d_U = 2*rho*cp*GrhocpU;
154 
155  if(!is_steady)
156  {
157  libMesh::Real two_rhocp_over_dt = 2*rho*cp/c.get_deltat_value();
158  tau_E += two_rhocp_over_dt * two_rhocp_over_dt;
159  d_tau_E_d_rho += 4*two_rhocp_over_dt/c.get_deltat_value();
160  }
161 
162  // But what we've computed so far isn't tau; we need
163  // tau = _tau_factor/ sqrt(our_tau)
164 
165  libMesh::Real root_oldtau = std::sqrt(tau_E);
166  libMesh::Real d_tau_d_oldtau = -this->_tau_factor / (tau_E*root_oldtau) / 2;
167 
168  d_tau_E_d_rho = d_tau_d_oldtau * d_tau_E_d_rho;
169  d_tau_E_d_U = d_tau_d_oldtau * d_tau_E_d_U;
170 
171  tau_E = this->_tau_factor / root_oldtau;
172  }

Member Data Documentation

libMesh::Real GRINS::HeatTransferStabilizationHelper::_C
protected

Definition at line 106 of file heat_transfer_stab_helper.h.

Referenced by compute_tau_energy().

const VelocityVariable& GRINS::HeatTransferStabilizationHelper::_flow_vars
protected

Definition at line 110 of file heat_transfer_stab_helper.h.

Referenced by compute_res_energy_steady().

const PressureFEVariable& GRINS::HeatTransferStabilizationHelper::_press_var
protected

Definition at line 111 of file heat_transfer_stab_helper.h.

libMesh::Real GRINS::HeatTransferStabilizationHelper::_tau_factor
protected

Definition at line 106 of file heat_transfer_stab_helper.h.

Referenced by compute_tau_energy().

const PrimitiveTempFEVariables& GRINS::HeatTransferStabilizationHelper::_temp_vars
protected

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

Generated on Tue Dec 19 2017 12:47:30 for GRINS-0.8.0 by  doxygen 1.8.9.1