www.mooseframework.org
TimeNodalKernel.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 "TimeNodalKernel.h"
11 
12 // MOOSE includes
13 #include "Assembly.h"
14 #include "MooseVariableFE.h"
15 #include "SystemBase.h"
16 
17 template <>
20 {
22 
23  params.set<MultiMooseEnum>("vector_tags") = "time";
24  params.set<MultiMooseEnum>("matrix_tags") = "system";
25 
26  return params;
27 }
28 
30  : NodalKernel(parameters), _u_dot(_var.dofValuesDot()), _du_dot_du(_var.dofValuesDuDotDu())
31 {
32 }
33 
34 void
36 {
37  if (_var.isNodalDefined())
38  {
39  const dof_id_type & dof_idx = _var.nodalDofIndex();
40  _qp = 0;
41  Real res = computeQpResidual();
43 
44  if (_has_save_in)
45  {
46  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
47  for (const auto & var : _save_in)
48  var->sys().solution().add(var->nodalDofIndex(), res);
49  }
50  }
51 }
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Assembly & _assembly
Reference to assembly.
Definition: NodalKernel.h:139
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< NodalKernel >()
Definition: NodalKernel.C:19
MooseVariable & _var
variable this works on
Definition: NodalKernel.h:142
std::set< TagID > _vector_tags
The vectors this Kernel will contribute to.
InputParameters validParams< TimeNodalKernel >()
bool _has_save_in
The aux variables to save the residual contributions to.
Definition: NodalKernel.h:157
bool isNodalDefined() const
const dof_id_type & nodalDofIndex() const override
virtual void computeResidual() override
Compute the residual at the current node.
unsigned int _qp
Quadrature point index.
Definition: NodalKernel.h:151
TimeNodalKernel(const InputParameters &parameters)
Constructor initializes the rate.
void cacheResidualContribution(dof_id_type dof, Real value, TagID tag_id)
Cache individual residual contributions.
Definition: Assembly.C:2825
std::vector< MooseVariableFEBase * > _save_in
Definition: NodalKernel.h:158
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Base class for creating new types of boundary conditions.
Definition: NodalKernel.h:48
virtual Real computeQpResidual()=0
The user can override this function to compute the residual at a node.