www.mooseframework.org
AddAuxVariableAction.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "AddAuxVariableAction.h"
11 #include "FEProblem.h"
12 
13 registerMooseAction("MooseApp", AddAuxVariableAction, "add_aux_variable");
14 
17 {
19  params.addClassDescription("Add auxiliary variable to the simulation.");
20  return params;
21 }
22 
24  : AddVariableAction(params)
25 {
26 }
27 
30 {
31  return MooseEnum("LAGRANGE MONOMIAL SCALAR LAGRANGE_VEC MONOMIAL_VEC", "LAGRANGE", true);
32 }
33 
36 {
37  return MooseEnum(
38  "CONSTANT FIRST SECOND THIRD FOURTH FIFTH SIXTH SEVENTH EIGHTH NINTH", "FIRST", true);
39 }
40 
41 void
43 {
45 
46  if (_fe_type.order > NINTH && !_scalar_var)
47  mooseError("Non-scalar AuxVariables must be CONSTANT, FIRST, SECOND, THIRD, FOURTH, FIFTH, "
48  "SIXTH, SEVENTH, EIGHTH or NINTH order (",
49  _fe_type.order,
50  " supplied)");
51 
52  // Need static_cast to resolve overloads
53  _problem_add_var_method = static_cast<void (FEProblemBase::*)(
54  const std::string &, const std::string &, InputParameters &)>(&FEProblemBase::addAuxVariable);
55 }
static InputParameters validParams()
Class constructor.
bool _scalar_var
True if the variable being created is a scalar.
Adds nonlinear variable.
AddAuxVariableAction(const InputParameters &params)
void init() override
Initialize the action&#39;s member variables.
static MooseEnum getAuxVariableFamilies()
Returns available families for AuxVariables.
FEType _fe_type
FEType for the variable being created.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void addAuxVariable(const std::string &var_type, const std::string &var_name, InputParameters &params)
Canonical method for adding an auxiliary variable.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Action for creating Auxiliary variables.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
NINTH
static MooseEnum getAuxVariableOrders()
Returns available orders for AuxVariables.
virtual void init()
Initialize the action&#39;s member variables.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
static InputParameters validParams()
Class constructor.
registerMooseAction("MooseApp", AddAuxVariableAction, "add_aux_variable")
std::function< void(FEProblemBase &, const std::string &, const std::string &, InputParameters &)> _problem_add_var_method