26 #include "grins_config.h" 
   35 #include "libmesh/getpot.h" 
   36 #include "libmesh/fem_system.h" 
   37 #include "libmesh/quadrature.h" 
   44       _flow_stab_helper(physics_name+
"FlowStabHelper", input),
 
   45       _temp_stab_helper(physics_name+
"TempStabHelper", input),
 
   67 #ifdef GRINS_USE_GRVY_TIMERS 
   68     this->_timer->BeginTimer(
"BoussinesqBuoyancySPGSMStabilization::element_time_derivative");
 
   72     const unsigned int n_u_dofs = context.get_dof_indices(_flow_vars.u()).size();
 
   75     const std::vector<libMesh::Real> &JxW =
 
   76       context.get_element_fe(_flow_vars.u())->get_JxW();
 
   83     const std::vector<std::vector<libMesh::RealGradient> >& u_gradphi =
 
   84       context.get_element_fe(this->_flow_vars.u())->get_dphi();
 
   87     libMesh::DenseSubVector<libMesh::Number> &Fu = context.get_elem_residual(_flow_vars.u()); 
 
   88     libMesh::DenseSubVector<libMesh::Number> &Fv = context.get_elem_residual(_flow_vars.v()); 
 
   89     libMesh::DenseSubVector<libMesh::Number> *Fw = NULL;
 
   92         Fw = &context.get_elem_residual(this->_flow_vars.w()); 
 
  101     unsigned int n_qpoints = context.get_element_qrule().n_points();
 
  103     libMesh::FEBase* fe = context.get_element_fe(this->_flow_vars.u());
 
  105     for (
unsigned int qp=0; qp != n_qpoints; qp++)
 
  107         libMesh::RealGradient g = this->_flow_stab_helper.compute_g( fe, context, qp );
 
  108         libMesh::RealTensor G = this->_flow_stab_helper.compute_G( fe, context, qp );
 
  110         libMesh::RealGradient U( context.interior_value( this->_flow_vars.u(), qp ),
 
  111                                  context.interior_value( this->_flow_vars.v(), qp ) );
 
  112         if( this->_dim == 3 )
 
  114             U(2) = context.interior_value( this->_flow_vars.w(), qp );
 
  118         libMesh::Real mu_qp = this->_mu(context, qp);
 
  120         libMesh::Real tau_M = this->_flow_stab_helper.compute_tau_momentum( context, qp, g, G, this->_rho, U, mu_qp, this->_is_steady );
 
  128         T = context.interior_value(_temp_vars.T(), qp);
 
  130         libMesh::RealGradient residual = _rho*_beta_T*(T-_T_ref)*_g;
 
  132         for (
unsigned int i=0; i != n_u_dofs; i++)
 
  134             Fu(i) += ( -tau_M*residual(0)*_rho*U*u_gradphi[i][qp] )*JxW[qp];
 
  137             Fv(i) += ( -tau_M*residual(1)*_rho*U*u_gradphi[i][qp] )*JxW[qp];
 
  142                 (*Fw)(i) += ( -tau_M*residual(2)*_rho*U*u_gradphi[i][qp] )*JxW[qp];
 
  146             if (compute_jacobian)
 
  148                 libmesh_not_implemented();
 
  154 #ifdef GRINS_USE_GRVY_TIMERS 
  155     this->_timer->EndTimer(
"BoussinesqBuoyancySPGSMStabilization::element_time_derivative");
 
  166 #ifdef GRINS_USE_GRVY_TIMERS 
  167     this->_timer->BeginTimer(
"BoussinesqBuoyancySPGSMStabilization::element_constraint");
 
  171     const unsigned int n_p_dofs = context.get_dof_indices(_press_var.p()).size();
 
  174     const std::vector<libMesh::Real> &JxW =
 
  175       context.get_element_fe(_flow_vars.u())->get_JxW();
 
  177     const std::vector<std::vector<libMesh::RealGradient> >& p_dphi =
 
  178       context.get_element_fe(this->_press_var.p())->get_dphi();
 
  180     libMesh::DenseSubVector<libMesh::Number> &Fp = context.get_elem_residual(this->_press_var.p()); 
 
  188     unsigned int n_qpoints = context.get_element_qrule().n_points();
 
  190     libMesh::FEBase* fe = context.get_element_fe(this->_flow_vars.u());
 
  192     for (
unsigned int qp=0; qp != n_qpoints; qp++)
 
  194         libMesh::RealGradient g = this->_flow_stab_helper.compute_g( fe, context, qp );
 
  195         libMesh::RealTensor G = this->_flow_stab_helper.compute_G( fe, context, qp );
 
  197         libMesh::RealGradient U( context.interior_value( this->_flow_vars.u(), qp ),
 
  198                                  context.interior_value( this->_flow_vars.v(), qp ) );
 
  199         if( this->_dim == 3 )
 
  201             U(2) = context.interior_value( this->_flow_vars.w(), qp );
 
  205         libMesh::Real mu_qp = this->_mu(context, qp);
 
  207         libMesh::Real tau_M = this->_flow_stab_helper.compute_tau_momentum( context, qp, g, G, this->_rho, U, mu_qp, this->_is_steady );
 
  211         T = context.interior_value(_temp_vars.T(), qp);
 
  213         libMesh::RealGradient residual = _rho*_beta_T*(T-_T_ref)*_g;
 
  218         for (
unsigned int i=0; i != n_p_dofs; i++)
 
  220             Fp(i) += -tau_M*residual*p_dphi[i][qp]*JxW[qp];
 
  222             if (compute_jacobian)
 
  224                 libmesh_not_implemented();
 
  231 #ifdef GRINS_USE_GRVY_TIMERS 
  232     this->_timer->EndTimer(
"BoussinesqBuoyancySPGSMStabilization::element_constraint");
 
  323     ( 
const std::string & param_name,
 
  328     _mu.register_parameter(param_name, param_pointer);
 
virtual void set_parameter(libMesh::Number ¶m_variable, const GetPot &input, const std::string ¶m_name, libMesh::Number param_default)
Each subclass can simultaneously read a parameter value from. 
 
static PhysicsName heat_transfer()
 
~BoussinesqBuoyancySPGSMStabilization()
 
INSTANTIATE_INC_NS_SUBCLASS(BoussinesqBuoyancySPGSMStabilization)
 
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...
 
static void read_specific_heat(const std::string &core_physics_name, const GetPot &input, ParameterUser ¶ms, libMesh::Real &cp)
Helper function to reading scalar specific heat from input. 
 
Helper functions for parsing material properties. 
 
static PhysicsName boussinesq_buoyancy()
 
virtual void element_constraint(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Constraint part(s) of physics for element interiors. 
 
virtual void element_time_derivative(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Time dependent part(s) of physics for element interiors. 
 
BoussinesqBuoyancySPGSMStabilization()
 
virtual void register_parameter(const std::string ¶m_name, libMesh::ParameterMultiAccessor< libMesh::Number > ¶m_pointer) const 
Each subclass will register its copy of an independent. 
 
virtual void register_parameter(const std::string ¶m_name, libMesh::ParameterMultiAccessor< libMesh::Number > ¶m_pointer) const 
Each subclass will register its copy of an independent.