https://mooseframework.inl.gov
INSFVMomentumTimeDerivative.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 #include "SystemBase.h"
12 #include "NS.h"
13 
15 
18 {
20  params.addClassDescription(
21  "Adds the time derivative term to the incompressible Navier-Stokes momentum equation.");
22  params.addRequiredParam<MooseFunctorName>(NS::density, "The density functor");
23  return params;
24 }
25 
27  : INSFVTimeKernel(params), _rho(getFunctor<ADReal>(NS::density))
28 {
29 }
30 
31 void
33 {
34  const auto e = makeElemArg(&elem);
35  const auto state = determineState();
36  const auto residual = _rho(e, state) * _var.dot(e, state) * _assembly.elementVolume(&elem);
37  const auto dof_number = elem.dof_number(_sys.number(), _var.number(), 0);
38  const Real a = residual.derivatives()[dof_number];
39 
41  _rc_uo.addToA(&elem, _index, a);
42 
43  addResidualAndJacobian(residual, dof_number);
44 }
void addResidualAndJacobian(const ADReal &residual, dof_id_type dof)
Process into either the system residual or Jacobian.
unsigned int number() const
Moose::StateArg determineState() const
const bool _contribute_to_rc_coeffs
Whether to contribute to RC coefficients.
const unsigned int _index
index x|y|z
static const std::string density
Definition: NS.h:33
All navier-stokes momentum time derivative terms should inherit from this class.
static InputParameters validParams()
DualNumber< Real, DNDerivativeType, true > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
RhieChowInterpolatorBase & _rc_uo
The Rhie Chow user object that is responsible for generating face velocities for advection terms...
SystemBase & _sys
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
INSFVMomentumTimeDerivative(const InputParameters &params)
Real elementVolume(const Elem *elem) const
const Moose::Functor< ADReal > & _rho
The density.
unsigned int number() const
static InputParameters validParams()
Assembly & _assembly
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
DotType dot(const ElemArg &elem, const StateArg &state) const
virtual void addToA(const libMesh::Elem *elem, unsigned int component, const ADReal &value)=0
API for momentum residual objects that have on-diagonals for velocity call.
void gatherRCData(const Elem &) override
Should be a non-empty implementation if the residual object is a FVElementalKernel and introduces res...
void addClassDescription(const std::string &doc_string)
MooseVariableFV< Real > & _var
registerMooseObject("NavierStokesApp", INSFVMomentumTimeDerivative)