LCOV - code coverage report
Current view: top level - src/kernels - DivField.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 18 20 90.0 %
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 "DivField.h"
      11             : #include "Assembly.h"
      12             : 
      13             : registerMooseObject("MooseApp", DivField);
      14             : 
      15             : InputParameters
      16       14565 : DivField::validParams()
      17             : {
      18       14565 :   InputParameters params = Kernel::validParams();
      19       14565 :   params.addClassDescription("The divergence operator optionally scaled by a constant scalar "
      20             :                              "coefficient. Weak form: $(\\psi_i, k \\nabla \\cdot \\vec{u})$.");
      21       14565 :   params.addRequiredCoupledVar("coupled_vector_variable", "The vector field");
      22       14565 :   params.addParam<Real>("coeff", 1.0, "The constant coefficient");
      23       14565 :   return params;
      24           0 : }
      25             : 
      26         156 : DivField::DivField(const InputParameters & parameters)
      27             :   : Kernel(parameters),
      28         156 :     _u_var(*getVectorVar("coupled_vector_variable", 0)),
      29         156 :     _u_var_num(coupled("coupled_vector_variable")),
      30         156 :     _div_u(coupledDiv("coupled_vector_variable")),
      31         156 :     _div_phi(_assembly.divPhi(_u_var)),
      32         312 :     _coeff(getParam<Real>("coeff"))
      33             : {
      34         156 : }
      35             : 
      36             : Real
      37      456192 : DivField::computeQpResidual()
      38             : {
      39      456192 :   return _coeff * _div_u[_qp] * _test[_i][_qp];
      40             : }
      41             : 
      42             : Real
      43     1870848 : DivField::computeQpOffDiagJacobian(unsigned int jvar)
      44             : {
      45     1870848 :   if (_u_var_num == jvar)
      46     1870848 :     return _coeff * _div_phi[_j][_qp] * _test[_i][_qp];
      47             : 
      48           0 :   return 0.0;
      49             : }

Generated by: LCOV version 1.14