ScalarKernels System
Scalar kernels are used to define systems of ordinary differential equations (ODEs), which lack spatial derivatives. These are used in initial value problems, with time as the independent variable: where is the dependent variable, is the steady-state residual function, and is the initial value.
Similar to the Kernel class, in a ScalarKernel
subclass the computeResidual()
function must be overridden. This is where you implement your ODE weak form terms. For non-AD objects the following member function can optionally be overridden:
computeJacobian()
computeOffDiagJacobianScalar()
Coupling with Spatial Variables
For systems of coupled partial differential equations (PDEs) and ODEs, typically integration over domains and manifolds are needed within the coupling terms of the weak form. Since the ScalarKernel
class does not provide for integration over elements or faces, there are two options for performing needed integration using other object classes:
Compute integrals for residual and diagonal Jacobian entries of the scalar variable within a
UserObject
and connect that value into theScalarKernel
object. Cross Jacobian terms that couple the scalar and spatial variables need to be handled by overridden assembly routines that access upper and lower triangular blocks of the Jacobian concurrently. An example of this approach is provided in the AverageValueConstraint and the ScalarLagrangeMultiplier objects, respectively.Compute all integrals for the residual and Jacobian entries for the spatial and scalar variables using scalar augmentation classes that derive from the respective spatial variable residual object class. This approach is described below.
The principal purpose of these scalar augmentation classes is to add standard quadrature loops and assembly routines to handle the contributions from a single added scalar variable to that object, including the entire row of the Jacobian. This scalar variable is referred to as the "focus" scalar variable of that object. Lists of interfaces for the quadrature point routines are given in the links below. This system is currently being developed and will extend to the other residual objects.
Object | Scalar Augmentation Class | Example Derived Class |
---|---|---|
Kernel ADKernel | KernelScalarBase | ScalarLMKernel |
IntegratedBC | Under Development | |
InterfaceKernel | Under Development | |
DGKernel | Under Development | |
MortarConstraint ADMortarConstraint | MortarScalarBase | PeriodicSegmentalConstraint |
Automatic Differentiation
Scalar kernels have the ability to be implemented with automatic differentiation (AD). While AD is not necessary for systems of ordinary differential equations (ODEs) involving only scalar variables (due to the exact Jacobians offered by ParsedODEKernel, for example), ODEs involving contributions from field variables greatly benefit from AD. For example, an elemental user object may compute an ADReal
value from field variable(s) on a domain, which then may be used in a scalar equation.
To create an AD scalar kernel, derive from ADScalarKernel
and implement the method computeQpResidual()
.
ADScalarKernel
only works with MOOSE configured with global AD indexing (the default).
As a caution, if using user objects to compute ADReal
values, be sure to execute those user objects on NONLINEAR
to ensure the derivatives in the ADReal
value are populated.
Available Objects
- Moose App
- ADScalarTimeDerivativeAdds the time derivative contribution to the residual for a scalar variable.
- AverageValueConstraintThis class is used to enforce integral of phi with a Lagrange multiplier approach.
- CoupledODETimeDerivativeResidual contribution of ODE from the time derivative of a coupled variable.
- NodalEqualValueConstraintConstrain two nodes to have identical values.
- NullScalarKernelScalar kernel that sets a zero residual, to avoid error from system missing this variable.
- ODETimeDerivativeReturns the time derivative contribution to the residual for a scalar variable.
- ParsedODEKernelParsed expression ODE kernel.
- Crane App
- EnergyTermScalar
- LogStabilizationScalar
- ODETimeDerivativeLog
- ODETimeDerivativeTemperature
- ParsedScalarReactionParsed expression ODE kernel.
- Product1BodyScalar
- Product1BodyScalarLog
- Product2BodyScalar
- Product2BodyScalarLog
- Product3BodyScalar
- Product3BodyScalarLog
- Reactant1BodyScalar
- Reactant1BodyScalarLog
- Reactant2BodyScalar
- Reactant2BodyScalarLog
- Reactant3BodyScalar
- Reactant3BodyScalarLog
- ScalarDiffusion
Available Actions
- Moose App
- AddScalarKernelActionAdd a AuxScalarKernel object to the simulation.