Skip to content

Commit

Permalink
Output diagnostics from penetration_info with PenetrationAux
Browse files Browse the repository at this point in the history
PenetrationAux already provided the ability to output the normal
penetration distance.  I added the option "quantity", which can
be used to ask PenetrationAux to provide other data from
penetration_info: distance, tangential_distance, normal_x,
normal_y, normal_z, closest_point_x, closest_point_y, closest_point_z
element_id, and side.  This is mostly intended to be used for testing
and diagnostics.  Addresses #852.

r9879
  • Loading branch information
bwspenc authored and permcody committed Feb 14, 2014
1 parent 654285d commit 6925d3a
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 2 deletions.
17 changes: 17 additions & 0 deletions framework/include/auxkernels/PenetrationAux.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ class PenetrationAux : public AuxKernel
virtual ~PenetrationAux() {}

protected:
enum PA_ENUM
{
PA_DISTANCE,
PA_TANG_DISTANCE,
PA_NORMAL_X,
PA_NORMAL_Y,
PA_NORMAL_Z,
PA_CLOSEST_POINT_X,
PA_CLOSEST_POINT_Y,
PA_CLOSEST_POINT_Z,
PA_ELEM_ID,
PA_SIDE
};

std::string _quantity_string;
PA_ENUM _quantity;

virtual Real computeValue();

PenetrationLocator & _penetration_locator;
Expand Down
52 changes: 50 additions & 2 deletions framework/src/auxkernels/PenetrationAux.C
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,74 @@ InputParameters validParams<PenetrationAux>()
params.addParam<Real>("tangential_tolerance", "Tangential distance to extend edges of contact surfaces");
params.addParam<std::string>("order", "FIRST", "The finite element order");
params.set<bool>("use_displaced_mesh") = true;
params.addParam<std::string>("quantity","distance","The quantity to recover from the available penetration information: distance(default), tangential_distance, normal_x, normal_y, normal_z, closest_point_x, closest_point_y, closest_point_z, element_id");
return params;
}

PenetrationAux::PenetrationAux(const std::string & name, InputParameters parameters) :
AuxKernel(name, parameters),
_quantity_string( getParam<std::string>("quantity") ),
_quantity(PA_DISTANCE),
_penetration_locator(getPenetrationLocator(parameters.get<unsigned int>("paired_boundary"), getParam<std::vector<unsigned int> >("boundary")[0], Utility::string_to_enum<Order>(parameters.get<std::string>("order"))))
{
if (parameters.isParamValid("tangential_tolerance"))
{
_penetration_locator.setTangentialTolerance(getParam<Real>("tangential_tolerance"));
}

if ( _quantity_string == "distance" )
_quantity = PA_DISTANCE;
else if ( _quantity_string == "tangential_distance" )
_quantity = PA_TANG_DISTANCE;
else if ( _quantity_string == "normal_x" )
_quantity = PA_NORMAL_X;
else if ( _quantity_string == "normal_y" )
_quantity = PA_NORMAL_Y;
else if ( _quantity_string == "normal_z" )
_quantity = PA_NORMAL_Z;
else if ( _quantity_string == "closest_point_x" )
_quantity = PA_CLOSEST_POINT_X;
else if ( _quantity_string == "closest_point_y" )
_quantity = PA_CLOSEST_POINT_Y;
else if ( _quantity_string == "closest_point_z" )
_quantity = PA_CLOSEST_POINT_Z;
else if ( _quantity_string == "element_id" )
_quantity = PA_ELEM_ID;
else if ( _quantity_string == "side" )
_quantity = PA_SIDE;
else
mooseError("Invalid quantity type in PenetrationAux: "<<_quantity_string);
}

Real
PenetrationAux::computeValue()
{
PenetrationLocator::PenetrationInfo * pinfo = _penetration_locator._penetration_info[_current_node->id()];

Real retVal(-999999);
if(pinfo)
return pinfo->_distance;
{
if (_quantity == PA_DISTANCE)
retVal = pinfo->_distance;
else if (_quantity == PA_TANG_DISTANCE)
retVal = pinfo->_tangential_distance;
else if (_quantity == PA_NORMAL_X)
retVal = pinfo->_normal(0);
else if (_quantity == PA_NORMAL_Y)
retVal = pinfo->_normal(1);
else if (_quantity == PA_NORMAL_Z)
retVal = pinfo->_normal(2);
else if (_quantity == PA_CLOSEST_POINT_X)
retVal = pinfo->_closest_point(0);
else if (_quantity == PA_CLOSEST_POINT_Y)
retVal = pinfo->_closest_point(1);
else if (_quantity == PA_CLOSEST_POINT_Z)
retVal = pinfo->_closest_point(2);
else if (_quantity == PA_ELEM_ID)
retVal = (Real) (pinfo->_elem->id()+1);
else if (_quantity == PA_SIDE)
retVal = (Real) (pinfo->_side_num);
}

return -999999;
return retVal;
}

0 comments on commit 6925d3a

Please sign in to comment.