GRINS-0.6.0
Public Member Functions | Protected Attributes | List of all members
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 ()
 
void init (libMesh::FEMSystem &system)
 
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
 
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
 
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 register_parameter (const std::string &param_name, libMesh::ParameterMultiPointer< libMesh::Number > &param_pointer) const
 Each subclass will register its copy of an independent. More...
 

Protected Attributes

libMesh::Real _C
 
libMesh::Real _tau_factor
 
PrimitiveTempVariables _temp_vars
 
PrimitiveFlowVariables _flow_vars
 

Detailed Description

Definition at line 39 of file heat_transfer_stab_helper.h.

Constructor & Destructor Documentation

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

Definition at line 38 of file heat_transfer_stab_helper.C.

40  : StabilizationHelper(helper_name),
41  _C(1),
42  _tau_factor(0.5),
43  _temp_vars(input),
44  _flow_vars(input)
45  {
46  if (input.have_variable("Stabilization/tau_constant_T"))
47  this->set_parameter
48  (_C, input, "Stabilization/tau_constant_T", _C );
49  else
50  this->set_parameter
51  (_C, input, "Stabilization/tau_constant", _C );
52 
53  if (input.have_variable("Stabilization/tau_factor_T"))
54  this->set_parameter
55  (_tau_factor, input, "Stabilization/tau_factor_T", _tau_factor );
56  else
57  this->set_parameter
58  (_tau_factor, input, "Stabilization/tau_factor", _tau_factor );
59  }
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.
StabilizationHelper(const std::string &helper_name)
Definition: stab_helper.C:36
GRINS::HeatTransferStabilizationHelper::~HeatTransferStabilizationHelper ( )

Definition at line 61 of file heat_transfer_stab_helper.C.

62  {
63  return;
64  }

Member Function Documentation

libMesh::RealGradient GRINS::StabilizationHelper::compute_g ( libMesh::FEBase *  fe,
AssemblyContext c,
unsigned int  qp 
) const
inherited
Todo:
Should we inline this?

Definition at line 47 of file stab_helper.C.

50  {
51  libMesh::RealGradient g( fe->get_dxidx()[qp] + fe->get_detadx()[qp],
52  fe->get_dxidy()[qp] + fe->get_detady()[qp] );
53 
54  if( c.get_dim() == 3 )
55  {
56  g(0) += fe->get_dzetadx()[qp];
57  g(1) += fe->get_dzetady()[qp];
58  g(2) = fe->get_dxidz()[qp] + fe->get_detadz()[qp] + fe->get_dzetadz()[qp];
59  }
60 
61  return g;
62  }
libMesh::RealTensor GRINS::StabilizationHelper::compute_G ( libMesh::FEBase *  fe,
AssemblyContext c,
unsigned int  qp 
) const
inherited
Todo:
Should we inline this?

Definition at line 64 of file stab_helper.C.

67  {
68  libMesh::Real dxidx = fe->get_dxidx()[qp];
69  libMesh::Real dxidy = fe->get_dxidy()[qp];
70 
71  libMesh::Real detadx = fe->get_detadx()[qp];
72  libMesh::Real detady = fe->get_detady()[qp];
73 
74  libMesh::RealTensor G( dxidx*dxidx + detadx*detadx,
75  dxidx*dxidy + detadx*detady,
76  0.0,
77  dxidy*dxidx + detady*detadx,
78  dxidy*dxidy + detady*detady,
79  0.0 );
80 
81  if( c.get_dim() == 3 )
82  {
83  libMesh::Real dxidz = fe->get_dxidz()[qp];
84 
85  libMesh::Real detadz = fe->get_detadz()[qp];
86 
87  libMesh::Real dzetadx = fe->get_dzetadx()[qp];
88  libMesh::Real dzetady = fe->get_dzetady()[qp];
89  libMesh::Real dzetadz = fe->get_dzetadz()[qp];
90 
91  G(0,0) += dzetadx*dzetadx;
92  G(0,1) += dzetadx*dzetady;
93  G(0,2) = dxidx*dxidz + detadx*detadz + dzetadx*dzetadz;
94  G(1,0) += dzetady*dzetadx;
95  G(1,1) += dzetady*dzetady;
96  G(1,2) = dxidy*dxidz + detady*detadz + dzetady*dzetadz;
97  G(2,0) = dxidz*dxidx + detadz*detadx + dzetadz*dzetadx;
98  G(2,1) = dxidz*dxidy + detadz*detady + dzetadz*dzetady;
99  G(2,2) = dxidz*dxidz + detadz*detadz + dzetadz*dzetadz;
100  }
101 
102  return G;
103  }
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::PrimitiveTempVariables::T_var(), and GRINS::PrimitiveFlowVariables::w_var().

