www.mooseframework.org
ContactPressureAuxAction.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 #include "Conversion.h"
14 
15 static unsigned int counter = 0;
16 
17 template <>
18 InputParameters
20 {
21  MooseEnum orders("FIRST SECOND THIRD FOURTH", "FIRST");
22 
23  InputParameters params = validParams<Action>();
24  params.addRequiredParam<BoundaryName>("master", "The master surface");
25  params.addRequiredParam<BoundaryName>("slave", "The slave surface");
26  params.addParam<MooseEnum>("order", orders, "The finite element order: " + orders.getRawNames());
27  return params;
28 }
29 
31  : Action(params),
32  _master(getParam<BoundaryName>("master")),
33  _slave(getParam<BoundaryName>("slave")),
34  _order(getParam<MooseEnum>("order"))
35 {
36 }
37 
38 void
40 {
41  if (!_problem->getDisplacedProblem())
42  {
43  mooseError("Contact requires updated coordinates. Use the 'displacements = ...' line in the "
44  "Mesh block.");
45  }
46 
47  {
48  InputParameters params = _factory.getValidParams("ContactPressureAux");
49 
50  // Extract global params
51  if (isParamValid("parser_syntax"))
52  _app.parser().extractParams(getParam<std::string>("parser_syntax"), params);
53 
54  params.set<std::vector<BoundaryName>>("boundary") = {_slave};
55  params.set<BoundaryName>("paired_boundary") = _master;
56  params.set<AuxVariableName>("variable") = "contact_pressure";
57  params.addRequiredCoupledVar("nodal_area", "The nodal area");
58  params.set<std::vector<VariableName>>("nodal_area") = {"nodal_area_" + _name};
59  params.set<MooseEnum>("order") = _order;
60 
61  params.set<bool>("use_displaced_mesh") = true;
62 
63  std::stringstream name;
64  name << _name;
65  name << "_contact_pressure_";
66  name << counter++;
67 
68  MultiMooseEnum execute_options(SetupInterface::getExecuteOptions());
69  execute_options = "nonlinear timestep_end timestep_begin";
70  params.set<MultiMooseEnum>("execute_on") = execute_options;
71  _problem->addAuxKernel("ContactPressureAux", name.str(), params);
72  }
73 }
InputParameters validParams< ContactPressureAuxAction >()
ContactPressureAuxAction(const InputParameters &params)
static unsigned int counter