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 
15 template <>
18 {
20  params.addRequiredParam<NonlinearVariableName>("debug_variable",
21  "The variable that is being debugged.");
22  return params;
23 }
24 
26  : AuxKernel(parameters),
27  _debug_var(_nl_sys.getVariable(_tid, getParam<NonlinearVariableName>("debug_variable"))),
28  _residual_copy(_nl_sys.residualGhosted())
29 {
30  if (!_nodal)
31  mooseError("Cannot use DebugResidualAux on elemental variables");
32 }
33 
34 Real
36 {
37  dof_id_type dof = _current_node->dof_number(_nl_sys.number(), _debug_var.number(), 0);
38  return _residual_copy(dof);
39 }
MooseVariableFEBase & _debug_var
bool _nodal
Flag indicating if the AuxKernel is nodal.
Definition: AuxKernel.h:170
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:213
Auxiliary kernel for debugging convergence.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void mooseError(Args &&... args) const
Definition: MooseObject.h:147
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...
SystemBase & _nl_sys
Definition: AuxKernel.h:160
InputParameters validParams< AuxKernel >()
Definition: AuxKernel.C:25
virtual Real computeValue() override
Compute and return the value of the aux variable.
virtual unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:926
DebugResidualAux(const InputParameters &parameters)
InputParameters validParams< DebugResidualAux >()
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition: AuxKernel.h:33