www.mooseframework.org
TimeKernel.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "TimeKernel.h"
11 
12 // MOOSE includes
13 #include "Assembly.h"
14 #include "MooseVariableFE.h"
15 #include "SystemBase.h"
16 
17 #include "libmesh/quadrature.h"
18 
19 template <>
22 {
24 
25  params.set<MultiMooseEnum>("vector_tags") = "time";
26  params.set<MultiMooseEnum>("matrix_tags") = "system time";
27 
28  return params;
29 }
30 
32  : Kernel(parameters), _u_dot(_var.uDot()), _du_dot_du(_var.duDotDu())
33 {
34 }
35 
36 void
38 {
40 
42  for (_i = 0; _i < _test.size(); _i++)
43  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
45 
47 
48  if (_has_save_in)
49  {
50  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
51  for (unsigned int i = 0; i < _save_in.size(); i++)
52  _save_in[i]->sys().solution().add_vector(_local_re, _save_in[i]->dofIndices());
53  }
54 }
virtual void computeResidual() override
Compute this Kernel&#39;s contribution to the residual.
Definition: TimeKernel.C:37
void accumulateTaggedLocalResidual()
Local residual blocks will be appended by adding the current local kernel residual.
virtual Real computeQpResidual()=0
Compute this Kernel&#39;s contribution to the residual at the current quadrature point.
MooseVariable & _var
This is a regular kernel so we cast to a regular MooseVariable.
Definition: Kernel.h:54
std::vector< MooseVariableFEBase * > _save_in
Definition: KernelBase.h:172
const MooseArray< Real > & _JxW
The current quadrature point weight value.
Definition: KernelBase.h:159
unsigned int number() const
Get variable number coming from libMesh.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Assembly & _assembly
Reference to this Kernel&#39;s assembly object.
Definition: KernelBase.h:139
const VariableTestValue & _test
the current test function
Definition: Kernel.h:57
const QBase *const & _qrule
active quadrature rule
Definition: KernelBase.h:156
bool _has_save_in
The aux variables to save the residual contributions to.
Definition: KernelBase.h:171
unsigned int _i
current index for the test function
Definition: KernelBase.h:165
InputParameters validParams< TimeKernel >()
Definition: TimeKernel.C:21
const MooseArray< Real > & _coord
The scaling factor to convert from cartesian to another coordinate system (e.g rz, spherical, etc.)
Definition: KernelBase.h:162
InputParameters validParams< Kernel >()
Definition: Kernel.C:24
virtual void precalculateResidual()
Following methods are used for Kernels that need to perform a per-element calculation.
Definition: KernelBase.h:121
TimeKernel(const InputParameters &parameters)
Definition: TimeKernel.C:31
DenseVector< Number > _local_re
Holds residual entries as they are accumulated by this Kernel.
Definition: Kernel.h:20
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
void prepareVectorTag(Assembly &assembly, unsigned int ivar)
Prepare data for computing element residual the according to active tags.
unsigned int _qp
The current quadrature point index.
Definition: KernelBase.h:150