LCOV - code coverage report
Current view: top level - src/bcs - NSWeakStagnationBaseBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 31 33 93.9 %
Date: 2025-08-14 10:14:56 Functions: 6 6 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 "NSWeakStagnationBaseBC.h"
      11             : 
      12             : // FluidProperties includes
      13             : #include "IdealGasFluidProperties.h"
      14             : 
      15             : // Full specialization of the validParams function for this object
      16             : 
      17             : InputParameters
      18         246 : NSWeakStagnationBaseBC::validParams()
      19             : {
      20         246 :   InputParameters params = NSIntegratedBC::validParams();
      21         246 :   params.addClassDescription(
      22             :       "This is the base class for 'weakly-imposed' stagnation boundary conditions.");
      23         492 :   params.addRequiredParam<Real>("stagnation_pressure", "The specifed stagnation pressure");
      24         492 :   params.addRequiredParam<Real>("stagnation_temperature", "The specifed stagnation temperature");
      25         492 :   params.addRequiredParam<Real>("sx", "x-component of specifed flow direction");
      26         492 :   params.addRequiredParam<Real>("sy", "y-component of specifed flow direction");
      27         492 :   params.addParam<Real>("sz", 0.0, "z-component of specifed flow direction"); // only required in 3D
      28         246 :   return params;
      29           0 : }
      30             : 
      31         132 : NSWeakStagnationBaseBC::NSWeakStagnationBaseBC(const InputParameters & parameters)
      32             :   : NSIntegratedBC(parameters),
      33         132 :     _stagnation_pressure(getParam<Real>("stagnation_pressure")),
      34         264 :     _stagnation_temperature(getParam<Real>("stagnation_temperature")),
      35         264 :     _sx(getParam<Real>("sx")),
      36         264 :     _sy(getParam<Real>("sy")),
      37         396 :     _sz(getParam<Real>("sz"))
      38             : {
      39         132 : }
      40             : 
      41             : void
      42      685440 : NSWeakStagnationBaseBC::staticValues(Real & T_s, Real & p_s, Real & rho_s)
      43             : {
      44             :   // T_s = T_0 - |u|^2/2/cp
      45      685440 :   T_s = _stagnation_temperature - 0.5 * this->velmag2() / _fp.cp();
      46             : 
      47      685440 :   if (T_s < 0.)
      48           0 :     mooseError("Negative temperature detected in NSWeakStagnationBaseBC!");
      49             : 
      50             :   // p_s = p_0 * (T_0/T)^(-gam/(gam-1))
      51     1370880 :   p_s = _stagnation_pressure *
      52      685440 :         std::pow(_stagnation_temperature / T_s, -_fp.gamma() / (_fp.gamma() - 1.));
      53             : 
      54             :   // Compute static rho from static pressure and temperature using equation of state.
      55      685440 :   rho_s = _fp.rho_from_p_T(p_s, T_s);
      56      685440 : }
      57             : 
      58             : Real
      59      114240 : NSWeakStagnationBaseBC::rhoStatic()
      60             : {
      61      114240 :   Real T_s = 0., p_s = 0., rho_s = 0.;
      62      114240 :   staticValues(T_s, p_s, rho_s);
      63      114240 :   return rho_s;
      64             : }
      65             : 
      66             : Real
      67     1142400 : NSWeakStagnationBaseBC::velmag2()
      68             : {
      69     1142400 :   return _u_vel[_qp] * _u_vel[_qp] + _v_vel[_qp] * _v_vel[_qp] + _w_vel[_qp] * _w_vel[_qp];
      70             : }
      71             : 
      72             : Real
      73      456960 : NSWeakStagnationBaseBC::sdotn()
      74             : {
      75      456960 :   return _sx * _normals[_qp](0) + _sy * _normals[_qp](1) + _sz * _normals[_qp](2);
      76             : }

Generated by: LCOV version 1.14