Line data Source code
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 : 12 : registerMooseObject("MooseApp", DGConvection); 13 : 14 : InputParameters 15 3178 : DGConvection::validParams() 16 : { 17 3178 : InputParameters params = DGKernel::validParams(); 18 12712 : params.addRequiredParam<RealVectorValue>("velocity", "Velocity vector"); 19 3178 : params.addClassDescription("DG upwinding for the convection"); 20 3178 : return params; 21 0 : } 22 : 23 61 : DGConvection::DGConvection(const InputParameters & parameters) 24 122 : : DGKernel(parameters), _velocity(getParam<RealVectorValue>("velocity")) 25 : { 26 61 : } 27 : 28 : Real 29 32992 : DGConvection::computeQpResidual(Moose::DGResidualType type) 30 : { 31 32992 : Real r = 0; 32 : 33 32992 : Real vdotn = _velocity * _normals[_qp]; 34 : 35 32992 : switch (type) 36 : { 37 16496 : case Moose::Element: 38 16496 : if (vdotn >= 0) 39 16440 : r += vdotn * _u[_qp] * _test[_i][_qp]; 40 : else 41 56 : r += vdotn * _u_neighbor[_qp] * _test[_i][_qp]; 42 16496 : break; 43 : 44 16496 : case Moose::Neighbor: 45 16496 : if (vdotn >= 0) 46 16440 : r -= vdotn * _u[_qp] * _test_neighbor[_i][_qp]; 47 : else 48 56 : r -= vdotn * _u_neighbor[_qp] * _test_neighbor[_i][_qp]; 49 16496 : break; 50 : } 51 : 52 32992 : return r; 53 : } 54 : 55 : Real 56 28800 : DGConvection::computeQpJacobian(Moose::DGJacobianType type) 57 : { 58 28800 : Real r = 0; 59 : 60 28800 : Real vdotn = _velocity * _normals[_qp]; 61 : 62 28800 : switch (type) 63 : { 64 7200 : case Moose::ElementElement: 65 7200 : if (vdotn >= 0) 66 7168 : r += vdotn * _phi[_j][_qp] * _test[_i][_qp]; 67 7200 : break; 68 : 69 7200 : case Moose::ElementNeighbor: 70 7200 : if (vdotn < 0) 71 32 : r += vdotn * _phi_neighbor[_j][_qp] * _test[_i][_qp]; 72 7200 : break; 73 : 74 7200 : case Moose::NeighborElement: 75 7200 : if (vdotn >= 0) 76 7168 : r -= vdotn * _phi[_j][_qp] * _test_neighbor[_i][_qp]; 77 7200 : break; 78 : 79 7200 : case Moose::NeighborNeighbor: 80 7200 : if (vdotn < 0) 81 32 : r -= vdotn * _phi_neighbor[_j][_qp] * _test_neighbor[_i][_qp]; 82 7200 : break; 83 : } 84 : 85 28800 : return r; 86 : }