https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ResidualObject.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 "ResidualObject.h"
11#include "FEProblemBase.h"
12#include "InputParameters.h"
13
16{
17 auto params = MooseObject::validParams();
22
23 params.addRequiredParam<NonlinearVariableName>(
24 "variable", "The name of the variable that this residual object operates on");
25
26 params.declareControllable("enable");
27 params.set<bool>("_residual_object") = true;
28 return params;
29}
30
31ResidualObject::ResidualObject(const InputParameters & parameters, bool is_nodal)
32 : MooseObject(parameters),
33 SetupInterface(this),
38 // VPPs used by ScalarKernels must be broadcast because we don't know where the
39 // ScalarKernel will end up being evaluated
40 // Note: residual objects should have a valid _moose_base.
41 VectorPostprocessorInterface(this, getBase() == "ScalarKernel"),
42 RandomInterface(parameters,
43 *parameters.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base"),
44 parameters.get<THREAD_ID>("_tid"),
45 is_nodal),
46 Restartable(this, getBase() + "s"),
47 MeshChangedInterface(parameters),
48 TaggingInterface(this),
49 _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
50 _fe_problem(*parameters.get<FEProblemBase *>("_fe_problem_base")),
51 _sys(*getCheckedPointerParam<SystemBase *>("_sys")),
52 _tid(parameters.get<THREAD_ID>("_tid")),
53 _assembly(_subproblem.assembly(_tid, _sys.number())),
54 _mesh(_subproblem.mesh())
55{
56}
57
58#ifdef MOOSE_KOKKOS_ENABLED
61 : MooseObject(object, key),
62 SetupInterface(object, key),
63 FunctionInterface(object, key),
64 UserObjectInterface(object, key),
65 TransientInterface(object, key),
66 PostprocessorInterface(object, key),
68 RandomInterface(object, key),
69 Restartable(object, key),
70 MeshChangedInterface(object, key),
71 TaggingInterface(object, key),
72 _subproblem(object._subproblem),
73 _fe_problem(object._fe_problem),
74 _sys(object._sys),
75 _tid(object._tid),
76 _assembly(object._assembly),
77 _mesh(object._mesh)
78{
79}
80#endif
81
82void
83ResidualObject::prepareShapes(const unsigned int var_num)
84{
86}
87
88void
90{
92 "This object has not yet implemented 'computeResidualAndJacobian'. If you would like that "
93 "feature for this object, please contact a MOOSE developer.");
94}
unsigned int THREAD_ID
Definition MooseTypes.h:237
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.
static InputParameters validParams()
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition MooseBase.h:271
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
static InputParameters validParams()
Definition MooseObject.C:25
Interface class for classes which interact with Postprocessors.
Interface for objects that need parallel consistent random numbers without patterns over the course o...
static InputParameters validParams()
This is the common base class for objects that give residual contributions.
THREAD_ID _tid
The thread ID for this kernel.
virtual void prepareShapes(unsigned int var_num)
Prepare shape functions.
static InputParameters validParams()
virtual void computeResidualAndJacobian()
Compute this object's contribution to the residual and Jacobian simultaneously.
ResidualObject(const InputParameters &parameters, bool nodal=false)
Class constructor.
SubProblem & _subproblem
Reference to this kernel's SubProblem.
A class for creating restricted objects.
Definition Restartable.h:29
Generic class for solving transient nonlinear problems.
Definition SubProblem.h:79
virtual void prepareShapes(unsigned int var, const THREAD_ID tid)=0
Base class for a system (of equations)
Definition SystemBase.h:87
static InputParameters validParams()
Interface for objects that needs transient capabilities.
static InputParameters validParams()
Interface for objects that need to use UserObjects.
MeshBase & mesh