LCOV - code coverage report
Current view: top level - src/linearfvbcs - LinearFVPressureFluxBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: #32971 (54bef8) with base c6cf66 Lines: 23 36 63.9 %
Date: 2026-05-29 20:37:52 Functions: 5 8 62.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://www.mooseframework.org
       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 "LinearFVPressureFluxBC.h"
      11             : 
      12             : registerMooseObject("NavierStokesApp", LinearFVPressureFluxBC);
      13             : 
      14             : InputParameters
      15         144 : LinearFVPressureFluxBC::validParams()
      16             : {
      17         144 :   InputParameters params = LinearFVAdvectionDiffusionBC::validParams();
      18         144 :   params.addClassDescription(
      19             :       "Adds a fixed diffusive flux BC which can be used for the assembly of linear "
      20             :       "finite volume system and whose normal face gradient values are determined "
      21             :       "using the H/A flux. This kernel is only designed to work with advection-diffusion "
      22             :       "problems.");
      23         288 :   params.addRequiredParam<MooseFunctorName>("HbyA_flux", "The total HbyA face flux value.");
      24         288 :   params.addRequiredParam<MooseFunctorName>(
      25             :       "Ainv", "The 1/A where A is the momentum system diagonal vector.");
      26         144 :   return params;
      27           0 : }
      28             : 
      29          72 : LinearFVPressureFluxBC::LinearFVPressureFluxBC(const InputParameters & parameters)
      30             :   : LinearFVAdvectionDiffusionBC(parameters),
      31          72 :     _HbyA_flux(getFunctor<Real>("HbyA_flux")),
      32         216 :     _Ainv(getFunctor<RealVectorValue>("Ainv"))
      33             : {
      34          72 : }
      35             : 
      36             : Real
      37      161376 : LinearFVPressureFluxBC::computeBoundaryValue() const
      38             : {
      39      161376 :   const auto face_arg = makeCDFace(*_current_face_info);
      40      161376 :   const auto elem_info = _current_face_type == FaceInfo::VarFaceNeighbors::ELEM
      41      161376 :                              ? _current_face_info->elemInfo()
      42           0 :                              : _current_face_info->neighborInfo();
      43      161376 :   const Real distance = computeCellToFaceDistance();
      44             : 
      45      161376 :   return _var.getElemValue(*elem_info, determineState()) -
      46      161376 :          _HbyA_flux(singleSidedFaceArg(_current_face_info), determineState()) /
      47      161376 :              std::max(_Ainv(face_arg, determineState())(0), 1e-8) *
      48      161376 :              distance; // We use the 0th component of Ainv. Components of Ainv are
      49             :                        // equal for most applications, and Ainv(0) has a value for 1D,2D,3D.
      50             : }
      51             : 
      52             : Real
      53           0 : LinearFVPressureFluxBC::computeBoundaryNormalGradient() const
      54             : {
      55           0 :   const auto face_arg = singleSidedFaceArg(_current_face_info);
      56           0 :   return -_HbyA_flux(face_arg, determineState()) /
      57           0 :          std::max(_Ainv(face_arg, determineState())(0), 1e-8);
      58             : }
      59             : 
      60             : Real
      61           0 : LinearFVPressureFluxBC::computeBoundaryValueMatrixContribution() const
      62             : {
      63           0 :   return 1.0;
      64             : }
      65             : 
      66             : Real
      67           0 : LinearFVPressureFluxBC::computeBoundaryValueRHSContribution() const
      68             : {
      69           0 :   const auto face_arg = singleSidedFaceArg(_current_face_info);
      70           0 :   const Real distance = computeCellToFaceDistance();
      71             : 
      72           0 :   return -_HbyA_flux(face_arg, determineState()) /
      73           0 :          std::max(_Ainv(face_arg, determineState())(0), 1e-8) * distance;
      74             : }
      75             : 
      76             : Real
      77      319872 : LinearFVPressureFluxBC::computeBoundaryGradientMatrixContribution() const
      78             : {
      79      319872 :   return 0.0;
      80             : }
      81             : 
      82             : Real
      83      319872 : LinearFVPressureFluxBC::computeBoundaryGradientRHSContribution() const
      84             : {
      85      319872 :   return -_HbyA_flux(singleSidedFaceArg(_current_face_info), determineState());
      86             : }

Generated by: LCOV version 1.14