https://mooseframework.inl.gov
TimeNodalKernel.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 
19 {
21 
22  params.set<MultiMooseEnum>("vector_tags") = "time";
23  params.set<MultiMooseEnum>("matrix_tags") = "system time";
24 
25  return params;
26 }
27 
29  : NodalKernel(parameters), _u_dot(_var.dofValuesDot()), _du_dot_du(_var.dofValuesDuDotDu())
30 {
31 }
32 
33 void
35 {
36  if (_var.isNodalDefined())
37  {
38  const dof_id_type & dof_idx = _var.nodalDofIndex();
39  _qp = 0;
40  const Real res = computeQpResidual();
42  std::array<Real, 1>{{res}},
43  std::array<dof_id_type, 1>{{dof_idx}},
45 
46  if (_has_save_in)
47  for (const auto & var : _save_in)
48  var->sys().solution().add(var->nodalDofIndex(), res);
49  }
50 }
static InputParameters validParams()
Constructor initializes the rate.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
void addResiduals(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
Add the provided incoming residuals corresponding to the provided dof indices.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
MooseVariable & _var
variable this works on
Assembly & _assembly
Reference to this Kernel&#39;s assembly object.
bool _has_save_in
The aux variables to save the residual contributions to.
Definition: NodalKernel.h:75
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual bool isNodalDefined() const override
Is this variable defined at nodes.
const dof_id_type & nodalDofIndex() const override
virtual void computeResidual() override
Compute the residual at the current node.
TimeNodalKernel(const InputParameters &parameters)
std::vector< MooseVariableFEBase * > _save_in
Definition: NodalKernel.h:76
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
static InputParameters validParams()
Class constructor.
Definition: NodalKernel.C:18
Base class for creating nodal kernels with hand-coded Jacobians.
Definition: NodalKernel.h:17
unsigned int _qp
Quadrature point index.
virtual Real computeQpResidual()=0
The user can override this function to compute the residual at a node.
void scalingFactor(const std::vector< Real > &factor)
Set the scaling factor for this variable.
uint8_t dof_id_type