20 #include "libmesh/string_to_enum.h" 28 params.
addParam<std::vector<NonlinearVariableName>>(
29 "show_var_residual", {},
"Variables for which residuals will be sent to the output file.");
31 "Adds the necessary objects for computing the residuals for individual variables.");
37 _show_var_residual(getParam<
std::vector<NonlinearVariableName>>(
"show_var_residual"))
62 auto fe_type = var.
feType();
63 order = Utility::enum_to_string<Order>(fe_type.order);
64 family = Utility::enum_to_string(fe_type.family);
69 std::stringstream aux_var_ss;
70 aux_var_ss <<
"residual_" << var.
name();
71 std::string aux_var_name = aux_var_ss.str();
75 var_params.set<
MooseEnum>(
"order") = order;
77 if (subdomains.empty())
78 _problem->addAuxVariable(
"MooseVariable", aux_var_name, var_params);
81 std::vector<SubdomainName> block_names;
82 block_names.reserve(subdomains.size());
85 params.
set<std::vector<SubdomainName>>(
"block") = block_names;
86 var_params.set<std::vector<SubdomainName>>(
"block") = block_names;
88 _problem->addAuxVariable(
"MooseVariable", aux_var_name, var_params);
92 std::stringstream kern_ss;
93 kern_ss <<
"residual_" << var.
name() <<
"_kernel";
94 std::string kern_name = kern_ss.str();
96 params.
set<AuxVariableName>(
"variable") = aux_var_name;
97 params.
set<NonlinearVariableName>(
"debug_variable") = var.
name();
99 _problem->addAuxKernel(
"DebugResidualAux", kern_name, params);
static InputParameters validParams()
const libMesh::FEType & feType() const
Get the type of finite element object.
A MultiMooseEnum object to hold "execute_on" flags.
SetupResidualDebugAction(const InputParameters ¶meters)
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
const std::string & name() const override
Get the variable name.
This class provides an interface for common operations on field variables of both FE and FV types wit...
const ExecFlagType EXEC_TIMESTEP_END
registerMooseAction("MooseApp", SetupResidualDebugAction, "setup_residual_debug")
static MooseEnum getNonlinearVariableFamilies()
Get the possible variable families.
Factory & _factory
The Factory associated with the MooseApp.
std::vector< NonlinearVariableName > _show_var_residual
static InputParameters validParams()
static MooseEnum getNonlinearVariableOrders()
Get the possible variable orders.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
unsigned int number() const
Gets the number of this system.
const ExecFlagType EXEC_LINEAR
std::string stringify(const T &t)
conversion to string
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
const std::set< SubdomainID > & activeSubdomains() const
The subdomains the variable is active on.
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
SystemBase & sys()
Get the system this variable is part of.