www.mooseframework.org
DGConvection.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
14 template <>
17 {
19  params.addRequiredParam<RealVectorValue>("velocity", "Velocity vector");
20  params.addClassDescription("DG upwinding for the convection");
21  return params;
22 }
23 
25  : DGKernel(parameters), _velocity(getParam<RealVectorValue>("velocity"))
26 {
27 }
28 
29 Real
31 {
32  Real r = 0;
33 
34  Real vdotn = _velocity * _normals[_qp];
35 
36  switch (type)
37  {
38  case Moose::Element:
39  if (vdotn >= 0)
40  r += vdotn * _u[_qp] * _test[_i][_qp];
41  else
42  r += vdotn * _u_neighbor[_qp] * _test[_i][_qp];
43  break;
44 
45  case Moose::Neighbor:
46  if (vdotn >= 0)
47  r -= vdotn * _u[_qp] * _test_neighbor[_i][_qp];
48  else
49  r -= vdotn * _u_neighbor[_qp] * _test_neighbor[_i][_qp];
50  break;
51  }
52 
53  return r;
54 }
55 
56 Real
58 {
59  Real r = 0;
60 
61  Real vdotn = _velocity * _normals[_qp];
62 
63  switch (type)
64  {
66  if (vdotn >= 0)
67  r += vdotn * _phi[_j][_qp] * _test[_i][_qp];
68  break;
69 
71  if (vdotn < 0)
72  r += vdotn * _phi_neighbor[_j][_qp] * _test[_i][_qp];
73  break;
74 
76  if (vdotn >= 0)
77  r -= vdotn * _phi[_j][_qp] * _test_neighbor[_i][_qp];
78  break;
79 
81  if (vdotn < 0)
82  r -= vdotn * _phi_neighbor[_j][_qp] * _test_neighbor[_i][_qp];
83  break;
84  }
85 
86  return r;
87 }
const VariableTestValue & _test_neighbor
Side test function.
Definition: DGKernelBase.h:171
const VariablePhiValue & _phi_neighbor
Side shape function.
Definition: DGKernelBase.h:166
const VariableValue & _u_neighbor
Holds the current solution at the current quadrature point.
Definition: DGKernelBase.h:176
InputParameters validParams< DGKernel >()
Definition: DGKernel.C:28
VectorValue< Real > RealVectorValue
Definition: Assembly.h:31
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const VariableValue & _u
Holds the current solution at the current quadrature point on the face.
Definition: DGKernelBase.h:149
unsigned int _i
Definition: DGKernelBase.h:144
DGResidualType
Definition: MooseTypes.h:509
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...
RealVectorValue _velocity
Definition: DGConvection.h:28
const std::string & type() const
Get the type of this object.
Definition: MooseObject.h:53
DGConvection(const InputParameters &parameters)
Definition: DGConvection.C:24
unsigned int _qp
Definition: DGKernelBase.h:138
unsigned int _j
Definition: DGKernelBase.h:144
The DGKernel class is responsible for calculating the residuals for various physics on internal sides...
Definition: DGKernel.h:23
virtual Real computeQpResidual(Moose::DGResidualType type)
This is the virtual that derived classes should override for computing the residual on neighboring el...
Definition: DGConvection.C:30
const MooseArray< Point > & _normals
Normal vectors at the quadrature points.
Definition: DGKernelBase.h:163
registerMooseObject("MooseApp", DGConvection)
DGJacobianType
Definition: MooseTypes.h:515
MatType type
const VariablePhiValue & _phi
Definition: DGKernelBase.h:154
const VariableTestValue & _test
Side shape function.
Definition: DGKernelBase.h:159
InputParameters validParams< DGConvection >()
Definition: DGConvection.C:16
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...
virtual Real computeQpJacobian(Moose::DGJacobianType type)
This is the virtual that derived classes should override for computing the Jacobian on neighboring el...
Definition: DGConvection.C:57