www.mooseframework.org
PolycrystalRandomICAction.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 "FEProblem.h"
10 #include "Conversion.h"
11 
12 template <>
13 InputParameters
15 {
16  InputParameters params = validParams<Action>();
17  params.addRequiredParam<unsigned int>("op_num", "number of order parameters to create");
18  params.addRequiredParam<std::string>("var_name_base", "specifies the base name of the variables");
19  MooseEnum typ_options("continuous discrete");
20  params.addParam<MooseEnum>("random_type",
21  typ_options,
22  "The type of random polycrystal initial condition. Whether one "
23  "order parameter is chosen to be 1 at each node or if each order "
24  "parameter continuously varies from 0 to 1");
25 
26  return params;
27 }
28 
30  : Action(params),
31  _op_num(getParam<unsigned int>("op_num")),
32  _var_name_base(getParam<std::string>("var_name_base")),
33  _random_type(getParam<MooseEnum>("random_type"))
34 {
35 }
36 
37 void
39 {
40 #ifdef DEBUG
41  Moose::err << "Inside the PolycrystalRandomICAction Object\n";
42 #endif
43 
44  // Loop through the number of order parameters
45  for (unsigned int op = 0; op < _op_num; op++)
46  {
47  // Set parameters for BoundingBoxIC
48  InputParameters poly_params = _factory.getValidParams("PolycrystalRandomIC");
49  poly_params.set<VariableName>("variable") = _var_name_base + Moose::stringify(op);
50  poly_params.set<unsigned int>("op_num") = _op_num;
51  poly_params.set<unsigned int>("op_index") = op;
52  poly_params.set<unsigned int>("typ") = _random_type;
53 
54  // Add initial condition
55  _problem->addInitialCondition("PolycrystalRandomIC",
56  "ICs/PolycrystalICs/PolycrystalRandomIC_" + Moose::stringify(op),
57  poly_params);
58  }
59 }
InputParameters validParams< PolycrystalRandomICAction >()
PolycrystalRandomICAction(const InputParameters &params)