www.mooseframework.org
AddSecondarySpeciesAction.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 #include "AddAuxVariableAction.h"
9 #include "MooseUtils.h"
10 #include "FEProblem.h"
11 #include "Factory.h"
12 #include "MooseError.h"
13 
14 #include "libmesh/string_to_enum.h"
15 
16 template <>
17 InputParameters
19 {
20  InputParameters params = validParams<Action>();
21  params.addParam<std::vector<AuxVariableName>>("secondary_species",
22  "The list of secondary species to add");
23  // Get MooseEnums for the possible order/family options for this variable
24  MooseEnum families(AddAuxVariableAction::getAuxVariableFamilies());
25  MooseEnum orders(AddAuxVariableAction::getAuxVariableOrders());
26  params.addParam<MooseEnum>("family",
27  families,
28  "Specifies the family of FE "
29  "shape function to use for the order parameters");
30  params.addParam<MooseEnum>("order",
31  orders,
32  "Specifies the order of the FE "
33  "shape function to use for the order parameters");
34  params.addClassDescription("Adds AuxVariables for all secondary species");
35  return params;
36 }
37 
39  : Action(params), _secondary_species(getParam<std::vector<AuxVariableName>>("secondary_species"))
40 {
41 }
42 
43 void
45 {
46  // Checking to see if there are secondary species to be added as AuxVariables
47  if (_pars.isParamValid("secondary_species"))
48  {
49  for (unsigned int i = 0; i < _secondary_species.size(); ++i)
50  {
51  FEType fe_type(Utility::string_to_enum<Order>(getParam<MooseEnum>("order")),
52  Utility::string_to_enum<FEFamily>(getParam<MooseEnum>("family")));
53 
54  _problem->addAuxVariable(_secondary_species[i], fe_type);
55  }
56  }
57 }
AddSecondarySpeciesAction(const InputParameters &params)
InputParameters validParams< AddSecondarySpeciesAction >()
const std::vector< AuxVariableName > _secondary_species