本文整理汇总了C++中SymmTensor::addDiag方法的典型用法代码示例。如果您正苦于以下问题:C++ SymmTensor::addDiag方法的具体用法?C++ SymmTensor::addDiag怎么用?C++ SymmTensor::addDiag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymmTensor
的用法示例。
在下文中一共展示了SymmTensor::addDiag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: small
bool
ConstitutiveModel::applyThermalStrain(unsigned qp,
SymmTensor & strain_increment,
SymmTensor & d_strain_dT)
{
if (_has_temp && _t_step != 0)
{
Real inc_thermal_strain;
Real d_thermal_strain_d_temp;
Real old_temp;
if (_t_step == 1 && _has_stress_free_temp)
old_temp = _stress_free_temp;
else
old_temp = _temperature_old[qp];
Real current_temp = _temperature[qp];
Real delta_t = current_temp - old_temp;
Real alpha = _alpha;
if (_alpha_function)
{
Point p;
Real alpha_current_temp = _alpha_function->value(current_temp,p);
Real alpha_old_temp = _alpha_function->value(old_temp,p);
if (_mean_alpha_function)
{
Real small(1e-6);
Real numerator = alpha_current_temp * (current_temp - _ref_temp) - alpha_old_temp * (old_temp - _ref_temp);
Real denominator = 1.0 + alpha_old_temp * (old_temp - _ref_temp);
if (denominator < small)
mooseError("Denominator too small in thermal strain calculation");
inc_thermal_strain = numerator / denominator;
d_thermal_strain_d_temp = alpha_current_temp * (current_temp - _ref_temp);
}
else
{
inc_thermal_strain = delta_t * 0.5 * (alpha_current_temp + alpha_old_temp);
d_thermal_strain_d_temp = alpha_current_temp;
}
}
else
{
inc_thermal_strain = delta_t * alpha;
d_thermal_strain_d_temp = alpha;
}
strain_increment.addDiag(-inc_thermal_strain);
d_strain_dT.addDiag(-d_thermal_strain_d_temp);
}
bool modified = true;
return modified;
}