www.mooseframework.org
PoroMechanicsAction.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 /****************************************************************/
7 #include "PoroMechanicsAction.h"
8 
9 #include "Factory.h"
10 #include "FEProblem.h"
11 #include "Parser.h"
12 #include "Conversion.h"
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<TensorMechanicsAction>();
19  params.addRequiredParam<NonlinearVariableName>("porepressure", "The porepressure variable");
20  return params;
21 }
22 
23 PoroMechanicsAction::PoroMechanicsAction(const InputParameters & params)
24  : TensorMechanicsAction(params)
25 {
26 }
27 
28 void
30 {
32 
33  if (_current_task == "add_kernel")
34  {
35  // Prepare displacements and set value for dim
36  std::vector<NonlinearVariableName> displacements =
37  getParam<std::vector<NonlinearVariableName>>("displacements");
38  unsigned int dim = displacements.size();
39 
40  // all the kernels added below have porepressure as a coupled variable
41  // add this to the kernel's params
42  std::string type("PoroMechanicsCoupling");
43  InputParameters params = _factory.getValidParams(type);
44  VariableName pp_var(getParam<NonlinearVariableName>("porepressure"));
45  params.addCoupledVar("porepressure", "");
46  params.set<std::vector<VariableName>>("porepressure") = {pp_var};
47 
48  // now add the kernels
49  for (unsigned int i = 0; i < dim; ++i)
50  {
51  std::string kernel_name = "PoroMechanics" + Moose::stringify(i);
52 
53  params.set<unsigned int>("component") = i;
54  params.set<NonlinearVariableName>("variable") = displacements[i];
55 
56  _problem->addKernel(type, kernel_name, params);
57  }
58  }
59 }
InputParameters validParams< PoroMechanicsAction >()
InputParameters validParams< TensorMechanicsAction >()
PoroMechanicsAction(const InputParameters &params)