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 
18 
21 {
23 
24  params.set<MultiMooseEnum>("vector_tags") = "time";
25  params.set<MultiMooseEnum>("matrix_tags") = "system";
26 
27  return params;
28 }
29 
31  : NodalKernel(parameters), _u_dot(_var.dofValuesDot()), _du_dot_du(_var.dofValuesDuDotDu())
32 {
33 }
34 
35 void
37 {
38  if (_var.isNodalDefined())
39  {
40  const dof_id_type & dof_idx = _var.nodalDofIndex();
41  _qp = 0;
42  Real res = computeQpResidual();
43  res *= _var.scalingFactor();
45 
46  if (_has_save_in)
47  {
48  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
49  for (const auto & var : _save_in)
50  var->sys().solution().add(var->nodalDofIndex(), res);
51  }
52  }
53 }
SystemBase.h
NodalKernel::validParams
static InputParameters validParams()
Class constructor.
Definition: NodalKernel.C:20
TimeNodalKernel
Represents a simple ODE of du/dt - rate = 0.
Definition: TimeNodalKernel.h:24
TaggingInterface::_vector_tags
std::set< TagID > _vector_tags
The vectors this Kernel will contribute to.
Definition: TaggingInterface.h:135
Assembly.h
Assembly::cacheResidualContribution
void cacheResidualContribution(dof_id_type dof, Real value, TagID tag_id)
Cache individual residual contributions.
Definition: Assembly.C:2985
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Definition: InputParameters.h:53
InputParameters::set
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Definition: InputParameters.h:987
NodalKernel
Base class for creating new types of boundary conditions.
Definition: NodalKernel.h:48
TimeNodalKernel::validParams
static InputParameters validParams()
Constructor initializes the rate.
Definition: TimeNodalKernel.C:20
NodalKernel::_assembly
Assembly & _assembly
Reference to assembly.
Definition: NodalKernel.h:141
NodalKernel::_save_in
std::vector< MooseVariableFEBase * > _save_in
Definition: NodalKernel.h:160
NodalKernel::_var
MooseVariable & _var
variable this works on
Definition: NodalKernel.h:144
MooseVariableFE::isNodalDefined
virtual bool isNodalDefined() const override
Is this variable defined at nodes.
Definition: MooseVariableFE.C:777
NodalKernel::_qp
unsigned int _qp
Quadrature point index.
Definition: NodalKernel.h:153
MooseVariableFE.h
TimeNodalKernel::computeResidual
virtual void computeResidual() override
Compute the residual at the current node.
Definition: TimeNodalKernel.C:36
NodalKernel::computeQpResidual
virtual Real computeQpResidual()=0
The user can override this function to compute the residual at a node.
MooseVariableBase::scalingFactor
void scalingFactor(Real factor)
Set the scaling factor for this variable.
Definition: MooseVariableBase.h:79
MultiMooseEnum
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MultiMooseEnum.h:38
NodalKernel::_has_save_in
bool _has_save_in
The aux variables to save the residual contributions to.
Definition: NodalKernel.h:159
TimeNodalKernel::TimeNodalKernel
TimeNodalKernel(const InputParameters &parameters)
Definition: TimeNodalKernel.C:30
TimeNodalKernel.h
defineLegacyParams
defineLegacyParams(TimeNodalKernel)
MooseVariableFE::nodalDofIndex
const dof_id_type & nodalDofIndex() const override
Definition: MooseVariableFE.h:164