LCOV - code coverage report
Current view: top level - src/kernels - PrimaryConvection.C (source / functions) Hit Total Coverage
Test: idaholab/moose chemical_reactions: #31405 (292dce) with base fef103 Lines: 23 24 95.8 %
Date: 2025-09-04 07:52:33 Functions: 5 5 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 "PrimaryConvection.h"
      11             : 
      12             : registerMooseObject("ChemicalReactionsApp", PrimaryConvection);
      13             : 
      14             : InputParameters
      15         831 : PrimaryConvection::validParams()
      16             : {
      17         831 :   InputParameters params = Kernel::validParams();
      18        1662 :   params.addRequiredCoupledVar("p", "Pressure");
      19             :   RealVectorValue g(0, 0, 0);
      20        1662 :   params.addParam<RealVectorValue>("gravity", g, "Gravity vector (default is (0, 0, 0))");
      21         831 :   params.addClassDescription("Convection of primary species");
      22         831 :   return params;
      23           0 : }
      24             : 
      25         453 : PrimaryConvection::PrimaryConvection(const InputParameters & parameters)
      26             :   : DerivativeMaterialInterface<Kernel>(parameters),
      27         453 :     _cond(getMaterialProperty<Real>("conductivity")),
      28         906 :     _gravity(getParam<RealVectorValue>("gravity")),
      29         453 :     _density(getDefaultMaterialProperty<Real>("density")),
      30         453 :     _grad_p(coupledGradient("p")),
      31         906 :     _pvar(coupled("p"))
      32             : 
      33             : {
      34         453 : }
      35             : 
      36             : Real
      37     3148480 : PrimaryConvection::computeQpResidual()
      38             : {
      39     3148480 :   RealVectorValue darcy_vel = -_cond[_qp] * (_grad_p[_qp] - _density[_qp] * _gravity);
      40             : 
      41     3148480 :   return _test[_i][_qp] * (darcy_vel * _grad_u[_qp]);
      42             : }
      43             : 
      44             : Real
      45     1931520 : PrimaryConvection::computeQpJacobian()
      46             : {
      47     1931520 :   RealVectorValue darcy_vel = -_cond[_qp] * (_grad_p[_qp] - _density[_qp] * _gravity);
      48             : 
      49     1931520 :   return _test[_i][_qp] * (darcy_vel * _grad_phi[_j][_qp]);
      50             : }
      51             : 
      52             : Real
      53     2167040 : PrimaryConvection::computeQpOffDiagJacobian(unsigned int jvar)
      54             : {
      55     2167040 :   if (jvar == _pvar)
      56             :   {
      57      504320 :     RealVectorValue ddarcy_vel_dp = -_cond[_qp] * _grad_phi[_j][_qp];
      58      504320 :     return _test[_i][_qp] * (ddarcy_vel_dp * _grad_u[_qp]);
      59             :   }
      60             :   else
      61             :     return 0.0;
      62             : }

Generated by: LCOV version 1.14