本文整理汇总了C++中AssemblyContext::interior_hessian方法的典型用法代码示例。如果您正苦于以下问题:C++ AssemblyContext::interior_hessian方法的具体用法?C++ AssemblyContext::interior_hessian怎么用?C++ AssemblyContext::interior_hessian使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssemblyContext
的用法示例。
在下文中一共展示了AssemblyContext::interior_hessian方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: U
void ReactingLowMachNavierStokesStabilizationBase<Mixture,Evaluator>::compute_res_steady( AssemblyContext& context,
unsigned int qp,
libMesh::Real& RP_s,
libMesh::RealGradient& RM_s,
libMesh::Real& RE_s,
std::vector<libMesh::Real>& Rs_s )
{
Rs_s.resize(this->n_species(),0.0);
// Grab r-coordinate for axisymmetric terms
// We're assuming all variables are using the same quadrature rule
libMesh::Real r = (context.get_element_fe(this->_flow_vars.u())->get_xyz())[qp](0);
libMesh::RealGradient grad_p = context.interior_gradient(this->_press_var.p(), qp);
libMesh::RealGradient grad_u = context.interior_gradient(this->_flow_vars.u(), qp);
libMesh::RealGradient grad_v = context.interior_gradient(this->_flow_vars.v(), qp);
libMesh::RealGradient U( context.interior_value(this->_flow_vars.u(), qp),
context.interior_value(this->_flow_vars.v(), qp) );
libMesh::Real divU = grad_u(0) + grad_v(1);
if( this->_is_axisymmetric )
divU += U(0)/r;
if(this->mesh_dim(context) == 3)
{
U(2) = context.interior_value(this->_flow_vars.w(), qp);
divU += (context.interior_gradient(this->_flow_vars.w(), qp))(2);
}
// We don't add axisymmetric terms here since we don't directly use hess_{u,v}
// axisymmetric terms are built into divGradU, etc. functions below
libMesh::RealTensor hess_u = context.interior_hessian(this->_flow_vars.u(), qp);
libMesh::RealTensor hess_v = context.interior_hessian(this->_flow_vars.v(), qp);
libMesh::Real T = context.interior_value(this->_temp_vars.T(), qp);
libMesh::Gradient grad_T = context.interior_gradient(this->_temp_vars.T(), qp);
libMesh::Tensor hess_T = context.interior_hessian(this->_temp_vars.T(), qp);
libMesh::Real hess_T_term = hess_T(0,0) + hess_T(1,1);
#if LIBMESH_DIM > 2
hess_T_term += hess_T(2,2);
#endif
// Add axisymmetric terms, if needed
if( this->_is_axisymmetric )
hess_T_term += grad_T(0)/r;
std::vector<libMesh::Real> ws(this->n_species());
std::vector<libMesh::RealGradient> grad_ws(this->n_species());
std::vector<libMesh::RealTensor> hess_ws(this->n_species());
for(unsigned int s=0; s < this->_n_species; s++ )
{
ws[s] = context.interior_value(this->_species_vars.species(s), qp);
grad_ws[s] = context.interior_gradient(this->_species_vars.species(s), qp);
hess_ws[s] = context.interior_hessian(this->_species_vars.species(s), qp);
}
Evaluator gas_evaluator( this->_gas_mixture );
const libMesh::Real R_mix = gas_evaluator.R_mix(ws);
const libMesh::Real p0 = this->get_p0_steady(context,qp);
libMesh::Real rho = this->rho(T, p0, R_mix );
libMesh::Real cp = gas_evaluator.cp(T,p0,ws);
libMesh::Real M = gas_evaluator.M_mix( ws );
std::vector<libMesh::Real> D( this->n_species() );
libMesh::Real mu, k;
gas_evaluator.mu_and_k_and_D( T, rho, cp, ws, mu, k, D );
// grad_rho = drho_dT*gradT + \sum_s drho_dws*grad_ws
const libMesh::Real drho_dT = -p0/(R_mix*T*T);
libMesh::RealGradient grad_rho = drho_dT*grad_T;
for(unsigned int s=0; s < this->_n_species; s++ )
{
libMesh::Real Ms = gas_evaluator.M(s);
libMesh::Real R_uni = Constants::R_universal/1000.0; /* J/kmol-K --> J/mol-K */
// drho_dws = -p0/(T*R_mix*R_mix)*dR_dws
// dR_dws = R_uni*d_dws(1/M)
// d_dws(1/M) = d_dws(\sum_s w_s/Ms) = 1/Ms
const libMesh::Real drho_dws = -p0/(R_mix*R_mix*T)*R_uni/Ms;
grad_rho += drho_dws*grad_ws[s];
}
libMesh::RealGradient rhoUdotGradU;
libMesh::RealGradient divGradU;
libMesh::RealGradient divGradUT;
libMesh::RealGradient divdivU;
if( this->mesh_dim(context) < 3 )
{
rhoUdotGradU = rho*_stab_helper.UdotGradU( U, grad_u, grad_v );
// Call axisymmetric versions if we are doing an axisymmetric run
if( this->_is_axisymmetric )
{
divGradU = _stab_helper.div_GradU_axi( r, U, grad_u, grad_v, hess_u, hess_v );
//.........这里部分代码省略.........