13 #include "MooseVariable.h"
14 #include "FEProblemBase.h"
15 #include "NonlinearSystemBase.h"
16 #include "MooseMesh.h"
17 #include "AllLocalDofIndicesThread.h"
19 #include "libmesh/mesh_base.h"
27 InputParameters params = validParams<GeneralPostprocessor>();
28 params.addRequiredParam<VariableName>(
"variable",
"The name of the variable to test for contact");
29 params.addRequiredParam<SubdomainName>(
"subdomain",
"The subdomain that the variable lives on");
30 params.addParam<Real>(
31 "tolerance", TOLERANCE,
"The tolerance for accepting that the variable indicates contact");
32 params.addClassDescription(
"Outputs the number of dofs greater than a tolerance threshold "
33 "indicating mechanical contact");
38 : GeneralPostprocessor(parameters),
39 _var(_fe_problem.getVariable(_tid,
40 getParam<VariableName>(
"variable"),
41 Moose::VarKindType::VAR_NONLINEAR,
42 Moose::VarFieldType::VAR_FIELD_STANDARD)),
43 _mesh(_fe_problem.mesh().getMesh()),
44 _subdomain_id(_fe_problem.mesh().getSubdomainID(getParam<SubdomainName>(
"subdomain"))),
45 _tolerance(getParam<Real>(
"tolerance"))
58 AllLocalDofIndicesThread aldit(_fe_problem.getNonlinearSystemBase().system(), {
_var.name()});
64 ConstElemRange range(elem_begin, elem_end);
66 Threads::parallel_reduce(range, aldit);
68 auto && solution = _fe_problem.getNonlinearSystemBase().solution();
70 for (
auto dof : aldit._all_dof_indices)
75 _console << std::endl <<
"The number of nodes in contact is " <<
_count << std::endl << std::endl;