本文整理汇总了C++中AssemblyContext::fixed_interior_gradient方法的典型用法代码示例。如果您正苦于以下问题:C++ AssemblyContext::fixed_interior_gradient方法的具体用法?C++ AssemblyContext::fixed_interior_gradient怎么用?C++ AssemblyContext::fixed_interior_gradient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssemblyContext
的用法示例。
在下文中一共展示了AssemblyContext::fixed_interior_gradient方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rhocpU
void 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
{
libMesh::Gradient grad_T = context.fixed_interior_gradient(this->_temp_vars.T(), qp);
libMesh::Tensor hess_T = context.fixed_interior_hessian(this->_temp_vars.T(), qp);
libMesh::RealGradient rhocpU( rho*Cp*context.fixed_interior_value(this->_flow_vars.u(), qp),
rho*Cp*context.fixed_interior_value(this->_flow_vars.v(), qp) );
if(this->_flow_vars.dim() == 3)
rhocpU(2) = rho*Cp*context.fixed_interior_value(this->_flow_vars.w(), qp);
res = rhocpU*grad_T - k*(hess_T(0,0) + hess_T(1,1) + hess_T(2,2));
d_res_dT = 0;
d_res_dgradT = rhocpU;
d_res_dhessT = 0;
d_res_dhessT(0,0) = -k;
d_res_dhessT(1,1) = -k;
d_res_dhessT(2,2) = -k;
d_res_dU = rho * Cp * grad_T;
}
示例2: U
void LowMachNavierStokesSPGSMStabilization<Mu,SH,TC>::assemble_energy_mass_residual( bool /*compute_jacobian*/,
AssemblyContext& context )
{
// The number of local degrees of freedom in each variable.
const unsigned int n_T_dofs = context.get_dof_indices(this->_temp_vars.T()).size();
// Element Jacobian * quadrature weights for interior integration.
const std::vector<libMesh::Real> &JxW =
context.get_element_fe(this->_temp_vars.T())->get_JxW();
// The temperature shape functions gradients at interior quadrature points.
const std::vector<std::vector<libMesh::RealGradient> >& T_gradphi =
context.get_element_fe(this->_temp_vars.T())->get_dphi();
libMesh::DenseSubVector<libMesh::Number> &FT = context.get_elem_residual(this->_temp_vars.T()); // R_{T}
unsigned int n_qpoints = context.get_element_qrule().n_points();
for (unsigned int qp=0; qp != n_qpoints; qp++)
{
libMesh::Number u, v;
u = context.fixed_interior_value(this->_flow_vars.u(), qp);
v = context.fixed_interior_value(this->_flow_vars.v(), qp);
libMesh::Gradient grad_T = context.fixed_interior_gradient(this->_temp_vars.T(), qp);
libMesh::NumberVectorValue U(u,v);
if (this->mesh_dim(context) == 3)
U(2) = context.fixed_interior_value(this->_flow_vars.w(), qp); // w
libMesh::Real T = context.fixed_interior_value( this->_temp_vars.T(), qp );
libMesh::Real rho = this->rho( T, this->get_p0_transient( context, qp ) );
libMesh::Real k = this->_k(T);
libMesh::Real cp = this->_cp(T);
libMesh::Number rho_cp = rho*this->_cp(T);
libMesh::FEBase* fe = context.get_element_fe(this->_flow_vars.u());
libMesh::RealGradient g = this->_stab_helper.compute_g( fe, context, qp );
libMesh::RealTensor G = this->_stab_helper.compute_G( fe, context, qp );
libMesh::Real tau_E = this->_stab_helper.compute_tau_energy( context, qp, g, G, rho, U, k, cp, false );
libMesh::Real RE_t = this->compute_res_energy_transient( context, qp );
for (unsigned int i=0; i != n_T_dofs; i++)
{
FT(i) -= rho_cp*tau_E*RE_t*U*T_gradphi[i][qp]*JxW[qp];
}
}
return;
}
示例3: compute_res_energy_steady
libMesh::Real HeatTransferStabilizationHelper::compute_res_energy_steady( AssemblyContext& context,
unsigned int qp,
const libMesh::Real rho,
const libMesh::Real Cp,
const libMesh::Real k ) const
{
libMesh::Gradient grad_T = context.fixed_interior_gradient(this->_temp_vars.T(), qp);
libMesh::Tensor hess_T = context.fixed_interior_hessian(this->_temp_vars.T(), qp);
libMesh::RealGradient rhocpU( rho*Cp*context.fixed_interior_value(this->_flow_vars.u(), qp),
rho*Cp*context.fixed_interior_value(this->_flow_vars.v(), qp) );
if(this->_flow_vars.dim() == 3)
rhocpU(2) = rho*Cp*context.fixed_interior_value(this->_flow_vars.w(), qp);
return rhocpU*grad_T - k*(hess_T(0,0) + hess_T(1,1) + hess_T(2,2));
}