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

Generated by: LCOV version 1.14