LCOV - code coverage report
Current view: top level - src/dgkernels - DGConvection.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 44 45 97.8 %
Date: 2025-07-17 01:28:37 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14