79  {
80  libMesh::Gradient grad_T = context.fixed_interior_gradient(this->_temp_vars.T_var(), qp);
81  libMesh::Tensor hess_T = context.fixed_interior_hessian(this->_temp_vars.T_var(), qp);
82 
83  libMesh::RealGradient rhocpU( rho*Cp*context.fixed_interior_value(this->_flow_vars.u_var(), qp),
84  rho*Cp*context.fixed_interior_value(this->_flow_vars.v_var(), qp) );
85  if(context.get_system().get_mesh().mesh_dimension() == 3)
86  rhocpU(2) = rho*Cp*context.fixed_interior_value(this->_flow_vars.w_var(), qp);
87 
88  return rhocpU*grad_T - k*(hess_T(0,0) + hess_T(1,1) + hess_T(2,2));
89  }
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_var(), qp);
105  libMesh::Tensor hess_T = context.fixed_interior_hessian(this->_temp_vars.T_var(), qp);
106 
107  libMesh::RealGradient rhocpU( rho*Cp*context.fixed_interior_value(this->_flow_vars.u_var(), qp),
108  rho*Cp*context.fixed_interior_value(this->_flow_vars.v_var(), qp) );
109  if(context.get_system().get_mesh().mesh_dimension() == 3)
110  rhocpU(2) = rho*Cp*context.fixed_interior_value(this->_flow_vars.w_var(), 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  }
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::PrimitiveTempVariables::T_var().

127  {
128  libMesh::Real T_dot;
129  context.interior_rate(this->_temp_vars.T_var(), qp, T_dot);
130 
131  return rho*Cp*T_dot;
132  }
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_var(), qp, T_dot);
146 
147  res = rho*Cp*T_dot;
148  d_res_dTdot = rho*Cp;
149  }
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 115 of file heat_transfer_stab_helper.h.

References _C, and _tau_factor.

122  {
123  libMesh::Real tau = (rho*cp*U)*(G*(rho*cp*U)) + this->_C*k*k*G.contract(G);
124 
125  if(!is_steady)
126  tau += (2.0*rho*cp/c.get_deltat_value())*(2.0*rho*cp/c.get_deltat_value());
127 
128  return this->_tau_factor/std::sqrt(tau);
129  }
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 134 of file heat_transfer_stab_helper.h.

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

Definition at line 66 of file heat_transfer_stab_helper.C.

References _flow_vars, _temp_vars, GRINS::PrimitiveTempVariables::init(), and GRINS::PrimitiveFlowVariables::init().

67  {
68  _temp_vars.init(&system);
69  _flow_vars.init(&system);
70 
71  return;
72  }
virtual void init(libMesh::FEMSystem *system)
virtual void init(libMesh::FEMSystem *system)
void GRINS::ParameterUser::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 in GRINS::AxisymmetricHeatTransfer< Conductivity >, GRINS::LowMachNavierStokesBase< Viscosity, SpecificHeat, ThermalConductivity >, GRINS::IncompressibleNavierStokesBase< Viscosity >, GRINS::BoussinesqBuoyancySPGSMStabilization< Viscosity >, GRINS::HeatConduction< Conductivity >, GRINS::HeatTransferBase< Conductivity >, and GRINS::BoussinesqBuoyancyAdjointStabilization< Viscosity >.

Definition at line 50 of file parameter_user.C.

Referenced by GRINS::BoussinesqBuoyancyAdjointStabilization< Viscosity >::register_parameter(), GRINS::HeatTransferBase< Conductivity >::register_parameter(), GRINS::HeatConduction< Conductivity >::register_parameter(), GRINS::BoussinesqBuoyancySPGSMStabilization< Viscosity >::register_parameter(), GRINS::IncompressibleNavierStokesBase< Viscosity >::register_parameter(), GRINS::LowMachNavierStokesBase< Viscosity, SpecificHeat, ThermalConductivity >::register_parameter(), and GRINS::AxisymmetricHeatTransfer< Conductivity >::register_parameter().

53  {
54  std::map<std::string, libMesh::Number*>::const_iterator it =
55  _my_parameters.find(param_name);
56 
57  if (it != _my_parameters.end())
58  {
59  std::cout << _my_name << " uses parameter " << param_name
60  << std::endl;
61  param_pointer.push_back(it->second);
62  }
63  }
std::map< std::string, libMesh::Number * > _my_parameters
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

Member Data Documentation

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

Definition at line 105 of file heat_transfer_stab_helper.h.

Referenced by compute_tau_energy().

PrimitiveFlowVariables GRINS::HeatTransferStabilizationHelper::_flow_vars
protected

Definition at line 109 of file heat_transfer_stab_helper.h.

Referenced by compute_res_energy_steady(), and init().

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

Definition at line 105 of file heat_transfer_stab_helper.h.

Referenced by compute_tau_energy().

PrimitiveTempVariables GRINS::HeatTransferStabilizationHelper::_temp_vars
protected

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

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