www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
GrainGrowthAction Class Reference

#include <GrainGrowthAction.h>

Inheritance diagram for GrainGrowthAction:
[legend]

Public Member Functions

 GrainGrowthAction (const InputParameters &params)
 
virtual void act ()
 

Protected Attributes

const unsigned int _op_num
 number of variables and variable name base for variable creation More...
 
const std::string _var_name_base
 
const FEType _fe_type
 FEType for the variable being created. More...
 

Detailed Description

Definition at line 24 of file GrainGrowthAction.h.

Constructor & Destructor Documentation

◆ GrainGrowthAction()

GrainGrowthAction::GrainGrowthAction ( const InputParameters &  params)

Definition at line 74 of file GrainGrowthAction.C.

75  : Action(params),
76  _op_num(getParam<unsigned int>("op_num")),
77  _var_name_base(getParam<std::string>("var_name_base")),
78  _fe_type(Utility::string_to_enum<Order>(getParam<MooseEnum>("order")),
79  Utility::string_to_enum<FEFamily>(getParam<MooseEnum>("family")))
80 {
81 }
const unsigned int _op_num
number of variables and variable name base for variable creation
const std::string _var_name_base
const FEType _fe_type
FEType for the variable being created.

Member Function Documentation

◆ act()

void GrainGrowthAction::act ( )
virtual

Definition at line 84 of file GrainGrowthAction.C.

85 {
86  // Loop over order parameters
87  for (unsigned int op = 0; op < _op_num; op++)
88  {
89  // Create variable name
90  std::string var_name = _var_name_base + Moose::stringify(op);
91 
92  // Add variable
93  if (_current_task == "add_variable")
94  _problem->addVariable(var_name, _fe_type, getParam<Real>("scaling"));
95 
96  // Add Kernels
97  else if (_current_task == "add_kernel")
98  {
99  //
100  // Add time derivative kernel
101  //
102 
103  {
104  std::string kernel_type = "TimeDerivative";
105 
106  std::string kernel_name = var_name + "_" + kernel_type;
107  InputParameters params = _factory.getValidParams(kernel_type);
108  params.set<NonlinearVariableName>("variable") = var_name;
109  params.applyParameters(parameters());
110 
111  _problem->addKernel(kernel_type, kernel_name, params);
112  }
113 
114  //
115  // Add ACGrGrPoly kernel
116  //
117 
118  {
119  std::string kernel_type = "ACGrGrPoly";
120 
121  // Make vector of order parameter names, excluding this one
122  std::vector<VariableName> v;
123  v.resize(_op_num - 1);
124 
125  unsigned int ind = 0;
126  for (unsigned int j = 0; j < _op_num; ++j)
127  if (j != op)
128  v[ind++] = _var_name_base + Moose::stringify(j);
129 
130  std::string kernel_name = var_name + "_" + kernel_type;
131  InputParameters params = _factory.getValidParams(kernel_type);
132  params.set<NonlinearVariableName>("variable") = var_name;
133  params.set<std::vector<VariableName>>("v") = v;
134  params.set<MaterialPropertyName>("mob_name") = getParam<MaterialPropertyName>("mobility");
135  params.applyParameters(parameters());
136 
137  _problem->addKernel(kernel_type, kernel_name, params);
138  }
139 
140  //
141  // Add ACInterface kernel
142  //
143 
144  {
145  std::string kernel_type = "ACInterface";
146 
147  std::string kernel_name = var_name + "_" + kernel_type;
148  InputParameters params = _factory.getValidParams(kernel_type);
149  params.set<NonlinearVariableName>("variable") = var_name;
150  params.set<MaterialPropertyName>("mob_name") = getParam<MaterialPropertyName>("mobility");
151  params.set<MaterialPropertyName>("kappa_name") = getParam<MaterialPropertyName>("kappa");
152  params.set<bool>("variable_L") = getParam<bool>("variable_mobility");
153  params.applyParameters(parameters());
154 
155  _problem->addKernel(kernel_type, kernel_name, params);
156  }
157 
158  //
159  // Set up optional ACGBPoly bubble interaction kernels
160  //
161 
162  if (isParamValid("c"))
163  {
164  std::string kernel_type = "ACGBPoly";
165 
166  std::string kernel_name = var_name + "_" + kernel_type;
167  InputParameters params = _factory.getValidParams(kernel_type);
168  params.set<NonlinearVariableName>("variable") = var_name;
169  params.set<std::vector<VariableName>>("c") = {getParam<VariableName>("c")};
170  params.applyParameters(parameters());
171 
172  _problem->addKernel(kernel_type, kernel_name, params);
173  }
174  }
175  }
176  // Create auxvariable
177  if (_current_task == "add_aux_variable")
178  _problem->addAuxVariable("bnds",
179  FEType(Utility::string_to_enum<Order>("FIRST"),
180  Utility::string_to_enum<FEFamily>("LAGRANGE")));
181  // Create BndsCalcAux auxkernel
182  else if (_current_task == "add_aux_kernel")
183  {
184  // Make vector of order parameter names, excluding this one std::vector<VariableName> v;
185  std::vector<VariableName> v;
186  v.resize(_op_num);
187 
188  for (unsigned int j = 0; j < _op_num; ++j)
189  v[j] = _var_name_base + Moose::stringify(j);
190 
191  std::string aux_kernel_type = "BndsCalcAux";
192 
193  std::string aux_kernel_name = "bnds_" + aux_kernel_type;
194  InputParameters params = _factory.getValidParams(aux_kernel_type);
195  params.set<AuxVariableName>("variable") = "bnds";
196  params.set<std::vector<VariableName>>("v") = v;
197  params.applyParameters(parameters());
198 
199  _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
200  }
201 }
const unsigned int _op_num
number of variables and variable name base for variable creation
const std::string _var_name_base
const FEType _fe_type
FEType for the variable being created.

Member Data Documentation

◆ _fe_type

const FEType GrainGrowthAction::_fe_type
protected

FEType for the variable being created.

Definition at line 37 of file GrainGrowthAction.h.

Referenced by act().

◆ _op_num

const unsigned int GrainGrowthAction::_op_num
protected

number of variables and variable name base for variable creation

Definition at line 33 of file GrainGrowthAction.h.

Referenced by act().

◆ _var_name_base

const std::string GrainGrowthAction::_var_name_base
protected

Definition at line 34 of file GrainGrowthAction.h.

Referenced by act().


The documentation for this class was generated from the following files: