LCOV - code coverage report
Current view: top level - src/bcs - NSMomentumInviscidSpecifiedPressureBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 19 20 95.0 %
Date: 2025-08-14 10:14:56 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 "NSMomentumInviscidSpecifiedPressureBC.h"
      11             : 
      12             : registerMooseObject("NavierStokesApp", NSMomentumInviscidSpecifiedPressureBC);
      13             : 
      14             : InputParameters
      15          82 : NSMomentumInviscidSpecifiedPressureBC::validParams()
      16             : {
      17          82 :   InputParameters params = NSMomentumInviscidBC::validParams();
      18          82 :   params.addClassDescription("Momentum equation boundary condition in which pressure is specified "
      19             :                              "(given) and the value of the convective part is allowed to vary (is "
      20             :                              "computed implicitly).");
      21          82 :   return params;
      22           0 : }
      23             : 
      24          44 : NSMomentumInviscidSpecifiedPressureBC::NSMomentumInviscidSpecifiedPressureBC(
      25          44 :     const InputParameters & parameters)
      26          88 :   : NSMomentumInviscidBC(parameters), _specified_pressure(getParam<Real>("specified_pressure"))
      27             : {
      28          44 : }
      29             : 
      30             : Real
      31      228480 : NSMomentumInviscidSpecifiedPressureBC::computeQpResidual()
      32             : {
      33             :   // Velocity vector object
      34      228480 :   RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
      35             : 
      36             :   // Velocity vector dotted with normal
      37      228480 :   Real u_dot_n = vel * _normals[_qp];
      38             : 
      39             :   // The current value of the vector (rho*u)(u.n)
      40      228480 :   RealVectorValue rhou_udotn = u_dot_n * _rho[_qp] * vel;
      41             : 
      42      228480 :   return pressureQpResidualHelper(_specified_pressure) +
      43      228480 :          convectiveQpResidualHelper(rhou_udotn(_component));
      44             : }
      45             : 
      46             : Real
      47      139776 : NSMomentumInviscidSpecifiedPressureBC::computeQpJacobian()
      48             : {
      49             :   // There is no Jacobian for the pressure term when the pressure is specified,
      50             :   // so all we have left is the convective part.  The on-diagonal variable number
      51             :   // is _component+1
      52      139776 :   return convectiveQpJacobianHelper(_component + 1);
      53             : }
      54             : 
      55             : Real
      56      419328 : NSMomentumInviscidSpecifiedPressureBC::computeQpOffDiagJacobian(unsigned jvar)
      57             : {
      58      419328 :   if (isNSVariable(jvar))
      59      419328 :     return convectiveQpJacobianHelper(mapVarNumber(jvar));
      60             :   else
      61             :     return 0.0;
      62             : }

Generated by: LCOV version 1.14