https://mooseframework.inl.gov
ScalarKernelBase.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 "ScalarKernelBase.h"
11 #include "Assembly.h"
12 #include "MooseVariableScalar.h"
13 #include "MooseVariableFE.h"
14 #include "Problem.h"
15 #include "SubProblem.h"
16 #include "NonlinearSystem.h"
17 
20 {
22  params.addParam<bool>("use_displaced_mesh",
23  false,
24  "Whether or not this object should use the "
25  "displaced mesh for computation. Note that "
26  "in the case this is true but no "
27  "displacements are provided in the Mesh block "
28  "the undisplaced mesh will still be used.");
29  params.addParamNamesToGroup("use_displaced_mesh", "Advanced");
30 
31  params.registerBase("ScalarKernel");
32  params.registerSystemAttributeName("ScalarKernel");
33 
34  return params;
35 }
36 
38  : ResidualObject(parameters),
39  ScalarCoupleable(this),
40  _var(_sys.getScalarVariable(_tid, parameters.get<NonlinearVariableName>("variable")))
41 {
42 }
43 
44 const VariableValue &
46 {
48  mooseError("The solution states have already been initialized when calling ",
49  type(),
50  "::uOld().\n\n",
51  "Make sure to call uOld() within the object constructor.");
52 
53  return _var.slnOld();
54 }
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Definition: MooseUtils.h:1155
void registerSystemAttributeName(const std::string &value)
This method is used to define the MOOSE system name that is used by the TheWarehouse object for stori...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
MooseVariableScalar & _var
Scalar variable.
bool solutionStatesInitialized() const
Whether or not the solution states have been initialized via initSolutionState()
Definition: SystemBase.h:897
SystemBase & _sys
Reference to the EquationSystem object.
void registerBase(const std::string &value)
This method must be called from every base "Moose System" to create linkage with the Action System...
const VariableValue & slnOld() const
ScalarKernelBase(const InputParameters &parameters)
const VariableValue & uOld() const
Retrieves the old value of the variable that this ScalarKernelBase operates on.
const std::string & type() const
Get the type of this class.
Definition: MooseBase.h:51
static InputParameters validParams()
OutputTools< Real >::VariableValue VariableValue
Definition: MooseTypes.h:314
This is the common base class for objects that give residual contributions.
Interface for objects that needs scalar coupling capabilities.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
static InputParameters validParams()
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...