https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ConservativeAdvection.h
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#pragma once
11
12#include "GenericKernel.h"
13#include "libmesh/dense_vector.h"
14
19template <bool is_ad>
21{
22public:
25
27
28protected:
29 virtual GenericReal<is_ad> computeQpResidual() override;
30 virtual Real computeQpJacobian() override;
31 virtual Real computeQpOffDiagJacobian(unsigned int jvar) override;
32 virtual void computeResidual() override;
33 virtual void computeJacobian() override;
34 virtual const GenericReal<is_ad> & getUNodal(const std::size_t n) const { return _u_nodal[n]; }
35
38
41
43 const unsigned int _coupled_variable_var;
44
47
50
53
55 enum class JacRes
56 {
59 };
60
62 const enum class UpwindingType { none, full } _upwinding;
63
66
68 std::vector<bool> _upwind_node;
69
71 std::vector<GenericReal<is_ad>> _dtotal_mass_out;
72
74 virtual GenericReal<is_ad> negSpeedQp() const;
75
77 void fullUpwind(JacRes res_or_jac);
78
80
81private:
84};
85
ConservativeAdvectionTempl< true > ADConservativeAdvection
ConservativeAdvectionTempl< false > ConservativeAdvection
typename GenericMaterialPropertyStruct< T, is_ad >::type GenericMaterialProperty
Moose::GenericType< VariableValue, is_ad > GenericVariableValue
Definition MooseTypes.h:712
Moose::GenericType< Real, is_ad > GenericReal
Definition MooseTypes.h:698
Advection of the variable by the velocity provided by the user.
const GenericMaterialProperty< Real, is_ad > & _scalar
Material property multiplied against the velocity to scale advection strength.
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
For coupling standard variables.
const unsigned int _coupled_variable_var
Coupled variable variable number.
JacRes
enum to make the code clearer
libMesh::DenseVector< GenericReal< is_ad > > _my_local_re
A container for holding the local residuals.
static InputParameters generalParams()
virtual GenericReal< is_ad > negSpeedQp() const
Returns - _grad_test * velocity.
virtual void computeJacobian() override
Compute this Kernel's contribution to the diagonal Jacobian entries.
virtual void computeResidual() override
Compute this Kernel's contribution to the residual.
const bool _coupled_variable_present
Flag to determine if coupled variable is present.
const bool _user_supplied_adv_quant
Flag to determine if user supplied variable is used as advective quantity.
const GenericVariableValue< is_ad > & _u_nodal
Nodal value of u, used for full upwinding.
std::vector< GenericReal< is_ad > > _dtotal_mass_out
In the full-upwind scheme d(total_mass_out)/d(variable_at_node_i)
const MooseArray< GenericReal< is_ad > > & _adv_quant
Quantity, as a variable value, that is advected. Defaults to the equation variable if unspecified.
virtual Real computeQpJacobian() override
Compute this Kernel's contribution to the Jacobian at the current quadrature point.
virtual const GenericReal< is_ad > & getUNodal(const std::size_t n) const
static InputParameters validParams()
std::vector< bool > _upwind_node
In the full-upwind scheme, whether a node is an upwind node.
void fullUpwind(JacRes res_or_jac)
Calculates the fully-upwind Residual and Jacobian (depending on res_or_jac)
virtual GenericReal< is_ad > computeQpResidual() override
Compute this Kernel's contribution to the residual at the current quadrature point.
const MooseArray< GenericRealVectorValue< is_ad > > * _velocity
advection velocity
enum ConservativeAdvectionTempl::UpwindingType _upwinding
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
forward declarations
Definition MooseArray.h:18
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131