www.mooseframework.org
TopResidualDebugOutput.h
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 #pragma once
11 
12 // MOOSE includes
13 #include "PetscOutput.h"
14 
15 #include "libmesh/system.h"
16 
18 
24 {
25  unsigned int _var;
26  std::set<SubdomainID> _subdomain_ids;
28  Point _point;
30  bool _is_scalar;
31  bool _is_nodal;
32 
34  : _var(0),
36  _id(0),
37  _point(Point()),
38  _residual(0.),
39  _is_scalar(false),
40  _is_nodal(true)
41  {
42  }
43 
45  std::set<SubdomainID> subdomain_ids,
46  dof_id_type id,
47  Point point,
48  Real residual,
49  bool is_scalar = false,
50  bool is_nodal = true)
51  : _var(var),
52  _subdomain_ids(subdomain_ids),
53  _id(id),
54  _point(point),
55  _residual(residual),
56  _is_scalar(is_scalar),
57  _is_nodal(is_nodal)
58  {
59  }
60 };
61 
73 {
74 public:
76 
82 
83 protected:
87  virtual void output() override;
88 
94  void printTopResiduals(const NumericVector<Number> & residual, unsigned int n);
95 
102  {
103  return (fabs(i._residual) > fabs(j._residual));
104  }
105 
107  unsigned int _num_residuals;
108 
111 
113  System & _sys;
114 };
static bool sortTopResidualData(TopResidualDebugOutputTopResidualData i, TopResidualDebugOutputTopResidualData j)
Method for sorting the residuals data from TopResidualDebugOutputTopResidualData structs.
static InputParameters validParams()
void printTopResiduals(const NumericVector< Number > &residual, unsigned int n)
Prints the n top residuals for the variables in the system.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
A class for producing various debug related outputs.
System & _sys
Reference to libMesh system.
TopResidualDebugOutputTopResidualData(unsigned int var, std::set< SubdomainID > subdomain_ids, dof_id_type id, Point point, Real residual, bool is_scalar=false, bool is_nodal=true)
Nonlinear system to be solved.
virtual void output() override
Perform the debugging output.
A structure for storing data related to top residuals.
TopResidualDebugOutput(const InputParameters &parameters)
Class constructor.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const InputParameters & parameters() const
Get the parameters of the object.
Adds the ability to output on every nonlinear and/or linear residual.
Definition: PetscOutput.h:41
unsigned int _num_residuals
Number of residuals to display.
uint8_t dof_id_type
NonlinearSystemBase & _nl
Reference to MOOSE&#39;s nonlinear system.