https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ResidualObject.h
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#pragma once
11
12#include "MooseObject.h"
13#include "SetupInterface.h"
14#include "FunctionInterface.h"
15#include "UserObjectInterface.h"
16#include "TransientInterface.h"
19#include "RandomInterface.h"
20#include "Restartable.h"
22#include "TaggingInterface.h"
23
24class FEProblemBase;
25class MooseMesh;
26class SubProblem;
27class Assembly;
30class InputParameters;
31class SystemBase;
32
37 public SetupInterface,
38 public FunctionInterface,
40 public TransientInterface,
43 public RandomInterface,
44 public Restartable,
46 public TaggingInterface
47{
48public:
50
56 ResidualObject(const InputParameters & parameters, bool nodal = false);
57
58#ifdef MOOSE_KOKKOS_ENABLED
62 ResidualObject(const ResidualObject & object, const Moose::Kokkos::FunctorCopy & key);
63#endif
64
66 virtual void computeResidual() = 0;
67
69 virtual void computeJacobian() = 0;
70
72 virtual void computeResidualAndJacobian();
73
82 virtual void computeOffDiagJacobian(unsigned int /*jvar*/) {}
83
88 virtual void computeOffDiagJacobianScalar(unsigned int /*jvar*/) {}
89
94 virtual void computeNonlocalJacobian() {}
95
99 virtual void computeNonlocalOffDiagJacobian(unsigned int /* jvar */) {}
100
104 virtual const MooseVariableBase & variable() const = 0;
105
109 const SubProblem & subProblem() const { return _subproblem; }
110
115 virtual void prepareShapes(unsigned int var_num);
116
121 virtual std::set<std::string> additionalROVariables() { return {}; }
122
123protected:
124 virtual void precalculateResidual() {}
125 virtual void precalculateJacobian() {}
126 virtual void precalculateOffDiagJacobian(unsigned int /* jvar */) {}
127
131 const MooseVariableFieldBase & getVariable(unsigned int jvar_num) const
132 {
133 return _sys.getVariable(_tid, jvar_num);
134 }
135
136protected:
139
142
145
148
151
154};
unsigned int THREAD_ID
Definition MooseTypes.h:237
Keeps track of stuff related to assembling.
Definition Assembly.h:110
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Interface for objects that need to use functions.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Interface for notifications that the mesh has changed.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
Base variable class.
This class provides an interface for common operations on field variables of both FE and FV types wit...
Interface class for classes which interact with Postprocessors.
Interface for objects that need parallel consistent random numbers without patterns over the course o...
This is the common base class for objects that give residual contributions.
THREAD_ID _tid
The thread ID for this kernel.
const SubProblem & subProblem() const
Returns a reference to the SubProblem for which this Kernel is active.
virtual void prepareShapes(unsigned int var_num)
Prepare shape functions.
virtual void precalculateJacobian()
static InputParameters validParams()
MooseMesh & _mesh
Reference to this Kernel's mesh object.
virtual void computeNonlocalOffDiagJacobian(unsigned int)
Computes Jacobian entries corresponding to nonlocal dofs of the jvar.
virtual const MooseVariableBase & variable() const =0
Returns the variable that this object operates on.
virtual void computeResidualAndJacobian()
Compute this object's contribution to the residual and Jacobian simultaneously.
Assembly & _assembly
Reference to this Kernel's assembly object.
virtual void computeResidual()=0
Compute this object's contribution to the residual.
virtual std::set< std::string > additionalROVariables()
virtual void computeOffDiagJacobian(unsigned int)
Computes this object's contribution to off-diagonal blocks of the system Jacobian matrix.
virtual void computeNonlocalJacobian()
Compute this object's contribution to the diagonal Jacobian entries corresponding to nonlocal dofs of...
virtual void computeJacobian()=0
Compute this object's contribution to the diagonal Jacobian entries.
const MooseVariableFieldBase & getVariable(unsigned int jvar_num) const
Retrieve the variable object from our system associated with jvar_num.
virtual void computeOffDiagJacobianScalar(unsigned int)
Computes jacobian block with respect to a scalar variable.
SubProblem & _subproblem
Reference to this kernel's SubProblem.
SystemBase & _sys
Reference to the EquationSystem object.
virtual void precalculateOffDiagJacobian(unsigned int)
virtual void precalculateResidual()
FEProblemBase & _fe_problem
Reference to this kernel's FEProblemBase.
A class for creating restricted objects.
Definition Restartable.h:29
Generic class for solving transient nonlinear problems.
Definition SubProblem.h:79
Base class for a system (of equations)
Definition SystemBase.h:87
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a variable of with specified name.
Definition SystemBase.C:91
Interface for objects that needs transient capabilities.
Interface for objects that need to use UserObjects.