LCOV - code coverage report
Current view: top level - src/fvkernels - FVOrthogonalDiffusion.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 24 25 96.0 %
Date: 2025-08-08 20:01:16 Functions: 3 3 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 "FVOrthogonalDiffusion.h"
      11             : 
      12             : registerMooseObject("MooseApp", FVOrthogonalDiffusion);
      13             : 
      14             : InputParameters
      15       14292 : FVOrthogonalDiffusion::validParams()
      16             : {
      17       14292 :   InputParameters params = FVFluxKernel::validParams();
      18       14292 :   params.addClassDescription("Imposes an orthogonal diffusion term.");
      19       14292 :   params.addRequiredParam<MaterialPropertyName>("coeff", "diffusion coefficient");
      20       14292 :   params.addParam<MaterialPropertyName>(
      21             :       "diffusing_quantity",
      22             :       "The quantity that is diffusing. By default, the 'variable' solution value will be used.");
      23       14292 :   return params;
      24           0 : }
      25             : 
      26          14 : FVOrthogonalDiffusion::FVOrthogonalDiffusion(const InputParameters & parameters)
      27             :   : FVFluxKernel(parameters),
      28          14 :     _coeff_elem(getADMaterialProperty<Real>("coeff")),
      29          14 :     _coeff_neighbor(getNeighborADMaterialProperty<Real>("coeff")),
      30          28 :     _diff_quant_elem(isParamValid("diffusing_quantity")
      31          14 :                          ? getADMaterialProperty<Real>("diffusing_quantity").get()
      32             :                          : _u_elem),
      33          28 :     _diff_quant_neighbor(isParamValid("diffusing_quantity")
      34          14 :                              ? getNeighborADMaterialProperty<Real>("diffusing_quantity").get()
      35          14 :                              : _u_neighbor)
      36             : {
      37          14 : }
      38             : 
      39             : ADReal
      40       89280 : FVOrthogonalDiffusion::computeQpResidual()
      41             : {
      42       89280 :   ADReal coeff_interface;
      43       89280 :   Moose::FV::interpolate(Moose::FV::InterpMethod::Average,
      44             :                          coeff_interface,
      45       89280 :                          _coeff_elem[_qp],
      46       89280 :                          _coeff_neighbor[_qp],
      47       89280 :                          *_face_info,
      48             :                          true);
      49             : 
      50      178560 :   return -coeff_interface * (_diff_quant_neighbor[_qp] - _diff_quant_elem[_qp]) /
      51      267840 :          _face_info->dCNMag();
      52       89280 : }

Generated by: LCOV version 1.14