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 
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 
28 Real
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 
55 Real
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 }
static InputParameters validParams()
Definition: DGConvection.C:15
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
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
unsigned int _i
Definition: DGKernelBase.h:136
DGResidualType
Definition: MooseTypes.h:656
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:25
DGConvection(const InputParameters &parameters)
Definition: DGConvection.C:23
static InputParameters validParams()
Factory constructor initializes all internal references needed for residual computation.
Definition: DGKernel.C:27
const VariableTestValue & _test_neighbor
Side test function.
Definition: DGKernel.h:110
unsigned int _qp
Definition: DGKernelBase.h:134
unsigned int _j
Definition: DGKernelBase.h:136
The DGKernel class is responsible for calculating the residuals for various physics on internal sides...
Definition: DGKernel.h:18
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:29
const std::string & type() const
Get the type of this class.
Definition: MooseBase.h:50
const MooseArray< Point > & _normals
Normal vectors at the quadrature points.
Definition: DGKernelBase.h:113
registerMooseObject("MooseApp", DGConvection)
const VariableTestValue & _test
test functions
Definition: DGKernel.h:102
DGJacobianType
Definition: MooseTypes.h:662
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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 VariablePhiValue & _phi
Shape functions.
Definition: DGKernel.h:98
const VariableValue & _u
Holds the current solution at the current quadrature point on the face.
Definition: DGKernel.h:94
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:56