www.mooseframework.org
TimeNodalKernel.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 "TimeNodalKernel.h"
16 
17 // MOOSE includes
18 #include "Assembly.h"
19 #include "MooseVariable.h"
20 #include "SystemBase.h"
21 
22 template <>
25 {
27  return params;
28 }
29 
30 TimeNodalKernel::TimeNodalKernel(const InputParameters & parameters) : NodalKernel(parameters) {}
31 
32 void
34 {
35  if (_var.isNodalDefined())
36  {
37  dof_id_type & dof_idx = _var.nodalDofIndex();
38  _qp = 0;
39  Real res = computeQpResidual();
41 
42  if (_has_save_in)
43  {
44  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
45  for (const auto & var : _save_in)
46  var->sys().solution().add(var->nodalDofIndex(), res);
47  }
48  }
49 }
void cacheResidualContribution(dof_id_type dof, Real value, Moose::KernelType type)
Cache individual residual contributions.
Definition: Assembly.C:1375
Assembly & _assembly
Reference to assembly.
Definition: NodalKernel.h:140
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< NodalKernel >()
Definition: NodalKernel.C:24
MooseVariable & _var
variable this works on
Definition: NodalKernel.h:143
dof_id_type & nodalDofIndex()
InputParameters validParams< TimeNodalKernel >()
bool _has_save_in
The aux variables to save the residual contributions to.
Definition: NodalKernel.h:164
std::vector< MooseVariable * > _save_in
Definition: NodalKernel.h:165
virtual void computeResidual() override
Compute the residual at the current node.
unsigned int _qp
Quadrature point index.
Definition: NodalKernel.h:152
TimeNodalKernel(const InputParameters &parameters)
Constructor initializes the rate.
Base class for creating new types of boundary conditions.
Definition: NodalKernel.h:50
virtual Real computeQpResidual()=0
The user can override this function to compute the residual at a node.
bool isNodalDefined()