LCOV - code coverage report
Current view: top level - src/kernels - PrimaryConvection.C (source / functions) Hit Total Coverage
Test: idaholab/moose chemical_reactions: #32971 (54bef8) with base c6cf66 Lines: 23 24 95.8 %
Date: 2026-05-29 20:35:47 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         501 : PrimaryConvection::validParams()
      16             : {
      17         501 :   InputParameters params = Kernel::validParams();
      18        1002 :   params.addRequiredCoupledVar("p", "Pressure");
      19             :   RealVectorValue g(0, 0, 0);
      20        1002 :   params.addParam<RealVectorValue>("gravity", g, "Gravity vector (default is (0, 0, 0))");
      21         501 :   params.addClassDescription("Convection of primary species");
      22         501 :   return params;
      23           0 : }
      24             : 
      25         265 : PrimaryConvection::PrimaryConvection(const InputParameters & parameters)
      26             :   : DerivativeMaterialInterface<Kernel>(parameters),
      27         265 :     _cond(getMaterialProperty<Real>("conductivity")),
      28         530 :     _gravity(getParam<RealVectorValue>("gravity")),
      29         265 :     _density(getDefaultMaterialProperty<Real>("density")),
      30         265 :     _grad_p(coupledGradient("p")),
      31         530 :     _pvar(coupled("p"))
      32             : 
      33             : {
      34         265 : }
      35             : 
      36             : Real
      37     2913312 : PrimaryConvection::computeQpResidual()
      38             : {
      39     2913312 :   RealVectorValue darcy_vel = -_cond[_qp] * (_grad_p[_qp] - _density[_qp] * _gravity);
      40             : 
      41     2913312 :   return _test[_i][_qp] * (darcy_vel * _grad_u[_qp]);
      42             : }
      43             : 
      44             : Real
      45     1842304 : PrimaryConvection::computeQpJacobian()
      46             : {
      47     1842304 :   RealVectorValue darcy_vel = -_cond[_qp] * (_grad_p[_qp] - _density[_qp] * _gravity);
      48             : 
      49     1842304 :   return _test[_i][_qp] * (darcy_vel * _grad_phi[_j][_qp]);
      50             : }
      51             : 
      52             : Real
      53     2111488 : PrimaryConvection::computeQpOffDiagJacobian(unsigned int jvar)
      54             : {
      55     2111488 :   if (jvar == _pvar)
      56             :   {
      57      667648 :     RealVectorValue ddarcy_vel_dp = -_cond[_qp] * _grad_phi[_j][_qp];
      58      667648 :     return _test[_i][_qp] * (ddarcy_vel_dp * _grad_u[_qp]);
      59             :   }
      60             :   else
      61             :     return 0.0;
      62             : }

Generated by: LCOV version 1.14