LCOV - code coverage report
Current view: top level - src/linearfvbcs - LinearFVAdvectionDiffusionFunctorRobinBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 27 29 93.1 %
Date: 2026-05-29 20:35:17 Functions: 5 5 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 "LinearFVAdvectionDiffusionFunctorRobinBC.h"
      11             : 
      12             : registerMooseObject("MooseApp", LinearFVAdvectionDiffusionFunctorRobinBC);
      13             : 
      14             : InputParameters
      15        3205 : LinearFVAdvectionDiffusionFunctorRobinBC::validParams()
      16             : {
      17        3205 :   InputParameters params = LinearFVAdvectionDiffusionFunctorRobinBCBase::validParams();
      18        6410 :   params.addClassDescription(
      19             :       "Adds a Robin BC of the form \\alpha * \\nabla \\phi*n + \\beta * \\phi = \\gamma, "
      20             :       "which can be used for the assembly of linear "
      21             :       "finite volume system and whose face values are determined using "
      22             :       "three functors. This kernel is "
      23             :       "only designed to work with advection-diffusion problems.");
      24        9615 :   params.addParam<MooseFunctorName>(
      25        6410 :       "alpha", 1.0, "Functor for the coefficient of the normal gradient term.");
      26       12820 :   params.addParam<MooseFunctorName>("beta", 1.0, "Functor for the coefficient of the scalar term.");
      27        6410 :   params.addParam<MooseFunctorName>(
      28        6410 :       "gamma", 1.0, "Functor for the constant term on the RHS of the Robin BC.");
      29        3205 :   return params;
      30           0 : }
      31             : 
      32          72 : LinearFVAdvectionDiffusionFunctorRobinBC::LinearFVAdvectionDiffusionFunctorRobinBC(
      33          72 :     const InputParameters & parameters)
      34             :   : LinearFVAdvectionDiffusionFunctorRobinBCBase(parameters),
      35          72 :     _alpha(getFunctor<Real>("alpha")),
      36         144 :     _beta(getFunctor<Real>("beta")),
      37         216 :     _gamma(getFunctor<Real>("gamma"))
      38             : {
      39          72 :   _var.computeCellGradients();
      40             : 
      41          72 :   if (_alpha.isConstant())
      42             :   {
      43             :     // We check if we can parse the value to a number and if yes, we throw an error if it is 0
      44         144 :     std::istringstream ss(getParam<MooseFunctorName>("alpha"));
      45             :     Real real_value;
      46          72 :     if (ss >> real_value && ss.eof())
      47          72 :       if (MooseUtils::isZero(real_value))
      48           0 :         paramError("alpha",
      49             :                    "This value shall not be 0. Use a Dirichlet boundary condition instead!");
      50          72 :   }
      51          72 : }
      52             : 
      53             : Real
      54        4260 : LinearFVAdvectionDiffusionFunctorRobinBC::getAlpha(Moose::FaceArg face, Moose::StateArg state) const
      55             : {
      56        4260 :   return _alpha(face, state);
      57             : }
      58             : 
      59             : Real
      60        4260 : LinearFVAdvectionDiffusionFunctorRobinBC::getBeta(Moose::FaceArg face, Moose::StateArg state) const
      61             : {
      62        4260 :   return _beta(face, state);
      63             : }
      64             : 
      65             : Real
      66        3192 : LinearFVAdvectionDiffusionFunctorRobinBC::getGamma(Moose::FaceArg face, Moose::StateArg state) const
      67             : {
      68        3192 :   return _gamma(face, state);
      69             : }

Generated by: LCOV version 1.14