LCOV - code coverage report
Current view: top level - src/linearfvbcs - LinearFVPressureFluxBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 2bd28b Lines: 23 37 62.2 %
Date: 2025-10-23 22:11:45 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         114 : LinearFVPressureFluxBC::validParams()
      16             : {
      17         114 :   InputParameters params = LinearFVAdvectionDiffusionBC::validParams();
      18         114 :   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         228 :   params.addRequiredParam<MooseFunctorName>("HbyA_flux", "The total HbyA face flux value.");
      24         228 :   params.addRequiredParam<MooseFunctorName>(
      25             :       "Ainv", "The 1/A where A is the momentum system diagonal vector.");
      26         114 :   return params;
      27           0 : }
      28             : 
      29          57 : LinearFVPressureFluxBC::LinearFVPressureFluxBC(const InputParameters & parameters)
      30             :   : LinearFVAdvectionDiffusionBC(parameters),
      31          57 :     _HbyA_flux(getFunctor<Real>("HbyA_flux")),
      32         171 :     _Ainv(getFunctor<RealVectorValue>("Ainv"))
      33             : {
      34          57 : }
      35             : 
      36             : Real
      37      183060 : LinearFVPressureFluxBC::computeBoundaryValue() const
      38             : {
      39      183060 :   const auto face_arg = makeCDFace(*_current_face_info);
      40      183060 :   const auto elem_info = _current_face_type == FaceInfo::VarFaceNeighbors::ELEM
      41      183060 :                              ? _current_face_info->elemInfo()
      42           0 :                              : _current_face_info->neighborInfo();
      43      183060 :   const Real distance = computeCellToFaceDistance();
      44             : 
      45      183060 :   return _var.getElemValue(*elem_info, determineState()) -
      46      183060 :          _HbyA_flux(singleSidedFaceArg(_current_face_info), determineState()) /
      47      183060 :              std::max(_Ainv(face_arg, determineState())(0), 1e-8) *
      48      183060 :              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             : 
      57           0 :   const Real distance = computeCellToFaceDistance();
      58             : 
      59           0 :   return -_HbyA_flux(face_arg, determineState()) /
      60           0 :          std::max(_Ainv(face_arg, determineState())(0), 1e-8) * distance;
      61             : }
      62             : 
      63             : Real
      64           0 : LinearFVPressureFluxBC::computeBoundaryValueMatrixContribution() const
      65             : {
      66           0 :   return 1.0;
      67             : }
      68             : 
      69             : Real
      70           0 : LinearFVPressureFluxBC::computeBoundaryValueRHSContribution() const
      71             : {
      72           0 :   const auto face_arg = singleSidedFaceArg(_current_face_info);
      73           0 :   const Real distance = computeCellToFaceDistance();
      74             : 
      75           0 :   return -_HbyA_flux(face_arg, determineState()) /
      76           0 :          std::max(_Ainv(face_arg, determineState())(0), 1e-8) * distance;
      77             : }
      78             : 
      79             : Real
      80      362880 : LinearFVPressureFluxBC::computeBoundaryGradientMatrixContribution() const
      81             : {
      82      362880 :   return 0.0;
      83             : }
      84             : 
      85             : Real
      86      362880 : LinearFVPressureFluxBC::computeBoundaryGradientRHSContribution() const
      87             : {
      88      362880 :   return -_HbyA_flux(singleSidedFaceArg(_current_face_info), determineState());
      89             : }

Generated by: LCOV version 1.14