LCOV - code coverage report
Current view: top level - src/kernels - GradDiv.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: #32971 (54bef8) with base c6cf66 Lines: 21 22 95.5 %
Date: 2026-05-29 20:37:52 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 "GradDiv.h"
      11             : 
      12             : registerMooseObject("NavierStokesApp", GradDiv);
      13             : 
      14             : InputParameters
      15          78 : GradDiv::validParams()
      16             : {
      17          78 :   InputParameters params = ADKernel::validParams();
      18         156 :   params.addRequiredCoupledVar("u", "The x-velocity");
      19         156 :   params.addRequiredCoupledVar("v", "The y-velocity");
      20         156 :   params.addRequiredParam<unsigned short>("component",
      21             :                                           "The velocity component this object is being applied to");
      22         156 :   params.addParam<Real>("gamma", 1, "The penalty parameter");
      23          78 :   params.addClassDescription("Adds grad-div stabilization for scalar field velocity component "
      24             :                              "Navier-Stokes implementations.");
      25          78 :   return params;
      26           0 : }
      27             : 
      28          42 : GradDiv::GradDiv(const InputParameters & parameters)
      29             :   : ADKernel(parameters),
      30          42 :     _grad_vel_x(adCoupledGradient("u")),
      31          42 :     _grad_vel_y(adCoupledGradient("v")),
      32          84 :     _comp(getParam<unsigned short>("component")),
      33          84 :     _matrix_only(getParam<bool>("matrix_only")),
      34         126 :     _gamma(getParam<Real>("gamma"))
      35             : {
      36          42 : }
      37             : 
      38             : void
      39       53152 : GradDiv::computeResidual()
      40             : {
      41       53152 :   if (!_matrix_only)
      42       49152 :     ADKernel::computeResidual();
      43       53152 : }
      44             : 
      45             : ADReal
      46     1064040 : GradDiv::computeQpResidual()
      47             : {
      48     2128080 :   return _gamma * (_grad_vel_x[_qp](0) + _grad_vel_y[_qp](1)) * _grad_test[_i][_qp](_comp);
      49             : }

Generated by: LCOV version 1.14