https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
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
37Real
44
45Real
51
52void
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}
registerMooseObject("MooseApp", LinearFVTimeDerivative)
Class used for caching additional information for elements such as the volume and centroid.
Definition ElemInfo.h:26
const Elem * elem() const
Definition ElemInfo.h:34
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...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
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.
Finite volume kernel that contributes approximations of volumetric integral terms to the matrix and r...
virtual void setCurrentElemInfo(const ElemInfo *elem_info)
Set the current ElemInfo object.
const ElemInfo * _current_elem_info
Pointer to the current element info.
static InputParameters validParams()
Real _current_elem_volume
The coordinate-specific element volume.
dof_id_type _dof_id
The dof index for the current variable associated with the element.
Kernel that adds contributions from a time derivative term to a linear system populated using the fin...
virtual void setCurrentElemInfo(const ElemInfo *elem_info) override
Set the current ElemInfo object.
virtual Real computeMatrixContribution() override
Computes the system matrix contribution for the given variable on the current element.
const TimeIntegrator & _time_integrator
The time integrator to use in this kernel, will provide information on how many states are required i...
virtual Real computeRightHandSideContribution() override
Computes the right hand side contribution for the given variable on the current element.
std::vector< Real > _factor_history
Current and older values of the material property multiplier.
const Moose::Functor< Real > & _factor
The functor for the material property multipler.
LinearFVTimeDerivative(const InputParameters &params)
Class constructor.
std::vector< Moose::StateArg > _state_args
State args, the args which will help us fetch the different states of the material property multiplie...
static InputParameters validParams()
virtual Real timeDerivativeRHSContribution(dof_id_type dof_id, const std::vector< Real > &factors={}) const
The time derivative's contribution to the right hand side of a linear system.
virtual Real timeDerivativeMatrixContribution(const Real factor) const
The time derivative's contribution to the right hand side of a linear system.
State argument for evaluating functors.