https://mooseframework.inl.gov
LinearFVTimeDerivative.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 "LinearFVTimeDerivative.h"
11 
13 
16 {
18  params.addClassDescription("Represents the matrix and right hand side contributions of a "
19  "time derivative term in a partial differential equation.");
20  params.addParam<MooseFunctorName>(
21  "factor", 1.0, "A multiplier on the variable within the time derivative.");
22  return params;
23 }
24 
26  : LinearFVElementalKernel(params),
27  _factor(getFunctor<Real>("factor")),
28  _time_integrator(_sys.getTimeIntegrator(_var_num)),
29  _factor_history(_time_integrator.numStatesRequired(), 0.0),
30  _state_args(_time_integrator.numStatesRequired(), determineState())
31 {
32  // In case we need older states
33  for (const auto i : index_range(_state_args))
35 }
36 
37 Real
39 {
40  const auto elem_arg = makeElemArg(_current_elem_info->elem());
43 }
44 
45 Real
47 {
50 }
51 
52 void
54 {
56 
57  const auto elem_arg = makeElemArg(_current_elem_info->elem());
58  for (const auto i : index_range(_factor_history))
59  _factor_history[i] = _factor(elem_arg, _state_args[i]);
60 }
const ElemInfo * _current_elem_info
Pointer to the current element info.
LinearFVTimeDerivative(const InputParameters &params)
Class constructor.
static InputParameters validParams()
const Elem * elem() const
Definition: ElemInfo.h:34
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::vector< Real > _factor_history
Current and older values of the material property multiplier.
virtual Real timeDerivativeMatrixContribution(const Real factor) const
The time derivative&#39;s contribution to the right hand side of a linear system.
virtual Real timeDerivativeRHSContribution(dof_id_type dof_id, const std::vector< Real > &factors={}) const
The time derivative&#39;s contribution to the right hand side of a linear system.
const TimeIntegrator & _time_integrator
The time integrator to use in this kernel, will provide information on how many states are required i...
Finite volume kernel that contributes approximations of volumetric integral terms to the matrix and r...
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
Helper method to create an elemental argument for a functor that includes whether to perform skewness...
std::vector< Moose::StateArg > _state_args
State args, the args which will help us fetch the different states of the material property multiplie...
virtual Real computeRightHandSideContribution() override
Computes the right hand side contribution for the given variable on the current element.
virtual void setCurrentElemInfo(const ElemInfo *elem_info) override
Set the current ElemInfo object.
dof_id_type _dof_id
The dof index for the current variable associated with the element.
const Moose::Functor< Real > & _factor
The functor for the material property multipler.
virtual void setCurrentElemInfo(const ElemInfo *elem_info)
Set the current ElemInfo object.
Kernel that adds contributions from a time derivative term to a linear system populated using the fin...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real computeMatrixContribution() override
Computes the system matrix contribution for the given variable on the current element.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
State argument for evaluating functors.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
Class used for caching additional information for elements such as the volume and centroid...
Definition: ElemInfo.h:25
registerMooseObject("MooseApp", LinearFVTimeDerivative)
Real _current_elem_volume
The coordinate-specific element volume.
auto index_range(const T &sizable)