本文整理汇总了C++中PenetrationInfo::_normal方法的典型用法代码示例。如果您正苦于以下问题:C++ PenetrationInfo::_normal方法的具体用法?C++ PenetrationInfo::_normal怎么用?C++ PenetrationInfo::_normal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PenetrationInfo
的用法示例。
在下文中一共展示了PenetrationInfo::_normal方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
Real
MultiDContactConstraint::computeQpJacobian(Moose::ConstraintJacobianType type)
{
PenetrationInfo * pinfo = _penetration_locator._penetration_info[_current_node->id()];
double slave_jac = 0;
switch (type)
{
case Moose::SlaveSlave:
switch (_model)
{
case CM_FRICTIONLESS:
slave_jac = pinfo->_normal(_component) * pinfo->_normal(_component) * ( _penalty*_phi_slave[_j][_qp] - (*_jacobian)(_current_node->dof_number(0, _var.number(), 0), _connected_dof_indices[_j]) );
break;
case CM_GLUED:
/*
resid = pen_force(_component)
- res_vec(_component)
;
*/
break;
default:
mooseError("Invalid or unavailable contact model");
break;
}
return _test_slave[_i][_qp] * slave_jac;
case Moose::SlaveMaster:
switch (_model)
{
case CM_FRICTIONLESS:
slave_jac = pinfo->_normal(_component) * pinfo->_normal(_component) * ( -_penalty*_phi_master[_j][_qp] );
break;
case CM_GLUED:
/*
resid = pen_force(_component)
- res_vec(_component)
;
*/
break;
default:
mooseError("Invalid or unavailable contact model");
break;
}
return _test_slave[_i][_qp] * slave_jac;
case Moose::MasterSlave:
slave_jac = (*_jacobian)(_current_node->dof_number(0, _var.number(), 0), _connected_dof_indices[_j]);
return slave_jac*_test_master[_i][_qp];
case Moose::MasterMaster:
return 0;
}
return 0;
}
示例2: distance_vec
Real
SlaveConstraint::computeQpResidual()
{
PenetrationInfo * pinfo = _point_to_info[_current_point];
const Node * node = pinfo->_node;
Real resid = pinfo->_contact_force(_component);
const Real area = nodalArea(*pinfo);
if (_formulation == CF_DEFAULT)
{
RealVectorValue distance_vec(_mesh.node(node->id()) - pinfo->_closest_point);
RealVectorValue pen_force(_penalty * distance_vec);
if (_normalize_penalty)
pen_force *= area;
if (_model == CM_FRICTIONLESS)
resid += pinfo->_normal(_component) * pinfo->_normal * pen_force;
else if (_model == CM_GLUED || _model == CM_COULOMB)
resid += pen_force(_component);
}
return _test[_i][_qp] * resid;
}
示例3: distance_vec
Real
MechanicalContactConstraint::computeQpResidual(Moose::ConstraintType type)
{
PenetrationInfo * pinfo = _penetration_locator._penetration_info[_current_node->id()];
computeContactForce(pinfo);
Real resid = pinfo->_contact_force(_component);
switch(type)
{
case Moose::Slave:
if (_formulation == CF_DEFAULT)
{
//Real distance = (*_current_node)(_component) - pinfo->_closest_point(_component);
//Real pen_force = _penalty * distance;
RealVectorValue distance_vec(*_current_node - pinfo->_closest_point);
RealVectorValue pen_force(_penalty * distance_vec);
if (_model == CM_FRICTIONLESS || _model == CM_EXPERIMENTAL)
resid += pinfo->_normal(_component) * pinfo->_normal * pen_force;
else if (_model == CM_GLUED || _model == CM_TIED || _model == CM_COULOMB)
resid += pen_force(_component);
}
return _test_slave[_i][_qp] * resid;
case Moose::Master:
return _test_master[_i][_qp] * -resid;
}
return 0;
}
示例4: nodalArea
Real
ContactMaster::computeQpJacobian()
{
PenetrationInfo * pinfo = _point_to_info[_current_point];
Real penalty = _penalty;
if (_normalize_penalty)
penalty *= nodalArea(*pinfo);
switch (_model)
{
case CM_FRICTIONLESS:
switch (_formulation)
{
case CF_DEFAULT:
return 0;
break;
case CF_PENALTY:
case CF_AUGMENTED_LAGRANGE:
return _test[_i][_qp] * penalty * _phi[_j][_qp] * pinfo->_normal(_component) * pinfo->_normal(_component);
break;
default:
mooseError("Invalid contact formulation");
break;
}
break;
case CM_GLUED:
case CM_COULOMB:
switch (_formulation)
{
case CF_DEFAULT:
return 0;
break;
case CF_PENALTY:
case CF_AUGMENTED_LAGRANGE:
return _test[_i][_qp] * penalty * _phi[_j][_qp];
break;
default:
mooseError("Invalid contact formulation");
break;
}
break;
default:
mooseError("Invalid or unavailable contact model");
break;
}
return 0;
/*
if (_i != _j)
return 0;
Node * node = pinfo->_node;
RealVectorValue jac_vec;
// Build up jac vector
for (unsigned int i=0; i<_dim; i++)
{
long int dof_number = node->dof_number(0, _vars(i), 0);
jac_vec(i) = _jacobian_copy(dof_number, dof_number);
}
Real jac_mag = pinfo->_normal * jac_vec;
return _test[_i][_qp]*pinfo->_normal(_component)*jac_mag;
*/
}
示例5: switch
Real
MechanicalContactConstraint::computeQpJacobian(Moose::ConstraintJacobianType type)
{
PenetrationInfo * pinfo = _penetration_locator._penetration_info[_current_node->id()];
switch(type)
{
case Moose::SlaveSlave:
switch(_model)
{
case CM_FRICTIONLESS:
case CM_EXPERIMENTAL:
switch (_formulation)
{
case CF_DEFAULT:
{
double curr_jac = (*_jacobian)(_current_node->dof_number(0, _vars(_component), 0), _connected_dof_indices[_j]);
//TODO: Need off-diagonal term/s
return (-curr_jac + _phi_slave[_j][_qp] * _penalty * _test_slave[_i][_qp]) * pinfo->_normal(_component) * pinfo->_normal(_component);
}
case CF_PENALTY:
case CF_AUGMENTED_LAGRANGE:
//TODO: Need off-diagonal terms
return _phi_slave[_j][_qp] * _penalty * _test_slave[_i][_qp] * pinfo->_normal(_component) * pinfo->_normal(_component);
default:
mooseError("Invalid contact formulation");
}
case CM_COULOMB:
case CM_GLUED:
case CM_TIED:
switch (_formulation)
{
case CF_DEFAULT:
{
double curr_jac = (*_jacobian)(_current_node->dof_number(0, _vars(_component), 0), _connected_dof_indices[_j]);
return -curr_jac + _phi_slave[_j][_qp] * _penalty * _test_slave[_i][_qp];
}
case CF_PENALTY:
case CF_AUGMENTED_LAGRANGE:
return _phi_slave[_j][_qp] * _penalty * _test_slave[_i][_qp];
default:
mooseError("Invalid contact formulation");
}
default:
mooseError("Invalid or unavailable contact model");
}
case Moose::SlaveMaster:
switch(_model)
{
case CM_FRICTIONLESS:
case CM_EXPERIMENTAL:
switch (_formulation)
{
case CF_DEFAULT:
{
Node * curr_master_node = _current_master->get_node(_j);
double curr_jac = (*_jacobian)(_current_node->dof_number(0, _vars(_component), 0), curr_master_node->dof_number(0, _vars(_component), 0));
//TODO: Need off-diagonal terms
return (-curr_jac - _phi_master[_j][_qp] * _penalty * _test_slave[_i][_qp]) * pinfo->_normal(_component) * pinfo->_normal(_component);
}
case CF_PENALTY:
case CF_AUGMENTED_LAGRANGE:
//TODO: Need off-diagonal terms
return -_phi_master[_j][_qp] * _penalty * _test_slave[_i][_qp] * pinfo->_normal(_component) * pinfo->_normal(_component);
default:
mooseError("Invalid contact formulation");
}
case CM_COULOMB:
case CM_GLUED:
case CM_TIED:
switch (_formulation)
{
case CF_DEFAULT:
{
Node * curr_master_node = _current_master->get_node(_j);
double curr_jac = (*_jacobian)( _current_node->dof_number(0, _vars(_component), 0), curr_master_node->dof_number(0, _vars(_component), 0));
return -curr_jac - _phi_master[_j][_qp] * _penalty * _test_slave[_i][_qp];
}
case CF_PENALTY:
case CF_AUGMENTED_LAGRANGE:
return -_phi_master[_j][_qp] * _penalty * _test_slave[_i][_qp];
default:
mooseError("Invalid contact formulation");
}
default:
mooseError("Invalid or unavailable contact model");
}
case Moose::MasterSlave:
switch(_model)
{
case CM_FRICTIONLESS:
case CM_EXPERIMENTAL:
switch (_formulation)
{
case CF_DEFAULT:
{
//TODO: Need off-diagonal terms
double slave_jac = (*_jacobian)(_current_node->dof_number(0, _vars(_component), 0), _connected_dof_indices[_j]);
//.........这里部分代码省略.........
示例6: retVal
Real
PenetrationAux::computeValue()
{
const Node * current_node = NULL;
if (_nodal)
current_node = _current_node;
else
current_node = _mesh.getQuadratureNode(_current_elem, _current_side, _qp);
PenetrationInfo * pinfo = _penetration_locator._penetration_info[current_node->id()];
Real retVal(NotPenetrated);
if (pinfo)
switch (_quantity)
{
case PA_DISTANCE:
retVal = pinfo->_distance;
break;
case PA_TANG_DISTANCE:
retVal = pinfo->_tangential_distance;
break;
case PA_NORMAL_X:
retVal = pinfo->_normal(0);
break;
case PA_NORMAL_Y:
retVal = pinfo->_normal(1);
break;
case PA_NORMAL_Z:
retVal = pinfo->_normal(2);
break;
case PA_CLOSEST_POINT_X:
retVal = pinfo->_closest_point(0);
break;
case PA_CLOSEST_POINT_Y:
retVal = pinfo->_closest_point(1);
break;
case PA_CLOSEST_POINT_Z:
retVal = pinfo->_closest_point(2);
break;
case PA_ELEM_ID:
retVal = static_cast<Real>(pinfo->_elem->id() + 1);
break;
case PA_SIDE:
retVal = static_cast<Real>(pinfo->_side_num);
break;
case PA_INCREMENTAL_SLIP_MAG:
retVal = pinfo->isCaptured() ? pinfo->_incremental_slip.norm() : 0;
break;
case PA_INCREMENTAL_SLIP_X:
retVal = pinfo->isCaptured() ? pinfo->_incremental_slip(0) : 0;
break;
case PA_INCREMENTAL_SLIP_Y:
retVal = pinfo->isCaptured() ? pinfo->_incremental_slip(1) : 0;
break;
case PA_INCREMENTAL_SLIP_Z:
retVal = pinfo->isCaptured() ? pinfo->_incremental_slip(2) : 0;
break;
case PA_ACCUMULATED_SLIP:
retVal = pinfo->_accumulated_slip;
break;
case PA_FORCE_X:
retVal = pinfo->_contact_force(0);
break;
case PA_FORCE_Y:
retVal = pinfo->_contact_force(1);
break;
case PA_FORCE_Z:
retVal = pinfo->_contact_force(2);
break;
case PA_NORMAL_FORCE_MAG:
retVal = -pinfo->_contact_force * pinfo->_normal;
break;
case PA_NORMAL_FORCE_X:
retVal = (pinfo->_contact_force * pinfo->_normal) * pinfo->_normal(0);
break;
case PA_NORMAL_FORCE_Y:
retVal = (pinfo->_contact_force * pinfo->_normal) * pinfo->_normal(1);
break;
case PA_NORMAL_FORCE_Z:
retVal = (pinfo->_contact_force * pinfo->_normal) * pinfo->_normal(2);
break;
case PA_TANGENTIAL_FORCE_MAG:
{
RealVectorValue contact_force_normal((pinfo->_contact_force * pinfo->_normal) *
pinfo->_normal);
RealVectorValue contact_force_tangential(pinfo->_contact_force - contact_force_normal);
retVal = contact_force_tangential.norm();
break;
}
case PA_TANGENTIAL_FORCE_X:
retVal =
pinfo->_contact_force(0) - (pinfo->_contact_force * pinfo->_normal) * pinfo->_normal(0);
break;
case PA_TANGENTIAL_FORCE_Y:
retVal =
pinfo->_contact_force(1) - (pinfo->_contact_force * pinfo->_normal) * pinfo->_normal(1);
break;
case PA_TANGENTIAL_FORCE_Z:
//.........这里部分代码省略.........
示例7: getPenalty
Real
MechanicalContactConstraint::computeQpOffDiagJacobian(Moose::ConstraintJacobianType type,
unsigned int jvar)
{
PenetrationInfo * pinfo = _penetration_locator._penetration_info[_current_node->id()];
const Real penalty = getPenalty(*pinfo);
unsigned int coupled_component;
double normal_component_in_coupled_var_dir = 1.0;
if (getCoupledVarComponent(jvar,coupled_component))
normal_component_in_coupled_var_dir = pinfo->_normal(coupled_component);
switch (type)
{
case Moose::SlaveSlave:
switch (_model)
{
case CM_FRICTIONLESS:
switch (_formulation)
{
case CF_KINEMATIC:
{
RealVectorValue jac_vec;
for (unsigned int i=0; i<_mesh_dimension; ++i)
{
dof_id_type dof_number = _current_node->dof_number(0, _vars(i), 0);
jac_vec(i) = (*_jacobian)(dof_number, _connected_dof_indices[_j]);
}
return -pinfo->_normal(_component) * (pinfo->_normal*jac_vec) + (_phi_slave[_j][_qp] * penalty * _test_slave[_i][_qp]) * pinfo->_normal(_component) * normal_component_in_coupled_var_dir;
}
case CF_PENALTY:
case CF_AUGMENTED_LAGRANGE:
return _phi_slave[_j][_qp] * penalty * _test_slave[_i][_qp] * pinfo->_normal(_component) * normal_component_in_coupled_var_dir;
default:
mooseError("Invalid contact formulation");
}
case CM_COULOMB:
case CM_GLUED:
{
double curr_jac = (*_jacobian)(_current_node->dof_number(0, _vars(_component), 0), _connected_dof_indices[_j]);
return -curr_jac;
}
default:
mooseError("Invalid or unavailable contact model");
}
case Moose::SlaveMaster:
switch (_model)
{
case CM_FRICTIONLESS:
switch (_formulation)
{
case CF_KINEMATIC:
{
Node * curr_master_node = _current_master->get_node(_j);
RealVectorValue jac_vec;
for (unsigned int i=0; i<_mesh_dimension; ++i)
{
dof_id_type dof_number = _current_node->dof_number(0, _vars(i), 0);
jac_vec(i) = (*_jacobian)(dof_number, curr_master_node->dof_number(0, _vars(_component), 0));
}
return -pinfo->_normal(_component)*(pinfo->_normal*jac_vec) - (_phi_master[_j][_qp] * penalty * _test_slave[_i][_qp]) * pinfo->_normal(_component) * normal_component_in_coupled_var_dir;
}
case CF_PENALTY:
case CF_AUGMENTED_LAGRANGE:
return -_phi_master[_j][_qp] * penalty * _test_slave[_i][_qp] * pinfo->_normal(_component) * normal_component_in_coupled_var_dir;
default:
mooseError("Invalid contact formulation");
}
case CM_COULOMB:
case CM_GLUED:
return 0;
default:
mooseError("Invalid or unavailable contact model");
}
case Moose::MasterSlave:
switch (_model)
{
case CM_FRICTIONLESS:
switch (_formulation)
{
case CF_KINEMATIC:
{
RealVectorValue jac_vec;
for (unsigned int i=0; i<_mesh_dimension; ++i)
{
dof_id_type dof_number = _current_node->dof_number(0, _vars(i), 0);
jac_vec(i) = (*_jacobian)(dof_number, _connected_dof_indices[_j]);
}
return pinfo->_normal(_component)*(pinfo->_normal*jac_vec) * _test_master[_i][_qp];
}
case CF_PENALTY:
case CF_AUGMENTED_LAGRANGE:
return -_test_master[_i][_qp] * penalty * _phi_slave[_j][_qp] * pinfo->_normal(_component) * normal_component_in_coupled_var_dir;
default:
mooseError("Invalid contact formulation");
}
//.........这里部分代码省略.........
示例8: distance_vec
Real
MultiDContactConstraint::computeQpResidual(Moose::ConstraintType type)
{
PenetrationInfo * pinfo = _penetration_locator._penetration_info[_current_node->id()];
const Node * node = pinfo->_node;
RealVectorValue res_vec;
// Build up residual vector
for (unsigned int i=0; i<_mesh_dimension; ++i)
{
dof_id_type dof_number = node->dof_number(0, _vars(i), 0);
res_vec(i) = _residual_copy(dof_number);
}
const RealVectorValue distance_vec(_mesh.node(node->id()) - pinfo->_closest_point);
const RealVectorValue pen_force(_penalty * distance_vec);
Real resid = 0;
switch (type)
{
case Moose::Slave:
switch (_model)
{
case CM_FRICTIONLESS:
resid = pinfo->_normal(_component) * (pinfo->_normal * ( pen_force - res_vec ));
break;
case CM_GLUED:
resid = pen_force(_component)
- res_vec(_component)
;
break;
default:
mooseError("Invalid or unavailable contact model");
break;
}
return _test_slave[_i][_qp] * resid;
case Moose::Master:
switch (_model)
{
case CM_FRICTIONLESS:
resid = pinfo->_normal(_component) * (pinfo->_normal * res_vec);
break;
case CM_GLUED:
resid = res_vec(_component);
break;
default:
mooseError("Invalid or unavailable contact model");
break;
}
return _test_master[_i][_qp] * resid;
}
return 0;
}