www.mooseframework.org
HHPFCRFFSplitVariablesAction.C
Go to the documentation of this file.
2 #include "Factory.h"
3 #include "FEProblem.h"
4 #include "Conversion.h"
5 #include "AddVariableAction.h"
6 
7 #include "libmesh/string_to_enum.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<Action>();
14  MooseEnum familyEnum = AddVariableAction::getNonlinearVariableFamilies();
15  params.addParam<MooseEnum>(
16  "family",
17  familyEnum,
18  "Specifies the family of FE shape functions to use for the L variables");
19  MooseEnum orderEnum = AddVariableAction::getNonlinearVariableOrders();
20  params.addParam<MooseEnum>(
21  "order",
22  orderEnum,
23  "Specifies the order of the FE shape function to use for the L variables");
24  params.addParam<Real>("scaling", 1.0, "Specifies a scaling factor to apply to the L variables");
25  params.addRequiredParam<unsigned int>(
26  "num_L", "specifies the number of complex L variables will be solved for");
27  params.addRequiredParam<std::string>("L_name_base", "Base name for the complex L variables");
28 
29  return params;
30 }
31 
33  : Action(params),
34  _num_L(getParam<unsigned int>("num_L")),
35  _L_name_base(getParam<std::string>("L_name_base"))
36 {
37 }
38 
39 void
41 {
42 #ifdef DEBUG
43  Moose::err << "Inside the HHPFCRFFSplitVariablesAction Object\n";
44  Moose::err << "VariableBase: " << _L_name_base << "\torder: " << getParam<MooseEnum>("order")
45  << "\tfamily: " << getParam<MooseEnum>("family") << std::endl;
46 #endif
47 
48  // Loop through the number of L variables
49  for (unsigned int l = 0; l < _num_L; ++l)
50  {
51  // Create L base name
52  std::string L_name = _L_name_base + Moose::stringify(l);
53 
54  // Create real L variable
55  std::string real_name = L_name + "_real";
56 
57  _problem->addVariable(real_name,
58  FEType(Utility::string_to_enum<Order>(getParam<MooseEnum>("order")),
59  Utility::string_to_enum<FEFamily>(getParam<MooseEnum>("family"))),
60  getParam<Real>("scaling"));
61 
62  if (l > 0)
63  {
64  // Create imaginary L variable IF l > 0
65  std::string imag_name = L_name + "_imag";
66 
67  _problem->addVariable(
68  imag_name,
69  FEType(Utility::string_to_enum<Order>(getParam<MooseEnum>("order")),
70  Utility::string_to_enum<FEFamily>(getParam<MooseEnum>("family"))),
71  getParam<Real>("scaling"));
72  }
73  }
74 }
HHPFCRFFSplitVariablesAction(const InputParameters &params)
InputParameters validParams< HHPFCRFFSplitVariablesAction >()