本文整理汇总了C++中AssemblyContext::get_element_fe方法的典型用法代码示例。如果您正苦于以下问题:C++ AssemblyContext::get_element_fe方法的具体用法?C++ AssemblyContext::get_element_fe怎么用?C++ AssemblyContext::get_element_fe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssemblyContext
的用法示例。
在下文中一共展示了AssemblyContext::get_element_fe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void LowMachNavierStokes<Mu,SH,TC>::assemble_thermo_press_mass_residual( bool /*compute_jacobian*/,
AssemblyContext& context )
{
// The number of local degrees of freedom in each variable.
const unsigned int n_p0_dofs = context.get_dof_indices(this->_p0_var).size();
const unsigned int n_T_dofs = context.get_dof_indices(this->_T_var).size();
const unsigned int n_p_dofs = context.get_dof_indices(this->_p_var).size();
// Element Jacobian * quadrature weights for interior integration
const std::vector<libMesh::Real> &JxW =
context.get_element_fe(this->_T_var)->get_JxW();
// The temperature shape functions at interior quadrature points.
const std::vector<std::vector<libMesh::Real> >& T_phi =
context.get_element_fe(this->_T_var)->get_phi();
// The temperature shape functions at interior quadrature points.
const std::vector<std::vector<libMesh::Real> >& p_phi =
context.get_element_fe(this->_p_var)->get_phi();
// The subvectors and submatrices we need to fill:
libMesh::DenseSubVector<libMesh::Real> &F_p0 = context.get_elem_residual(this->_p0_var);
libMesh::DenseSubVector<libMesh::Real> &F_T = context.get_elem_residual(this->_T_var);
libMesh::DenseSubVector<libMesh::Real> &F_p = context.get_elem_residual(this->_p_var);
unsigned int n_qpoints = context.get_element_qrule().n_points();
for (unsigned int qp = 0; qp != n_qpoints; ++qp)
{
libMesh::Number T;
T = context.fixed_interior_value(this->_T_var, qp);
libMesh::Number cp = this->_cp(T);
libMesh::Number cv = cp + this->_R;
libMesh::Number gamma = cp/cv;
libMesh::Number one_over_gamma = 1.0/(gamma-1.0);
libMesh::Number p0_dot = context.interior_value(this->_p0_var, qp );
libMesh::Number p0 = context.fixed_interior_value(this->_p0_var, qp );
for (unsigned int i=0; i != n_p0_dofs; i++)
{
F_p0(i) += p0_dot*one_over_gamma*JxW[qp];
}
for (unsigned int i=0; i != n_T_dofs; i++)
{
F_T(i) -= p0_dot*T_phi[i][qp]*JxW[qp];
}
for (unsigned int i=0; i != n_p_dofs; i++)
{
F_p(i) -= p0_dot/p0*p_phi[i][qp]*JxW[qp];
}
}
return;
}
示例2: F
void HeatConduction<K>::mass_residual( bool compute_jacobian,
AssemblyContext& context,
CachedValues& /*cache*/ )
{
// First we get some references to cell-specific data that
// will be used to assemble the linear system.
// Element Jacobian * quadrature weights for interior integration
const std::vector<libMesh::Real> &JxW =
context.get_element_fe(_temp_vars.T_var())->get_JxW();
// The shape functions at interior quadrature points.
const std::vector<std::vector<libMesh::Real> >& phi =
context.get_element_fe(_temp_vars.T_var())->get_phi();
// The number of local degrees of freedom in each variable
const unsigned int n_T_dofs = context.get_dof_indices(_temp_vars.T_var()).size();
// The subvectors and submatrices we need to fill:
libMesh::DenseSubVector<libMesh::Real> &F =
context.get_elem_residual(_temp_vars.T_var());
libMesh::DenseSubMatrix<libMesh::Real> &M =
context.get_elem_jacobian(_temp_vars.T_var(), _temp_vars.T_var());
unsigned int n_qpoints = context.get_element_qrule().n_points();
for (unsigned int qp = 0; qp != n_qpoints; ++qp)
{
// For the mass residual, we need to be a little careful.
// The time integrator is handling the time-discretization
// for us so we need to supply M(u_fixed)*u' for the residual.
// u_fixed will be given by the fixed_interior_value function
// while u' will be given by the interior_rate function.
libMesh::Real T_dot;
context.interior_rate(_temp_vars.T_var(), qp, T_dot);
for (unsigned int i = 0; i != n_T_dofs; ++i)
{
F(i) -= JxW[qp]*(_rho*_Cp*T_dot*phi[i][qp] );
if( compute_jacobian )
{
for (unsigned int j=0; j != n_T_dofs; j++)
{
// We're assuming rho, cp are constant w.r.t. T here.
M(i,j) -=
context.get_elem_solution_rate_derivative()
* JxW[qp]*_rho*_Cp*phi[j][qp]*phi[i][qp] ;
}
}// End of check on Jacobian
} // End of element dof loop
} // End of the quadrature point loop
return;
}
示例3:
void BoussinesqBuoyancyAdjointStabilization<Mu>::init_context( AssemblyContext& context )
{
context.get_element_fe(this->_flow_vars.p_var())->get_dphi();
context.get_element_fe(this->_flow_vars.u_var())->get_dphi();
context.get_element_fe(this->_flow_vars.u_var())->get_d2phi();
return;
}
示例4: 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;
}
示例5:
void VelocityPenaltyAdjointStabilization<Mu>::init_context( AssemblyContext& context )
{
context.get_element_fe(this->_press_var.p())->get_dphi();
context.get_element_fe(this->_flow_vars.u())->get_xyz();
context.get_element_fe(this->_flow_vars.u())->get_phi();
context.get_element_fe(this->_flow_vars.u())->get_dphi();
context.get_element_fe(this->_flow_vars.u())->get_d2phi();
return;
}
示例6: U
void LowMachNavierStokes<Mu,SH,TC>::assemble_energy_time_deriv( bool /*compute_jacobian*/,
AssemblyContext& context,
CachedValues& cache )
{
// The number of local degrees of freedom in each variable.
const unsigned int n_T_dofs = context.get_dof_indices(this->_T_var).size();
// Element Jacobian * quadrature weights for interior integration.
const std::vector<libMesh::Real> &JxW =
context.get_element_fe(this->_T_var)->get_JxW();
// The temperature shape functions at interior quadrature points.
const std::vector<std::vector<libMesh::Real> >& T_phi =
context.get_element_fe(this->_T_var)->get_phi();
// The temperature shape functions gradients at interior quadrature points.
const std::vector<std::vector<libMesh::RealGradient> >& T_gradphi =
context.get_element_fe(this->_T_var)->get_dphi();
libMesh::DenseSubVector<libMesh::Number> &FT = context.get_elem_residual(this->_T_var); // 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, T, p0;
u = cache.get_cached_values(Cache::X_VELOCITY)[qp];
v = cache.get_cached_values(Cache::Y_VELOCITY)[qp];
T = cache.get_cached_values(Cache::TEMPERATURE)[qp];
p0 = cache.get_cached_values(Cache::THERMO_PRESSURE)[qp];
libMesh::Gradient grad_T = cache.get_cached_gradient_values(Cache::TEMPERATURE_GRAD)[qp];
libMesh::NumberVectorValue U(u,v);
if (this->_dim == 3)
U(2) = cache.get_cached_values(Cache::Z_VELOCITY)[qp]; // w
libMesh::Number k = this->_k(T);
libMesh::Number cp = this->_cp(T);
libMesh::Number rho = this->rho( T, p0 );
// Now a loop over the pressure degrees of freedom. This
// computes the contributions of the continuity equation.
for (unsigned int i=0; i != n_T_dofs; i++)
{
FT(i) += ( -rho*cp*U*grad_T*T_phi[i][qp] // convection term
- k*grad_T*T_gradphi[i][qp] // diffusion term
)*JxW[qp];
}
}
return;
}
示例7:
void ReactingLowMachNavierStokesStabilizationBase<Mixture,Evaluator>::init_context( AssemblyContext& context )
{
// First call base class
ReactingLowMachNavierStokesAbstract::init_context(context);
// We need pressure derivatives
context.get_element_fe(this->_press_var.p())->get_dphi();
// We also need second derivatives, so initialize those.
context.get_element_fe(this->_flow_vars.u())->get_d2phi();
context.get_element_fe(this->_temp_vars.T())->get_d2phi();
}
示例8:
void IncompressibleNavierStokesStabilizationBase<Mu>::init_context( AssemblyContext& context )
{
// First call base class
IncompressibleNavierStokesBase<Mu>::init_context(context);
// We need pressure derivatives
context.get_element_fe(this->_flow_vars.p_var())->get_dphi();
// We also need second derivatives, so initialize those.
context.get_element_fe(this->_flow_vars.u_var())->get_d2phi();
return;
}
示例9: init_context
void PracticeCDRinv::init_context( AssemblyContext& context){
context.get_element_fe(_c_var)->get_JxW();
context.get_element_fe(_c_var)->get_phi();
context.get_element_fe(_c_var)->get_dphi();
context.get_element_fe(_c_var)->get_xyz();
context.get_side_fe(_c_var)->get_JxW();
context.get_side_fe(_c_var)->get_phi();
context.get_side_fe(_c_var)->get_dphi();
context.get_side_fe(_c_var)->get_xyz();
return;
}
示例10: U
void HeatTransferSPGSMStabilization<K>::element_time_derivative
( 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();
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}
libMesh::FEBase* fe = context.get_element_fe(this->_temp_vars.T());
unsigned int n_qpoints = context.get_element_qrule().n_points();
for (unsigned int qp=0; qp != n_qpoints; qp++)
{
libMesh::RealGradient g = this->_stab_helper.compute_g( fe, context, qp );
libMesh::RealTensor G = this->_stab_helper.compute_G( fe, context, qp );
libMesh::RealGradient U( context.interior_value( this->_flow_vars.u(), qp ),
context.interior_value( this->_flow_vars.v(), qp ) );
if( this->_flow_vars.dim() == 3 )
{
U(2) = context.interior_value( this->_flow_vars.w(), qp );
}
// Compute Conductivity at this qp
libMesh::Real _k_qp = this->_k(context, qp);
libMesh::Real tau_E = this->_stab_helper.compute_tau_energy( context, G, this->_rho, this->_Cp, _k_qp, U, this->_is_steady );
libMesh::Real RE_s = this->_stab_helper.compute_res_energy_steady( context, qp, this->_rho, this->_Cp, _k_qp );
for (unsigned int i=0; i != n_T_dofs; i++)
{
FT(i) += -tau_E*RE_s*this->_rho*this->_Cp*U*T_gradphi[i][qp]*JxW[qp];
}
if( compute_jacobian )
{
libmesh_not_implemented();
}
}
}
示例11: FT
void HeatTransferSource<SourceFunction>::element_time_derivative( bool /*compute_jacobian*/,
AssemblyContext& context,
CachedValues& /*cache*/ )
{
#ifdef GRINS_USE_GRVY_TIMERS
this->_timer->BeginTimer("HeatTransferSource::element_time_derivative");
#endif
// The number of local degrees of freedom in each variable.
const unsigned int n_T_dofs = context.get_dof_indices(_temp_vars.T_var()).size();
// Element Jacobian * quadrature weights for interior integration.
const std::vector<libMesh::Real> &JxW =
context.get_element_fe(_temp_vars.T_var())->get_JxW();
// The temperature shape functions at interior quadrature points.
const std::vector<std::vector<libMesh::Real> >& T_phi =
context.get_element_fe(_temp_vars.T_var())->get_phi();
// Locations of quadrature points
const std::vector<libMesh::Point>& x_qp = context.get_element_fe(_temp_vars.T_var())->get_xyz();
// Get residuals
libMesh::DenseSubVector<libMesh::Number> &FT = context.get_elem_residual(_temp_vars.T_var()); // R_{T}
// Now we will build the element Jacobian and residual.
// Constructing the residual requires the solution and its
// gradient from the previous timestep. This must be
// calculated at each quadrature point by summing the
// solution degree-of-freedom values by the appropriate
// weight functions.
unsigned int n_qpoints = context.get_element_qrule().n_points();
for (unsigned int qp=0; qp != n_qpoints; qp++)
{
libMesh::Real q = _source( x_qp[qp] );
for (unsigned int i=0; i != n_T_dofs; i++)
{
FT(i) += q*T_phi[i][qp]*JxW[qp];
}
}
#ifdef GRINS_USE_GRVY_TIMERS
this->_timer->EndTimer("HeatTransferSource::element_time_derivative");
#endif
return;
}
示例12:
void AveragedTurbine<Mu>::init_context( AssemblyContext& context )
{
context.get_element_fe(this->_flow_vars.u_var())->get_xyz();
context.get_element_fe(this->_flow_vars.u_var())->get_phi();
return;
}
示例13:
void VelocityPenalty<Mu>::init_context( AssemblyContext& context )
{
context.get_element_fe(this->_flow_vars.u_var())->get_xyz();
context.get_element_fe(this->_flow_vars.u_var())->get_phi();
return;
}
示例14:
void ParsedVelocitySource<Mu>::init_context( AssemblyContext& context )
{
context.get_element_fe(this->_flow_vars.u())->get_xyz();
context.get_element_fe(this->_flow_vars.u())->get_phi();
return;
}
示例15:
void HeatConduction<K>::init_context( AssemblyContext& context )
{
// We should prerequest all the data
// we will need to build the linear system
// or evaluate a quantity of interest.
context.get_element_fe(_temp_vars.T_var())->get_JxW();
context.get_element_fe(_temp_vars.T_var())->get_phi();
context.get_element_fe(_temp_vars.T_var())->get_dphi();
context.get_element_fe(_temp_vars.T_var())->get_xyz();
context.get_side_fe(_temp_vars.T_var())->get_JxW();
context.get_side_fe(_temp_vars.T_var())->get_phi();
context.get_side_fe(_temp_vars.T_var())->get_dphi();
context.get_side_fe(_temp_vars.T_var())->get_xyz();
return;
}