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