LCOV - code coverage report
Current view: top level - src/fvbcs - FVOrthogonalBoundaryDiffusion.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 25 26 96.2 %
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 "FVOrthogonalBoundaryDiffusion.h"
      11             : #include "Function.h"
      12             : 
      13             : registerMooseObject("MooseApp", FVOrthogonalBoundaryDiffusion);
      14             : 
      15             : InputParameters
      16       14315 : FVOrthogonalBoundaryDiffusion::validParams()
      17             : {
      18       14315 :   InputParameters params = FVFluxBC::validParams();
      19       14315 :   params.addClassDescription(
      20             :       "Imposes an orthogonal diffusion boundary term with specified boundary function.");
      21       14315 :   params.addRequiredParam<FunctionName>("function",
      22             :                                         "The value of the quantity of interest on the boundary.");
      23       14315 :   params.addRequiredParam<MaterialPropertyName>("coeff", "diffusion coefficient");
      24       14315 :   params.addParam<MaterialPropertyName>(
      25             :       "diffusing_quantity",
      26             :       "The quantity that is diffusing. By default, the 'variable' solution value will be used.");
      27       14315 :   return params;
      28           0 : }
      29             : 
      30          26 : FVOrthogonalBoundaryDiffusion::FVOrthogonalBoundaryDiffusion(const InputParameters & parameters)
      31             :   : FVFluxBC(parameters),
      32          26 :     _function(getFunction("function")),
      33          26 :     _coeff_elem(getADMaterialProperty<Real>("coeff")),
      34          26 :     _coeff_neighbor(getNeighborADMaterialProperty<Real>("coeff")),
      35          52 :     _diff_quant_elem(isParamValid("diffusing_quantity")
      36          26 :                          ? getADMaterialProperty<Real>("diffusing_quantity").get()
      37             :                          : _u),
      38          52 :     _diff_quant_neighbor(isParamValid("diffusing_quantity")
      39          26 :                              ? getNeighborADMaterialProperty<Real>("diffusing_quantity").get()
      40          26 :                              : _u_neighbor)
      41             : {
      42          26 : }
      43             : 
      44             : ADReal
      45        2560 : FVOrthogonalBoundaryDiffusion::computeQpResidual()
      46             : {
      47             :   const bool elem_is_interior =
      48        2560 :       _face_info->faceType(std::make_pair(_var.number(), _var.sys().number())) ==
      49        2560 :       FaceInfo::VarFaceNeighbors::ELEM;
      50             : 
      51        2560 :   const auto & diff_quant = elem_is_interior ? _diff_quant_elem[_qp] : _diff_quant_neighbor[_qp];
      52        2560 :   const auto & coeff = elem_is_interior ? _coeff_elem[_qp] : _coeff_neighbor[_qp];
      53             :   const auto & interior_centroid =
      54        2560 :       elem_is_interior ? _face_info->elemCentroid() : _face_info->neighborCentroid();
      55             : 
      56        5120 :   return -coeff * (_function.value(_t, _face_info->faceCentroid()) - diff_quant) /
      57        7680 :          (_face_info->faceCentroid() - interior_centroid).norm();
      58             : }

Generated by: LCOV version 1.14