www.mooseframework.org
TimeKernel.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "TimeKernel.h"
16 
17 // MOOSE includes
18 #include "Assembly.h"
19 #include "MooseVariable.h"
20 #include "SystemBase.h"
21 
22 #include "libmesh/quadrature.h"
23 
24 template <>
27 {
29  return params;
30 }
31 
32 TimeKernel::TimeKernel(const InputParameters & parameters) : Kernel(parameters) {}
33 
34 void
36 {
37  DenseVector<Number> & re = _assembly.residualBlock(_var.number(), Moose::KT_TIME);
38  _local_re.resize(re.size());
39  _local_re.zero();
40 
42  for (_i = 0; _i < _test.size(); _i++)
43  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
45 
46  re += _local_re;
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:35
virtual Real computeQpResidual()=0
Compute this Kernel&#39;s contribution to the residual at the current quadrature point.
const MooseArray< Real > & _JxW
The current quadrature point weight value.
Definition: KernelBase.h:140
const VariableTestValue & _test
the current test function
Definition: KernelBase.h:152
QBase *& _qrule
active quadrature rule
Definition: KernelBase.h:137
DenseVector< Number > _local_re
Holds residual entries as they are accumulated by this Kernel.
Definition: KernelBase.h:164
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
DenseVector< Number > & residualBlock(unsigned int var_num, Moose::KernelType type=Moose::KT_NONTIME)
Definition: Assembly.h:504
Assembly & _assembly
Reference to this Kernel&#39;s assembly object.
Definition: KernelBase.h:117
std::vector< MooseVariable * > _save_in
Definition: KernelBase.h:171
bool _has_save_in
The aux variables to save the residual contributions to.
Definition: KernelBase.h:170
unsigned int _i
current index for the test function
Definition: KernelBase.h:146
InputParameters validParams< TimeKernel >()
Definition: TimeKernel.C:26
const MooseArray< Real > & _coord
The scaling factor to convert from cartesian to another coordinate system (e.g rz, spherical, etc.)
Definition: KernelBase.h:143
InputParameters validParams< Kernel >()
Definition: Kernel.C:30
unsigned int number() const
Get variable number coming from libMesh.
unsigned int size() const
The number of elements that can currently be stored in the array.
Definition: MooseArray.h:250
TimeKernel(const InputParameters &parameters)
Definition: TimeKernel.C:32
Definition: Kernel.h:25
virtual void precalculateResidual()
Following methods are used for Kernels that need to perform a per-element calculation.
Definition: Kernel.C:138
MooseVariable & _var
Reference to this Kernel&#39;s MooseVariable object.
Definition: KernelBase.h:120
unsigned int _qp
The current quadrature point index.
Definition: KernelBase.h:131