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

Automatically generates all auxvariables given vectors telling it the names and how many to create. More...

#include <MultiAuxVariablesAction.h>

Inheritance diagram for MultiAuxVariablesAction:
[legend]

Public Member Functions

 MultiAuxVariablesAction (InputParameters params)
 
virtual void act ()
 

Protected Attributes

const unsigned int _grain_num
 number of grains to create More...
 
const std::vector< std::string > & _var_name_base
 base name for the auxvariables More...
 
const unsigned int _num_var
 number of auxvariables More...
 
const MultiMooseEnum & _data_type
 list of material properties to be used More...
 
const unsigned int _data_size
 number of properties More...
 

Detailed Description

Automatically generates all auxvariables given vectors telling it the names and how many to create.

Definition at line 19 of file MultiAuxVariablesAction.h.

Constructor & Destructor Documentation

◆ MultiAuxVariablesAction()

MultiAuxVariablesAction::MultiAuxVariablesAction ( InputParameters  params)

Definition at line 36 of file MultiAuxVariablesAction.C.

37  : AddAuxVariableAction(params),
38  _grain_num(getParam<unsigned int>("grain_num")),
39  _var_name_base(getParam<std::vector<std::string>>("variable_base")),
40  _num_var(_var_name_base.size()),
41  _data_type(getParam<MultiMooseEnum>("data_type")),
42  _data_size(_data_type.size())
43 {
44 }
const MultiMooseEnum & _data_type
list of material properties to be used
const std::vector< std::string > & _var_name_base
base name for the auxvariables
const unsigned int _num_var
number of auxvariables
const unsigned int _grain_num
number of grains to create
const unsigned int _data_size
number of properties

Member Function Documentation

◆ act()

void MultiAuxVariablesAction::act ( )
virtual

for exatrcting data from MaterialProperty<std::vector<Real> >

for exatrcting data from MaterialProperty<std::vector<RealGradient> >

The name of the variable is the variable name base followed by the order parameter and a suffix mentioning dimension it applies to.

Definition at line 47 of file MultiAuxVariablesAction.C.

48 {
49  if (_num_var != _data_size)
50  mooseError("Data type not provided for all the AuxVariables in MultiAuxVariablesAction");
51 
52  // Blocks from the input
53  std::set<SubdomainID> blocks = getSubdomainIDs();
54 
55  // mesh dimension & components required for gradient variables
56  const unsigned int dim = _mesh->dimension();
57  const std::vector<char> suffix = {'x', 'y', 'z'};
58 
59  // Loop through the number of order parameters
60  for (unsigned int val = 0; val < _num_var; ++val)
61  for (unsigned int gr = 0; gr < _grain_num; ++gr)
62  {
64  if (_data_type[val] == "Real")
65  {
66  // Create variable names with variable name base followed by the order parameter it applies
67  // to.
68  std::string var_name = _var_name_base[val] + Moose::stringify(gr);
69 
70  if (blocks.empty())
71  _problem->addAuxVariable(var_name, _fe_type);
72  else
73  _problem->addAuxVariable(var_name, _fe_type, &blocks);
74  }
76  if (_data_type[val] == "RealGradient")
77  for (unsigned int x = 0; x < dim; ++x)
78  {
83  std::string var_name = _var_name_base[val] + Moose::stringify(gr) + "_" + suffix[x];
84 
85  if (blocks.empty())
86  _problem->addAuxVariable(var_name, _fe_type);
87  else
88  _problem->addAuxVariable(var_name, _fe_type, &blocks);
89  }
90  }
91 }
const MultiMooseEnum & _data_type
list of material properties to be used
const std::vector< std::string > & _var_name_base
base name for the auxvariables
const unsigned int _num_var
number of auxvariables
const unsigned int _grain_num
number of grains to create
const unsigned int _data_size
number of properties

Member Data Documentation

◆ _data_size

const unsigned int MultiAuxVariablesAction::_data_size
protected

number of properties

Definition at line 40 of file MultiAuxVariablesAction.h.

Referenced by act().

◆ _data_type

const MultiMooseEnum& MultiAuxVariablesAction::_data_type
protected

list of material properties to be used

Definition at line 37 of file MultiAuxVariablesAction.h.

Referenced by act().

◆ _grain_num

const unsigned int MultiAuxVariablesAction::_grain_num
protected

number of grains to create

Definition at line 28 of file MultiAuxVariablesAction.h.

Referenced by act().

◆ _num_var

const unsigned int MultiAuxVariablesAction::_num_var
protected

number of auxvariables

Definition at line 34 of file MultiAuxVariablesAction.h.

Referenced by act().

◆ _var_name_base

const std::vector<std::string>& MultiAuxVariablesAction::_var_name_base
protected

base name for the auxvariables

Definition at line 31 of file MultiAuxVariablesAction.h.

Referenced by act().


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