LCOV - code coverage report
Current view: top level - src/fviks - FVOneVarDiffusionInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 31 33 93.9 %
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 "FVOneVarDiffusionInterface.h"
      11             : #include "MathFVUtils.h"
      12             : 
      13             : registerMooseObject("MooseApp", FVOneVarDiffusionInterface);
      14             : 
      15             : InputParameters
      16       14414 : FVOneVarDiffusionInterface::validParams()
      17             : {
      18       14414 :   InputParameters params = FVInterfaceKernel::validParams();
      19       14414 :   params.addClassDescription(
      20             :       "Computes residual for diffusion operator across an interface for finite volume method.");
      21       14414 :   params.addRequiredParam<MaterialPropertyName>("coeff1",
      22             :                                                 "The diffusion coefficient on the 1st subdomains");
      23       14414 :   params.addRequiredParam<MaterialPropertyName>("coeff2",
      24             :                                                 "The diffusion coefficient on the 2nd subdomains");
      25       14414 :   MooseEnum coeff_interp_method("average harmonic", "harmonic");
      26       14414 :   params.addParam<MooseEnum>(
      27             :       "coeff_interp_method",
      28             :       coeff_interp_method,
      29             :       "Switch that can select face interpolation method for diffusion coefficients.");
      30       14414 :   params.set<unsigned short>("ghost_layers") = 2;
      31       28828 :   return params;
      32       14414 : }
      33             : 
      34          81 : FVOneVarDiffusionInterface::FVOneVarDiffusionInterface(const InputParameters & params)
      35             :   : FVInterfaceKernel(params),
      36          69 :     _coeff1(getFunctor<ADReal>("coeff1")),
      37         150 :     _coeff2(getFunctor<ADReal>("coeff2"))
      38             : {
      39          69 :   if (&var1() != &var2())
      40           0 :     paramError("variable2",
      41           0 :                name(),
      42             :                " is only designed to work with the same variable on both sides of an interface.");
      43          69 :   const auto & interp_method = getParam<MooseEnum>("coeff_interp_method");
      44          69 :   if (interp_method == "average")
      45          41 :     _coeff_interp_method = Moose::FV::InterpMethod::Average;
      46          28 :   else if (interp_method == "harmonic")
      47          28 :     _coeff_interp_method = Moose::FV::InterpMethod::HarmonicAverage;
      48          69 : }
      49             : 
      50             : ADReal
      51         192 : FVOneVarDiffusionInterface::computeQpResidual()
      52             : {
      53         192 :   const auto & coef_elem = elemIsOne() ? _coeff1 : _coeff2;
      54         192 :   const auto & coef_neighbor = elemIsOne() ? _coeff2 : _coeff1;
      55             : 
      56         192 :   const auto & grad = var1().adGradSln(*_face_info, determineState());
      57             : 
      58         192 :   ADReal coef;
      59         192 :   interpolate(_coeff_interp_method,
      60             :               coef,
      61         384 :               coef_elem(elemArg(), determineState()),
      62         384 :               coef_neighbor(neighborArg(), determineState()),
      63         192 :               *_face_info,
      64             :               true);
      65             : 
      66         576 :   return _normal * -coef * grad;
      67         192 : }

Generated by: LCOV version 1.14