https://mooseframework.inl.gov
Loading...
Searching...
No Matches
VariableResidual.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 "VariableResidual.h"
11
12// MOOSE includes
13#include "MooseVariable.h"
14#include "NonlinearSystemBase.h"
15
16// libMesh includes
17#include "libmesh/enum_norm_type.h"
18
20
23{
25 params.addRequiredParam<VariableName>("variable",
26 "The name of the variable to compute the residual for");
27
29 "Computes the L2 norm of the residual of a single variable in the solution vector.");
30 return params;
31}
32
34 : GeneralPostprocessor(parameters),
35 _var(_fe_problem.getVariable(_tid,
36 getParam<VariableName>("variable"),
37 Moose::VarKindType::VAR_SOLVER,
38 Moose::VarFieldType::VAR_FIELD_STANDARD))
39{
41 "VariableResidual is deprecated. Please use DiscreteVariableResidualNorm instead.");
42}
43
44void
49
50void
56
59{
60 return _var_residual;
61}
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition MooseError.h:363
Real PostprocessorValue
various MOOSE typedefs
Definition MooseTypes.h:230
registerMooseObject("MooseApp", VariableResidual)
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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...
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.
unsigned int number() const
Get variable number coming from libMesh.
Nonlinear system to be solved.
virtual NumericVector< Number > & RHS()=0
virtual libMesh::System & system() override
Get the reference to the libMesh system.
unsigned int number() const
Gets the number of this system.
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
SystemBase & _sys
Reference to the system object for this user object.
Real _var_residual
The residual of the variable.
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
MooseVariableFEBase & _var
MOOSE variable we compute the residual for.
virtual PostprocessorValue getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
virtual void execute() override
Execute method.
VariableResidual(const InputParameters &parameters)
static InputParameters validParams()
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...