LCOV - code coverage report
Current view: top level - src/fvbcs - PCNSFVHLLCSpecifiedMassFluxAndTemperatureBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 34 41 82.9 %
Date: 2025-08-14 10:14:56 Functions: 3 3 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 "PCNSFVHLLCSpecifiedMassFluxAndTemperatureBC.h"
      11             : #include "NS.h"
      12             : #include "Function.h"
      13             : #include "SinglePhaseFluidProperties.h"
      14             : 
      15             : InputParameters
      16         270 : PCNSFVHLLCSpecifiedMassFluxAndTemperatureBC::validParams()
      17             : {
      18         270 :   auto params = PCNSFVHLLCBC::validParams();
      19         270 :   params.addRequiredParam<FunctionName>(NS::superficial_momentum_x,
      20             :                                         "The x component of the inlet superficial momentum");
      21         270 :   params.addParam<FunctionName>(NS::superficial_momentum_y,
      22             :                                 "The y component of the inlet superficial momentum");
      23         270 :   params.addParam<FunctionName>(NS::superficial_momentum_z,
      24             :                                 "The z component of the inlet superficial momentum");
      25         270 :   params.addRequiredParam<FunctionName>(NS::temperature, "temperature specified as a function");
      26         270 :   return params;
      27           0 : }
      28             : 
      29         135 : PCNSFVHLLCSpecifiedMassFluxAndTemperatureBC::PCNSFVHLLCSpecifiedMassFluxAndTemperatureBC(
      30         135 :     const InputParameters & parameters)
      31             :   : PCNSFVHLLCBC(parameters),
      32         135 :     _superficial_rhou_boundary(getFunction(NS::superficial_momentum_x)),
      33         135 :     _superficial_rhov_boundary(isParamValid(NS::superficial_momentum_y)
      34         135 :                                    ? &getFunction(NS::superficial_momentum_y)
      35             :                                    : nullptr),
      36         135 :     _superficial_rhow_boundary(isParamValid(NS::superficial_momentum_z)
      37         135 :                                    ? &getFunction(NS::superficial_momentum_z)
      38             :                                    : nullptr),
      39         270 :     _temperature_boundary(getFunction(NS::temperature))
      40             : {
      41         135 :   if (_mesh.dimension() > 1 && !_superficial_rhov_boundary)
      42           0 :     mooseError("If the mesh dimension is greater than 1, a function for the y superficial momentum "
      43             :                "must be provided");
      44         135 :   if (_mesh.dimension() > 2 && !_superficial_rhow_boundary)
      45           0 :     mooseError("If the mesh dimension is greater than 2, a function for the z superficial momentum "
      46             :                "must be provided");
      47         135 : }
      48             : 
      49             : void
      50        1245 : PCNSFVHLLCSpecifiedMassFluxAndTemperatureBC::preComputeWaveSpeed()
      51             : {
      52             :   // rho implicit -> 1 numerical bc
      53        1245 :   _rho_boundary = _rho_elem[_qp];
      54             : 
      55        1245 :   _eps_boundary = _eps_elem[_qp];
      56             : 
      57             :   RealVectorValue mass_flux_boundary(
      58        1245 :       _superficial_rhou_boundary.value(_t, _face_info->faceCentroid()), 0, 0);
      59             :   _vel_boundary.assign(
      60        1245 :       ADRealVectorValue(mass_flux_boundary(0) / _rho_boundary / _eps_boundary, 0, 0));
      61        1245 :   if (_superficial_rhov_boundary)
      62             :   {
      63           0 :     mass_flux_boundary(1) = _superficial_rhov_boundary->value(_t, _face_info->faceCentroid());
      64           0 :     _vel_boundary(1) = mass_flux_boundary(1) / _rho_boundary / _eps_boundary;
      65             :   }
      66        1245 :   if (_superficial_rhow_boundary)
      67             :   {
      68           0 :     mass_flux_boundary(2) = _superficial_rhow_boundary->value(_t, _face_info->faceCentroid());
      69           0 :     _vel_boundary(2) = mass_flux_boundary(2) / _rho_boundary / _eps_boundary;
      70             :   }
      71        1245 :   _normal_speed_boundary = _normal * _vel_boundary;
      72             : 
      73        1245 :   const ADReal T_boundary = _temperature_boundary.value(_t, _face_info->faceCentroid());
      74        1245 :   const ADReal v_boundary = 1 / _rho_boundary;
      75        1245 :   _specific_internal_energy_boundary = _fluid.e_from_T_v(T_boundary, v_boundary);
      76        2490 :   _et_boundary = _specific_internal_energy_boundary + 0.5 * _vel_boundary * _vel_boundary;
      77        1245 :   _rho_et_boundary = _rho_boundary * _et_boundary;
      78        1245 :   _pressure_boundary = _fluid.p_from_T_v(T_boundary, v_boundary);
      79        1245 :   _ht_boundary = _et_boundary + _pressure_boundary / _rho_boundary;
      80        1245 : }

Generated by: LCOV version 1.14