www.mooseframework.org
ContactPenetrationAuxAction.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 
9 #include "Factory.h"
10 #include "FEProblem.h"
11 #include "Parser.h"
12 #include "MooseApp.h"
13 
14 static unsigned int counter = 0;
15 
16 template <>
17 InputParameters
19 {
20  MooseEnum orders("FIRST SECOND THIRD FOURTH", "FIRST");
21 
22  InputParameters params = validParams<Action>();
23  params.addRequiredParam<BoundaryName>("master", "The master surface");
24  params.addRequiredParam<BoundaryName>("slave", "The slave surface");
25  params.addParam<MooseEnum>("order", orders, "The finite element order: FIRST, SECOND, etc.");
26  return params;
27 }
28 
30  : Action(params),
31  _master(getParam<BoundaryName>("master")),
32  _slave(getParam<BoundaryName>("slave")),
33  _order(getParam<MooseEnum>("order"))
34 {
35 }
36 
37 void
39 {
40  if (!_problem->getDisplacedProblem())
41  {
42  mooseError("Contact requires updated coordinates. Use the 'displacements = ...' line in the "
43  "Mesh block.");
44  }
45 
46  {
47  InputParameters params = _factory.getValidParams("PenetrationAux");
48 
49  MultiMooseEnum execute_options = SetupInterface::getExecuteOptions();
50  execute_options = "initial linear";
51  params.set<MultiMooseEnum>("execute_on") = execute_options;
52 
53  // Extract global params
54  if (isParamValid("parser_syntax"))
55  _app.parser().extractParams(getParam<std::string>("parser_syntax"), params);
56 
57  params.set<std::vector<BoundaryName>>("boundary") = {_slave};
58  params.set<BoundaryName>("paired_boundary") = _master;
59  params.set<AuxVariableName>("variable") = "penetration";
60  params.set<MooseEnum>("order") = _order;
61 
62  params.set<bool>("use_displaced_mesh") = true;
63 
64  std::stringstream name;
65  name << _name;
66  name << "_contact_";
67  name << counter++;
68  _problem->addAuxKernel("PenetrationAux", name.str(), params);
69  }
70 }
InputParameters validParams< ContactPenetrationAuxAction >()
ContactPenetrationAuxAction(const InputParameters &params)
static unsigned int counter