www.mooseframework.org
PolycrystalElasticDrivingForceAction.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 
9 #include "Factory.h"
10 #include "FEProblem.h"
11 #include "Conversion.h"
12 
13 template <>
14 InputParameters
16 {
17  InputParameters params = validParams<Action>();
18  params.addClassDescription(
19  "Action that addes the elastic driving force for each order parameter");
20  params.addRequiredParam<unsigned int>("op_num", "specifies the number of grains to create");
21  params.addRequiredParam<std::string>("var_name_base", "specifies the base name of the variables");
22  params.addParam<bool>(
23  "use_displaced_mesh", false, "Whether to use displaced mesh in the kernels");
24  params.addParam<std::string>("base_name",
25  "Optional parameter that allows the user to define "
26  "multiple mechanics material systems on the same "
27  "block, i.e. for multiple phases");
28  return params;
29 }
30 
32  const InputParameters & params)
33  : Action(params),
34  _op_num(getParam<unsigned int>("op_num")),
35  _var_name_base(getParam<std::string>("var_name_base")),
36  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
37  _elasticity_tensor_name(_base_name + "elasticity_tensor")
38 {
39 }
40 
41 void
43 {
44 #ifdef DEBUG
45  Moose::err << "Inside the PolycrystalElasticDrivingForceAction Object\n";
46  Moose::err << "var name base:" << _var_name_base;
47 #endif
48 
49  for (unsigned int op = 0; op < _op_num; ++op)
50  {
51  // Create variable name
52  std::string var_name = _var_name_base + Moose::stringify(op);
53 
54  // Create Stiffness derivative name
55  MaterialPropertyName D_stiff_name = propertyNameFirst(_elasticity_tensor_name, var_name);
56 
57  // Set name of kernel being created
58  std::string kernel_type = "ACGrGrElasticDrivingForce";
59 
60  // Set the actual parameters for the kernel
61  InputParameters poly_params = _factory.getValidParams(kernel_type);
62  poly_params.set<NonlinearVariableName>("variable") = var_name;
63  poly_params.set<MaterialPropertyName>("D_tensor_name") = D_stiff_name;
64  poly_params.set<bool>("use_displaced_mesh") = getParam<bool>("use_displaced_mesh");
65 
66  std::string kernel_name = "AC_ElasticDrivingForce_" + var_name;
67 
68  // Create kernel
69  _problem->addKernel(kernel_type, kernel_name, poly_params);
70  }
71 }
const unsigned int _op_num
Number of order parameters used in the model.
std::string _var_name_base
Base name for the order parameters.
InputParameters validParams< PolycrystalElasticDrivingForceAction >()
PolycrystalElasticDrivingForceAction(const InputParameters &params)