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