LCOV - code coverage report
Current view: top level - src/bcs - NSStagnationPressureBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 0 15 0.0 %
Date: 2025-08-14 10:14:56 Functions: 0 3 0.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             : // Navier-Stokes inclues
      11             : #include "NSStagnationPressureBC.h"
      12             : #include "NS.h"
      13             : 
      14             : // FluidProperties includes
      15             : #include "IdealGasFluidProperties.h"
      16             : 
      17             : // Full specialization of the validParams function for this object
      18             : registerMooseObject("NavierStokesApp", NSStagnationPressureBC);
      19             : 
      20             : InputParameters
      21           0 : NSStagnationPressureBC::validParams()
      22             : {
      23           0 :   InputParameters params = NSStagnationBC::validParams();
      24           0 :   params.addClassDescription("This Dirichlet condition imposes the condition p_0 = p_0_desired.");
      25           0 :   params.addRequiredCoupledVar(NS::pressure, "pressure");
      26           0 :   params.addRequiredParam<Real>("desired_stagnation_pressure", "");
      27           0 :   return params;
      28           0 : }
      29             : 
      30           0 : NSStagnationPressureBC::NSStagnationPressureBC(const InputParameters & parameters)
      31             :   : NSStagnationBC(parameters),
      32           0 :     _pressure(coupledValue(NS::pressure)),
      33           0 :     _desired_stagnation_pressure(getParam<Real>("desired_stagnation_pressure"))
      34             : {
      35           0 : }
      36             : 
      37             : Real
      38           0 : NSStagnationPressureBC::computeQpResidual()
      39             : {
      40             :   // p_0 = p*(1 + 0.5*(gam-1)*M^2)^(gam/(gam-1))
      41             :   const Real computed_stagnation_pressure =
      42           0 :       _pressure[_qp] * std::pow(1. + 0.5 * (_fp.gamma() - 1.) * _mach[_qp] * _mach[_qp],
      43           0 :                                 _fp.gamma() / (_fp.gamma() - 1.));
      44             : 
      45             :   // Return the difference between the current solution's stagnation pressure
      46             :   // and the desired.  The Dirichlet condition asserts that these should be equal.
      47           0 :   return computed_stagnation_pressure - _desired_stagnation_pressure;
      48             : }

Generated by: LCOV version 1.14