www.mooseframework.org
Tricrystal2CircleGrainsICAction.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 "Parser.h"
10 #include "FEProblem.h"
11 #include "Conversion.h"
12 
13 #include <sstream>
14 #include <stdexcept>
15 
16 #include "libmesh/libmesh.h"
17 #include "libmesh/exodusII_io.h"
18 #include "libmesh/equation_systems.h"
19 #include "libmesh/nonlinear_implicit_system.h"
20 #include "libmesh/explicit_system.h"
21 #include "libmesh/string_to_enum.h"
22 
24 
25 template <>
26 InputParameters
28 {
29  InputParameters params = validParams<Action>();
30  params.addRequiredParam<unsigned int>("op_num", "number of order parameters to create");
31  params.addRequiredParam<std::string>("var_name_base", "specifies the base name of the variables");
32 
33  return params;
34 }
35 
37  : Action(params),
38  _var_name_base(getParam<std::string>("var_name_base")),
39  _op_num(getParam<unsigned int>("op_num"))
40 {
41 }
42 
43 void
45 {
46 #ifdef DEBUG
47  Moose::err << "Inside the Tricrystal2CircleGrainsICAction Object\n";
48 #endif
49 
50  // Loop through the number of order parameters
51  for (unsigned int op = 0; op < _op_num; op++)
52  {
53  // Create variable names
54  std::string var_name = _var_name_base;
55  std::stringstream out;
56  out << op;
57  var_name.append(out.str());
58 
59  // Set parameters for BoundingBoxIC
60  InputParameters poly_params = _factory.getValidParams("Tricrystal2CircleGrainsIC");
61  poly_params.set<VariableName>("variable") = var_name;
62  poly_params.set<unsigned int>("op_num") = _op_num;
63  poly_params.set<unsigned int>("op_index") = op;
64 
65  // Add initial condition
66  _problem->addInitialCondition("Tricrystal2CircleGrainsIC",
67  "Tricrystal2CircleGrainsIC_" + Moose::stringify(op),
68  poly_params);
69  }
70 }
Tricrystal2CircleGrainsICAction(const InputParameters &params)
InputParameters validParams< Tricrystal2CircleGrainsICAction >()