https://mooseframework.inl.gov
Loading...
Searching...
No Matches
AddAuxKernelAction.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#include "AddAuxKernelAction.h"
11#include "FEProblem.h"
12
13registerMooseAction("MooseApp", AddAuxKernelAction, "add_aux_kernel");
14
17{
19
20 // This is to help with input file validation. When AuxKernels are created with
21 // this action, they are nested underneath an AuxVariable in the input file - so
22 // we implicitly already know the variable name from this nesting and users
23 // don't need to specify it for us with the parameter. So we say here that
24 // the variable param is provided by the action.
25 params.set<std::vector<std::string>>("_object_params_set_by_action") = {"variable"};
26
27 return params;
28}
29
33
34void
36{
37 std::vector<std::string> elements;
38 MooseUtils::tokenize<std::string>(_pars.blockFullpath(), elements);
39
40 // The variable name will be the second to last element in the path name
41 std::string & var_name = elements[elements.size() - 2];
42 _moose_object_pars.set<AuxVariableName>("variable") = var_name;
43 _problem->addAuxKernel(_type, var_name, _moose_object_pars);
44}
registerMooseAction("MooseApp", AddAuxKernelAction, "add_aux_kernel")
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition Action.h:178
Action to add AuxKernel nested within an AuxVariable.
static InputParameters validParams()
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
AddAuxKernelAction(const InputParameters &params)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
std::string blockFullpath() const
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
const InputParameters & _pars
The object's parameters.
Definition MooseBase.h:384
InputParameters _moose_object_pars
The parameters for the object to be created.
static InputParameters validParams()
std::string _type
The Object type that is being created.