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 21 of file GrainGrowthAction.h.

Constructor & Destructor Documentation

GrainGrowthAction::GrainGrowthAction ( const InputParameters &  params)

Definition at line 64 of file GrainGrowthAction.C.

65  : Action(params),
66  _op_num(getParam<unsigned int>("op_num")),
67  _var_name_base(getParam<std::string>("var_name_base")),
68  _fe_type(Utility::string_to_enum<Order>(getParam<MooseEnum>("order")),
69  Utility::string_to_enum<FEFamily>(getParam<MooseEnum>("family")))
70 {
71 }
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

void GrainGrowthAction::act ( )
virtual

Definition at line 74 of file GrainGrowthAction.C.

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

const FEType GrainGrowthAction::_fe_type
protected

FEType for the variable being created.

Definition at line 34 of file GrainGrowthAction.h.

Referenced by act().

const unsigned int GrainGrowthAction::_op_num
protected

number of variables and variable name base for variable creation

Definition at line 30 of file GrainGrowthAction.h.

Referenced by act().

const std::string GrainGrowthAction::_var_name_base
protected

Definition at line 31 of file GrainGrowthAction.h.

Referenced by act().


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