Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
AddElementalFieldAction.C
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 // MOOSE includes
12 #include "FEProblem.h"
13 #include "MooseMesh.h"
14 
15 #include "libmesh/fe.h"
16 
17 registerMooseAction("MooseApp", AddElementalFieldAction, "add_elemental_field_variable");
18 
21 {
23  params.addClassDescription("Adds elemental auxiliary variable for adaptivity system.");
24  params.ignoreParameter<std::string>("type");
25 
26  return params;
27 }
28 
30  : AddVariableAction(params)
31 {
32 }
33 
34 void
36 {
37  _moose_object_pars.set<MooseEnum>("order") = "CONSTANT";
38  _moose_object_pars.set<MooseEnum>("family") = "MONOMIAL";
39 
41 
42  _type = "MooseVariableConstMonomial";
43 
44  _scalar_var = false;
45 
46  // Need static_cast to resolve overloads
47  _problem_add_var_method = static_cast<void (FEProblemBase::*)(
48  const std::string &, const std::string &, InputParameters &)>(&FEProblemBase::addAuxVariable);
49 }
50 
51 void
53 {
54  init();
55 
56  std::string variable = name();
57  addVariable(variable);
58 }
registerMooseAction("MooseApp", AddElementalFieldAction, "add_elemental_field_variable")
static InputParameters validParams()
bool _scalar_var
True if the variable being created is a scalar.
Adds nonlinear variable.
void init() override
Initialize the action&#39;s member variables.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
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.
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
libMesh::FEType _fe_type
FEType for the variable being created.
CONSTANT
void ignoreParameter(const std::string &name)
Informs this object that values for this parameter set from the input file or from the command line s...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
MONOMIAL
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
std::string _type
The Object type that is being created.
AddElementalFieldAction(const InputParameters &params)
InputParameters _moose_object_pars
The parameters for the object to be created.
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...
void addVariable(const std::string &var_name)
Adds a nonlinear variable to the system.
static InputParameters validParams()
std::function< void(FEProblemBase &, const std::string &, const std::string &, InputParameters &)> _problem_add_var_method