https://mooseframework.inl.gov
AddVariableAction.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 #pragma once
11 
12 #include "MooseObjectAction.h"
13 
14 #include "libmesh/fe_type.h"
15 
20 {
21 public:
23 
24  AddVariableAction(const InputParameters & params);
25 
26  virtual void act() override;
27 
33 
39 
43  static libMesh::FEType feType(const InputParameters & params);
44 
48  static std::string
49  determineType(const libMesh::FEType & fe_type, unsigned int components, bool is_fv = false);
50 
57  static std::string variableType(const libMesh::FEType & fe_type,
58  const bool is_fv = false,
59  const bool is_array = false);
60 
61 protected:
65  virtual void init();
66 
72  void addVariable(const std::string & var_name);
73 
77  virtual std::string varName() const { return _name; }
78 
85  void createInitialConditionAction(const std::vector<Real> & value);
86 
91  std::set<SubdomainID> getSubdomainIDs();
92 
95 
98 
100  bool _fv_var;
101 
103  unsigned int _components;
104 
105  std::function<void(FEProblemBase &, const std::string &, const std::string &, InputParameters &)>
107 };
static InputParameters validParams()
std::set< SubdomainID > getSubdomainIDs()
Get the block ids from the input parameters.
virtual std::string varName() const
Return the name of the nonlinear variable to be created.
bool _scalar_var
True if the variable being created is a scalar.
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
Adds nonlinear variable.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static MooseEnum getNonlinearVariableFamilies()
Get the possible variable families.
libMesh::FEType _fe_type
FEType for the variable being created.
bool _fv_var
True if the variable being created is finite volume.
static MooseEnum getNonlinearVariableOrders()
Get the possible variable orders.
unsigned int _components
Number of components for an array variable.
void createInitialConditionAction(const std::vector< Real > &value)
Create the action to generate the InitialCondition object.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
static std::string variableType(const libMesh::FEType &fe_type, const bool is_fv=false, const bool is_array=false)
Determines a variable type.
const std::string _name
The name of this class.
Definition: MooseBase.h:90
static libMesh::FEType feType(const InputParameters &params)
determine the FEType by examining family and order in the provided parameters
virtual void init()
Initialize the action&#39;s member variables.
void addVariable(const std::string &var_name)
Adds a nonlinear variable to the system.
AddVariableAction(const InputParameters &params)
static std::string determineType(const libMesh::FEType &fe_type, unsigned int components, bool is_fv=false)
DEPRECATED: Use variableType instead.
std::function< void(FEProblemBase &, const std::string &, const std::string &, InputParameters &)> _problem_add_var_method