www.mooseframework.org
DebugResidualAux.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "DebugResidualAux.h"
11 #include "NonlinearSystem.h"
12 
14 
17 {
19  params.addClassDescription(
20  "Populate an auxiliary variable with the residual contribution of a variable.");
21  params.addRequiredParam<NonlinearVariableName>("debug_variable",
22  "The variable that is being debugged.");
23  return params;
24 }
25 
27  : AuxKernel(parameters),
28  _debug_var(_nl_sys.getVariable(_tid, getParam<NonlinearVariableName>("debug_variable"))),
29  _residual_copy(_nl_sys.residualGhosted())
30 {
31 }
32 
33 Real
35 {
36  if (_nodal)
37  {
38  dof_id_type dof = _current_node->dof_number(_nl_sys.number(), _debug_var.number(), 0);
39  return _residual_copy(dof);
40  }
41  else
42  {
43  dof_id_type dof = _current_elem->dof_number(_nl_sys.number(), _debug_var.number(), 0);
44  return _residual_copy(dof);
45  }
46 }
MooseVariableFEBase & _debug_var
bool _nodal
Flag indicating if the AuxKernel is nodal.
Definition: AuxKernel.h:177
NumericVector< Number > & _residual_copy
unsigned int number() const
Get variable number coming from libMesh.
const Node *const & _current_node
Current node (valid only for nodal kernels)
Definition: AuxKernel.h:214
Auxiliary kernel for debugging convergence.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
registerMooseObject("MooseApp", DebugResidualAux)
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
static InputParameters validParams()
SystemBase & _nl_sys
Definition: AuxKernel.h:167
virtual Real computeValue() override
Compute and return the value of the aux variable.
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1125
DebugResidualAux(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Elem *const & _current_elem
Current element (valid only for elemental kernels)
Definition: AuxKernel.h:204
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...
static InputParameters validParams()
Definition: AuxKernel.C:27
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition: AuxKernel.h:36
uint8_t dof_id_type