www.mooseframework.org
Public Member Functions | Private Attributes | List of all members
PolycrystalVariablesAction Class Reference

Automatically generates all variables to model a polycrystal with op_num orderparameters. More...

#include <PolycrystalVariablesAction.h>

Inheritance diagram for PolycrystalVariablesAction:
[legend]

Public Member Functions

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

Private Attributes

const unsigned int _op_num
 
const std::string _var_name_base
 

Detailed Description

Automatically generates all variables to model a polycrystal with op_num orderparameters.

Definition at line 22 of file PolycrystalVariablesAction.h.

Constructor & Destructor Documentation

◆ PolycrystalVariablesAction()

PolycrystalVariablesAction::PolycrystalVariablesAction ( const InputParameters &  params)

Definition at line 51 of file PolycrystalVariablesAction.C.

52  : Action(params),
53  _op_num(getParam<unsigned int>("op_num")),
54  _var_name_base(getParam<std::string>("var_name_base"))
55 {
56 }

Member Function Documentation

◆ act()

void PolycrystalVariablesAction::act ( )
virtual

Definition at line 59 of file PolycrystalVariablesAction.C.

60 {
61  // take initial values from file?
62  bool initial_from_file = getParam<bool>("initial_from_file");
63 
64  // Loop through the number of order parameters
65  for (unsigned int op = 0; op < _op_num; op++)
66  {
67  // Create variable names
68  std::string var_name = _var_name_base + Moose::stringify(op);
69 
70  // Add the variable
71  if (_current_task == "add_variable")
72  {
73  _problem->addVariable(
74  var_name,
75  FEType(Utility::string_to_enum<Order>(getParam<MooseEnum>("order")),
76  Utility::string_to_enum<FEFamily>(getParam<MooseEnum>("family"))),
77  getParam<Real>("scaling"));
78  }
79 
80  // Setup initial from file if requested
81  if (initial_from_file)
82  {
83  if (_current_task == "check_copy_nodal_vars")
84  _app.setFileRestart() = true;
85 
86  if (_current_task == "copy_nodal_vars")
87  {
88  auto * system = &_problem->getNonlinearSystemBase();
89  system->addVariableToCopy(var_name, var_name, "LATEST");
90  }
91  }
92  }
93 }

Member Data Documentation

◆ _op_num

const unsigned int PolycrystalVariablesAction::_op_num
private

Definition at line 30 of file PolycrystalVariablesAction.h.

Referenced by act().

◆ _var_name_base

const std::string PolycrystalVariablesAction::_var_name_base
private

Definition at line 31 of file PolycrystalVariablesAction.h.

Referenced by act().


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