LCOV - code coverage report
Current view: top level - src/fvbcs - INSFVMassAdvectionOutflowBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: #32971 (54bef8) with base c6cf66 Lines: 27 31 87.1 %
Date: 2026-05-29 20:37:52 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 "INSFVMassAdvectionOutflowBC.h"
      11             : #include "INSFVVelocityVariable.h"
      12             : #include "SubProblem.h"
      13             : #include "MooseMesh.h"
      14             : #include "NS.h"
      15             : 
      16             : registerADMooseObject("NavierStokesApp", INSFVMassAdvectionOutflowBC);
      17             : 
      18             : InputParameters
      19          76 : INSFVMassAdvectionOutflowBC::validParams()
      20             : {
      21          76 :   InputParameters params = FVFluxBC::validParams();
      22          76 :   params += INSFVFullyDevelopedFlowBC::validParams();
      23          76 :   params.addClassDescription("Outflow boundary condition for advecting mass.");
      24         152 :   params.addRequiredParam<MooseFunctorName>(NS::density, "The functor for the density");
      25         152 :   params.declareControllable("rho");
      26         152 :   params.addRequiredParam<MooseFunctorName>("u", "The velocity in the x direction.");
      27         152 :   params.addParam<MooseFunctorName>("v", "The velocity in the y direction.");
      28         152 :   params.addParam<MooseFunctorName>("w", "The velocity in the z direction.");
      29          76 :   return params;
      30           0 : }
      31             : 
      32          40 : INSFVMassAdvectionOutflowBC::INSFVMassAdvectionOutflowBC(const InputParameters & params)
      33             :   : FVFluxBC(params),
      34             :     INSFVFullyDevelopedFlowBC(params),
      35          80 :     _rho(getFunctor<ADReal>(NS::density)),
      36          80 :     _u(getFunctor<ADReal>("u")),
      37         160 :     _v(isParamValid("v") ? &getFunctor<ADReal>("v") : nullptr),
      38          80 :     _w(isParamValid("w") ? &getFunctor<ADReal>("w") : nullptr),
      39          80 :     _dim(_subproblem.mesh().dimension())
      40             : {
      41          40 :   if (_dim >= 2 && !_v)
      42           0 :     mooseError(
      43             :         "In two or more dimensions, the v velocity must be supplied using the 'v' parameter");
      44          40 :   if (_dim >= 3 && !_w)
      45           0 :     mooseError("In threedimensions, the w velocity must be supplied using the 'w' parameter");
      46          40 : }
      47             : 
      48             : ADReal
      49        2372 : INSFVMassAdvectionOutflowBC::computeQpResidual()
      50             : {
      51        2372 :   const auto boundary_face = singleSidedFaceArg();
      52        2372 :   const auto state = determineState();
      53             : 
      54        4744 :   ADRealVectorValue v(_u(boundary_face, state));
      55        2372 :   if (_v)
      56        2372 :     v(1) = (*_v)(boundary_face, state);
      57        2372 :   if (_w)
      58           0 :     v(2) = (*_w)(boundary_face, state);
      59             : 
      60        2372 :   return _normal * v * _rho(boundary_face, state);
      61             : }

Generated by: LCOV version 1.14