www.mooseframework.org
PolycrystalStoredEnergyAction.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 #include "Factory.h"
9 #include "Conversion.h"
10 #include "FEProblem.h"
11 
12 template <>
13 InputParameters
15 {
16  InputParameters params = validParams<Action>();
17  params.addClassDescription("Action that adds the contribution of stored energy associated with "
18  "dislocations to grain growth models");
19  params.addRequiredParam<unsigned int>("op_num",
20  "specifies the total number of OPs representing "
21  "all grains (deformed + undeformed "
22  "(recrystallized)) to create");
23  params.addRequiredParam<std::string>("var_name_base", "specifies the base name of the variables");
24  params.addParam<VariableName>("c", "Name of coupled concentration variable");
25  params.addRequiredParam<unsigned int>("deformed_grain_num",
26  "specifies the number of deformed grains to create");
27  params.addParam<VariableName>("T", "Name of temperature variable");
28  params.addParam<bool>(
29  "use_displaced_mesh", false, "Whether to use displaced mesh in the kernels");
30  params.addRequiredParam<UserObjectName>("grain_tracker",
31  "The GrainTracker UserObject to get values from.");
32  return params;
33 }
34 
36  : Action(params),
37  _op_num(getParam<unsigned int>("op_num")),
38  _var_name_base(getParam<std::string>("var_name_base")),
39  _deformed_grain_num(getParam<unsigned int>("deformed_grain_num"))
40 {
41 }
42 
43 void
45 {
46  for (unsigned int op = 0; op < _op_num; ++op)
47  {
48  //
49  // Create variable names
50  //
51 
52  std::string var_name = _var_name_base + Moose::stringify(op);
53  std::vector<VariableName> v;
54  v.resize(_op_num - 1);
55 
56  unsigned int ind = 0;
57  for (unsigned int j = 0; j < _op_num; ++j)
58  if (j != op)
59  v[ind++] = _var_name_base + Moose::stringify(j);
60 
61  //
62  // Set up ACSEDGPoly Stored Energy in Deformed Grains kernels
63  //
64 
65  InputParameters params = _factory.getValidParams("ACSEDGPoly");
66  params.set<NonlinearVariableName>("variable") = var_name;
67  params.set<std::vector<VariableName>>("v") = v;
68  params.set<UserObjectName>("grain_tracker") = getParam<UserObjectName>("grain_tracker");
69  params.set<bool>("use_displaced_mesh") = getParam<bool>("use_displaced_mesh");
70  params.set<unsigned int>("deformed_grain_num") = getParam<unsigned int>("deformed_grain_num");
71  params.set<unsigned int>("op_index") = op;
72 
73  std::string kernel_name = "ACStoredEnergy_" + var_name;
74  _problem->addKernel("ACSEDGPoly", kernel_name, params);
75  }
76 }
InputParameters validParams< PolycrystalStoredEnergyAction >()
const unsigned int _op_num
number of grains to create
const std::string _var_name_base
base name for the order parameter variables
PolycrystalStoredEnergyAction(const InputParameters &params)