LCOV - code coverage report
Current view: top level - src/linearfvbcs - LinearFVAdvectionDiffusionFunctorDirichletBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 21 27 77.8 %
Date: 2026-05-29 20:35:17 Functions: 7 8 87.5 %
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 "LinearFVAdvectionDiffusionFunctorDirichletBC.h"
      11             : 
      12             : registerMooseObject("MooseApp", LinearFVAdvectionDiffusionFunctorDirichletBC);
      13             : 
      14             : InputParameters
      15        5683 : LinearFVAdvectionDiffusionFunctorDirichletBC::validParams()
      16             : {
      17        5683 :   InputParameters params = LinearFVAdvectionDiffusionBC::validParams();
      18       11366 :   params.addClassDescription(
      19             :       "Adds a dirichlet BC which can be used for the assembly of linear "
      20             :       "finite volume system and whose face values are determined using a functor. This kernel is "
      21             :       "only designed to work with advection-diffusion problems.");
      22       22732 :   params.addRequiredParam<MooseFunctorName>("functor", "The functor for this boundary condition.");
      23       17049 :   MooseEnum normal_component("x y z none", "none");
      24       11366 :   return params;
      25        5683 : }
      26             : 
      27        1311 : LinearFVAdvectionDiffusionFunctorDirichletBC::LinearFVAdvectionDiffusionFunctorDirichletBC(
      28        1311 :     const InputParameters & parameters)
      29        2622 :   : LinearFVAdvectionDiffusionBC(parameters), _functor(getFunctor<Real>("functor"))
      30             : {
      31        1311 : }
      32             : 
      33             : Real
      34     2105743 : LinearFVAdvectionDiffusionFunctorDirichletBC::computeBoundaryValue() const
      35             : {
      36     2105743 :   return _functor(functorFaceArg(_functor, _current_face_info), determineState());
      37             : }
      38             : 
      39             : Real
      40           0 : LinearFVAdvectionDiffusionFunctorDirichletBC::computeBoundaryNormalGradient() const
      41             : {
      42           0 :   const auto elem_arg = makeElemArg(_current_face_type == FaceInfo::VarFaceNeighbors::ELEM
      43           0 :                                         ? _current_face_info->elemPtr()
      44           0 :                                         : _current_face_info->neighborPtr());
      45           0 :   const Real distance = computeCellToFaceDistance();
      46           0 :   return (computeBoundaryValue() - raw_value(_var(elem_arg, determineState()))) / distance;
      47             : }
      48             : 
      49             : Real
      50      708843 : LinearFVAdvectionDiffusionFunctorDirichletBC::computeBoundaryValueMatrixContribution() const
      51             : {
      52             :   // Ths will not contribute to the matrix from the value considering that
      53             :   // the value is independent of the solution.
      54      708843 :   return 0.0;
      55             : }
      56             : 
      57             : Real
      58      708843 : LinearFVAdvectionDiffusionFunctorDirichletBC::computeBoundaryValueRHSContribution() const
      59             : {
      60             :   // Fetch the boundary value from the provided functor.
      61      708843 :   return computeBoundaryValue();
      62             : }
      63             : 
      64             : Real
      65       43625 : LinearFVAdvectionDiffusionFunctorDirichletBC::computeBoundaryGradientMatrixContribution() const
      66             : {
      67             :   // The implicit term from the central difference approximation of the normal
      68             :   // gradient.
      69       43625 :   return 1.0 / computeCellToFaceDistance();
      70             : }
      71             : 
      72             : Real
      73       43625 : LinearFVAdvectionDiffusionFunctorDirichletBC::computeBoundaryGradientRHSContribution() const
      74             : {
      75             :   // The boundary term from the central difference approximation of the
      76             :   // normal gradient.
      77       43625 :   return computeBoundaryValue() / computeCellToFaceDistance();
      78             : }

Generated by: LCOV version 1.14