https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
17registerMooseAction("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
33
34void
36{
37 _moose_object_pars.set<MooseEnum>("order") = "CONSTANT";
38 _moose_object_pars.set<MooseEnum>("family") = "MONOMIAL";
39
40 _fe_type = libMesh::FEType(CONSTANT, MONOMIAL);
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 &)>(
50}
51
52void
54{
55 init();
56
57 std::string variable = name();
58 addVariable(variable);
59}
registerMooseAction("MooseApp", AddElementalFieldAction, "add_elemental_field_variable")
AddElementalFieldAction(const InputParameters &params)
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
static InputParameters validParams()
void init() override
Initialize the action's member variables.
Adds nonlinear variable.
std::function< void(FEProblemBase &, const std::string &, const std::string &, InputParameters &)> _problem_add_var_method
libMesh::FEType _fe_type
FEType for the variable being created.
static InputParameters validParams()
bool _scalar_var
True if the variable being created is a scalar.
void addVariable(const std::string &var_name)
Adds a nonlinear variable to the system.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual void addElementalFieldVariable(const std::string &var_type, const std::string &var_name, InputParameters &params)
Add an elemental field variable for use in the adaptivity system.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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...
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.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
InputParameters _moose_object_pars
The parameters for the object to be created.
std::string _type
The Object type that is being created.