https://mooseframework.inl.gov
Loading...
Searching...
No Matches
DGConvection.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 "DGConvection.h"
11
13
16{
18 params.addRequiredParam<RealVectorValue>("velocity", "Velocity vector");
19 params.addClassDescription("DG upwinding for the convection");
20 return params;
21}
22
24 : DGKernel(parameters), _velocity(getParam<RealVectorValue>("velocity"))
25{
26}
27
28Real
30{
31 Real r = 0;
32
33 Real vdotn = _velocity * _normals[_qp];
34
35 switch (type)
36 {
37 case Moose::Element:
38 if (vdotn >= 0)
39 r += vdotn * _u[_qp] * _test[_i][_qp];
40 else
41 r += vdotn * _u_neighbor[_qp] * _test[_i][_qp];
42 break;
43
44 case Moose::Neighbor:
45 if (vdotn >= 0)
46 r -= vdotn * _u[_qp] * _test_neighbor[_i][_qp];
47 else
48 r -= vdotn * _u_neighbor[_qp] * _test_neighbor[_i][_qp];
49 break;
50 }
51
52 return r;
53}
54
55Real
57{
58 Real r = 0;
59
60 Real vdotn = _velocity * _normals[_qp];
61
62 switch (type)
63 {
65 if (vdotn >= 0)
66 r += vdotn * _phi[_j][_qp] * _test[_i][_qp];
67 break;
68
70 if (vdotn < 0)
71 r += vdotn * _phi_neighbor[_j][_qp] * _test[_i][_qp];
72 break;
73
75 if (vdotn >= 0)
76 r -= vdotn * _phi[_j][_qp] * _test_neighbor[_i][_qp];
77 break;
78
80 if (vdotn < 0)
81 r -= vdotn * _phi_neighbor[_j][_qp] * _test_neighbor[_i][_qp];
82 break;
83 }
84
85 return r;
86}
registerMooseObject("MooseApp", DGConvection)
virtual Real computeQpResidual(Moose::DGResidualType type)
This is the virtual that derived classes should override for computing the residual on neighboring el...
virtual Real computeQpJacobian(Moose::DGJacobianType type)
This is the virtual that derived classes should override for computing the Jacobian on neighboring el...
DGConvection(const InputParameters &parameters)
static InputParameters validParams()
RealVectorValue _velocity
unsigned int _i
unsigned int _qp
unsigned int _j
const MooseArray< Point > & _normals
Normal vectors at the quadrature points.
The DGKernel class is responsible for calculating the residuals for various physics on internal sides...
Definition DGKernel.h:19
const VariableTestValue & _test_neighbor
Side test function.
Definition DGKernel.h:110
const VariableValue & _u
Holds the current solution at the current quadrature point on the face.
Definition DGKernel.h:94
static InputParameters validParams()
Factory constructor initializes all internal references needed for residual computation.
Definition DGKernel.C:27
const VariableValue & _u_neighbor
Holds the current solution at the current quadrature point.
Definition DGKernel.h:114
const VariablePhiValue & _phi_neighbor
Side shape function.
Definition DGKernel.h:106
const VariableTestValue & _test
test functions
Definition DGKernel.h:102
const VariablePhiValue & _phi
Shape functions.
Definition DGKernel.h:98
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
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.
const std::string & type() const
Get the type of this class.
Definition MooseBase.h:93
DGResidualType
Definition MooseTypes.h:798
@ Element
Definition MooseTypes.h:799
@ Neighbor
Definition MooseTypes.h:800
DGJacobianType
Definition MooseTypes.h:804
@ NeighborNeighbor
Definition MooseTypes.h:808
@ ElementElement
Definition MooseTypes.h:805
@ NeighborElement
Definition MooseTypes.h:807
@ ElementNeighbor
Definition MooseTypes.h:806