LCOV - code coverage report
Current view: top level - src/fvbcs - INSFVInletIntensityTKEBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 25 29 86.2 %
Date: 2025-08-14 10:14:56 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 "INSFVInletIntensityTKEBC.h"
      11             : 
      12             : registerMooseObject("NavierStokesApp", INSFVInletIntensityTKEBC);
      13             : 
      14             : InputParameters
      15          21 : INSFVInletIntensityTKEBC::validParams()
      16             : {
      17          21 :   InputParameters params = FVDirichletBCBase::validParams();
      18          21 :   params.addClassDescription("Adds inlet boudnary conditon for the turbulent kinetic energy based "
      19             :                              "on turbulent intensity.");
      20          42 :   params.addRequiredParam<MooseFunctorName>("u", "The velocity in the x direction.");
      21          42 :   params.addParam<MooseFunctorName>("v", "The velocity in the y direction.");
      22          42 :   params.addParam<MooseFunctorName>("w", "The velocity in the z direction.");
      23          42 :   params.addRequiredParam<MooseFunctorName>("intensity", "Turbulent intensity.");
      24          21 :   return params;
      25           0 : }
      26             : 
      27          12 : INSFVInletIntensityTKEBC::INSFVInletIntensityTKEBC(const InputParameters & params)
      28             :   : FVDirichletBCBase(params),
      29          12 :     _u(getFunctor<ADReal>("u")),
      30          48 :     _v(isParamValid("v") ? &getFunctor<ADReal>("v") : nullptr),
      31          24 :     _w(isParamValid("w") ? &getFunctor<ADReal>("w") : nullptr),
      32          24 :     _intensity(getFunctor<ADReal>("intensity")),
      33          24 :     _dim(_subproblem.mesh().dimension())
      34             : {
      35          12 :   if (_dim >= 2 && !_v)
      36           0 :     mooseError(
      37             :         "In two or more dimensions, the v velocity must be supplied using the 'v' parameter");
      38          12 :   if (_dim >= 3 && !_w)
      39           0 :     mooseError("In threedimensions, the w velocity must be supplied using the 'w' parameter");
      40          12 : }
      41             : 
      42             : ADReal
      43        3880 : INSFVInletIntensityTKEBC::boundaryValue(const FaceInfo & fi, const Moose::StateArg & state) const
      44             : {
      45        3880 :   const auto boundary_face = singleSidedFaceArg(&fi);
      46             : 
      47        7760 :   ADRealVectorValue velocity(_u(boundary_face, state));
      48        3880 :   if (_v)
      49        3880 :     velocity(1) = (*_v)(boundary_face, state);
      50        3880 :   if (_w)
      51           0 :     velocity(2) = (*_w)(boundary_face, state);
      52             : 
      53        3880 :   const auto velocity_normal = fi.normal() * velocity;
      54             : 
      55        7760 :   return 1.5 * Utility::pow<2>(_intensity(boundary_face, state) * velocity_normal);
      56             : }

Generated by: LCOV version 1.14