www.mooseframework.org
PolycrystalRandomICAction.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 #include "Factory.h"
12 #include "FEProblem.h"
13 #include "Conversion.h"
14 
15 registerMooseAction("PhaseFieldApp", PolycrystalRandomICAction, "add_ic");
16 
17 template <>
18 InputParameters
20 {
21  InputParameters params = validParams<Action>();
22  params.addRequiredParam<unsigned int>("op_num", "number of order parameters to create");
23  params.addRequiredParam<std::string>("var_name_base", "specifies the base name of the variables");
24  MooseEnum typ_options("continuous discrete");
25  params.addParam<MooseEnum>("random_type",
26  typ_options,
27  "The type of random polycrystal initial condition. Whether one "
28  "order parameter is chosen to be 1 at each node or if each order "
29  "parameter continuously varies from 0 to 1");
30 
31  return params;
32 }
33 
35  : Action(params),
36  _op_num(getParam<unsigned int>("op_num")),
37  _var_name_base(getParam<std::string>("var_name_base")),
38  _random_type(getParam<MooseEnum>("random_type"))
39 {
40 }
41 
42 void
44 {
45 #ifdef DEBUG
46  Moose::err << "Inside the PolycrystalRandomICAction Object\n";
47 #endif
48 
49  // Loop through the number of order parameters
50  for (unsigned int op = 0; op < _op_num; op++)
51  {
52  // Set parameters for BoundingBoxIC
53  InputParameters poly_params = _factory.getValidParams("PolycrystalRandomIC");
54  poly_params.set<VariableName>("variable") = _var_name_base + Moose::stringify(op);
55  poly_params.set<unsigned int>("op_num") = _op_num;
56  poly_params.set<unsigned int>("op_index") = op;
57  poly_params.set<unsigned int>("random_type") = _random_type;
58 
59  // Add initial condition
60  _problem->addInitialCondition("PolycrystalRandomIC",
61  "ICs/PolycrystalICs/PolycrystalRandomIC_" + Moose::stringify(op),
62  poly_params);
63  }
64 }
PolycrystalRandomICAction::_random_type
const MooseEnum _random_type
Definition: PolycrystalRandomICAction.h:29
PolycrystalRandomICAction.h
PolycrystalRandomICAction::_op_num
const unsigned int _op_num
Definition: PolycrystalRandomICAction.h:27
validParams< PolycrystalRandomICAction >
InputParameters validParams< PolycrystalRandomICAction >()
Definition: PolycrystalRandomICAction.C:19
registerMooseAction
registerMooseAction("PhaseFieldApp", PolycrystalRandomICAction, "add_ic")
PolycrystalRandomICAction::act
virtual void act()
Definition: PolycrystalRandomICAction.C:43
PolycrystalRandomICAction::_var_name_base
const std::string _var_name_base
Definition: PolycrystalRandomICAction.h:28
PolycrystalRandomICAction::PolycrystalRandomICAction
PolycrystalRandomICAction(const InputParameters &params)
Definition: PolycrystalRandomICAction.C:34
PolycrystalRandomICAction
Automatically generates all variables to model a polycrystal with op_num orderparameters.
Definition: PolycrystalRandomICAction.h:19