https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ArrayCoupledTimeDerivative.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
11
13
16{
19 "Time derivative Array Kernel that acts on a coupled variable. Weak form: "
20 "$(\\psi_i, \\frac{\\partial v_h}{\\partial t})$. The coupled variable and "
21 "the variable must have the same dimensionality");
22 params.addRequiredCoupledVar("v", "Coupled variable");
23 return params;
24}
25
27 : ArrayKernel(parameters),
28 _v_dot(coupledArrayDot("v")),
29 _dv_dot(coupledArrayDotDu("v")),
30 _v_var(coupled("v"))
31{
32}
33
34void
36{
37 mooseAssert(_var.count() == _v_dot.size(),
38 "The variable and coupled variable have unequal sizes:\n variable size : " +
39 std::to_string(_var.count()) + "\n" +
40 " coupled variable size: " + std::to_string(_v_dot.size()));
41
42 residual = _test[_i][_qp] * _v_dot[_qp];
43}
44
45RealEigenVector
47{
48 return RealEigenVector::Zero(_var.count());
49}
50
51RealEigenMatrix
53{
54 if (jvar.number() == _v_var)
55 return _test[_i][_qp] * _phi[_j][_qp] * _dv_dot[_qp] *
56 RealEigenVector::Ones(jvar.count()).asDiagonal();
57
58 return RealEigenMatrix::Zero(_var.count(), jvar.count());
59}
registerMooseObject("MooseApp", ArrayCoupledTimeDerivative)
This calculates the time derivative for a coupled variable.
const ArrayVariableValue & _v_dot
The first temporal derivative of the coupled variable.
virtual void computeQpResidual(RealEigenVector &residual) override
Compute this Kernel's contribution to the residual at the current quadrature point,...
virtual RealEigenMatrix computeQpOffDiagJacobian(const MooseVariableFEBase &jvar) override
This is the virtual that derived classes should override for computing a full Jacobian component.
ArrayCoupledTimeDerivative(const InputParameters &parameters)
const unsigned int _v_var
The number of the coupled variable.
static InputParameters validParams()
virtual RealEigenVector computeQpJacobian() override
Compute this Kernel's contribution to the diagonal Jacobian at the current quadrature point.
const VariableValue & _dv_dot
The Jacobian of the time derivative of the coupled variable with respect to the coupled variable.
const ArrayVariableTestValue & _test
the current test function
Definition ArrayKernel.h:88
static InputParameters validParams()
Definition ArrayKernel.C:23
ArrayMooseVariable & _var
This is an array kernel so we cast to a ArrayMooseVariable.
Definition ArrayKernel.h:85
const ArrayVariablePhiValue & _phi
the current shape functions
Definition ArrayKernel.h:95
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
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 _qp
The current quadrature point index.
Definition KernelBase.h:43
unsigned int _j
current index for the shape function
Definition KernelBase.h:61
unsigned int _i
current index for the test function
Definition KernelBase.h:58
unsigned int number() const
Get variable number coming from libMesh.
unsigned int count() const
Get the number of components Note: For standard and vector variables, the number is one.
This class provides an interface for common operations on field variables of both FE and FV types wit...