www.mooseframework.org
AddPrimarySpeciesAction.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 "AddVariableAction.h"
9 #include "FEProblem.h"
10 #include "Factory.h"
11 
12 #include "libmesh/string_to_enum.h"
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<Action>();
19  params.addRequiredParam<std::vector<NonlinearVariableName>>(
20  "primary_species", "The list of primary variables to add");
21  // Get MooseEnums for the possible order/family options for this variable
22  MooseEnum families(AddVariableAction::getNonlinearVariableFamilies());
23  MooseEnum orders(AddVariableAction::getNonlinearVariableOrders());
24  params.addParam<MooseEnum>("family",
25  families,
26  "Specifies the family of FE "
27  "shape function to use for the order parameters");
28  params.addParam<MooseEnum>("order",
29  orders,
30  "Specifies the order of the FE "
31  "shape function to use for the order parameters");
32  params.addParam<Real>("scaling", 1.0, "Specifies a scaling factor to apply to this variable");
33  params.addClassDescription("Adds Variables for all primary species");
34  return params;
35 }
36 
37 AddPrimarySpeciesAction::AddPrimarySpeciesAction(const InputParameters & params)
38  : Action(params), _vars(getParam<std::vector<NonlinearVariableName>>("primary_species"))
39 {
40 }
41 
42 void
44 {
45  for (unsigned int i = 0; i < _vars.size(); ++i)
46  {
47  FEType fe_type(Utility::string_to_enum<Order>(getParam<MooseEnum>("order")),
48  Utility::string_to_enum<FEFamily>(getParam<MooseEnum>("family")));
49 
50  _problem->addVariable(_vars[i], fe_type, getParam<Real>("scaling"));
51  }
52 }
AddPrimarySpeciesAction(const InputParameters &params)
const std::vector< NonlinearVariableName > _vars
virtual void act() override
InputParameters validParams< AddPrimarySpeciesAction >()