LCOV - code coverage report
Current view: top level - src/fluidproperties - PBSodiumFluidProperties.C (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #31405 (292dce) with base fef103 Lines: 77 83 92.8 %
Date: 2025-09-04 07:58:06 Functions: 15 15 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 "PBSodiumFluidProperties.h"
      11             : 
      12             : registerMooseObject("SubChannelApp", PBSodiumFluidProperties);
      13             : 
      14             : // Use the array to initialize the const static vector
      15             : const Real sodium_T[] = {
      16             :     388.15,  398.15,  408.15,  418.15,  428.15,  438.15,  448.15,  458.15,  468.15,  478.15,
      17             :     488.15,  498.15,  508.15,  518.15,  528.15,  538.15,  548.15,  558.15,  568.15,  578.15,
      18             :     588.15,  598.15,  608.15,  618.15,  628.15,  638.15,  648.15,  658.15,  668.15,  678.15,
      19             :     688.15,  698.15,  708.15,  718.15,  728.15,  738.15,  748.15,  758.15,  768.15,  778.15,
      20             :     788.15,  798.15,  808.15,  818.15,  828.15,  838.15,  848.15,  858.15,  868.15,  878.15,
      21             :     888.15,  898.15,  908.15,  918.15,  928.15,  938.15,  948.15,  958.15,  968.15,  978.15,
      22             :     988.15,  998.15,  1008.15, 1018.15, 1028.15, 1038.15, 1048.15, 1058.15, 1068.15, 1078.15,
      23             :     1088.15, 1098.15, 1108.15, 1118.15, 1128.15, 1138.15, 1148.15};
      24             : // sodium temperature vector corresponding to _e_vec enthalpy vector
      25             : const std::vector<Real>
      26             :     PBSodiumFluidProperties::_temperature_vec(sodium_T,
      27             :                                               sodium_T + sizeof(sodium_T) / sizeof(sodium_T[0]));
      28             : 
      29             : const Real sodium_e[] = {
      30             :     492755,      505884,      518995,      532089,      545166,      558227,      571270,
      31             :     584298,      597309,      610305,      623286,      636252,      649203,      662139,
      32             :     675061,      687970,      700865,      713747,      726616,      739472,      752316,
      33             :     765148,      777969,      790778,      803576,      816363,      829140,      841907,
      34             :     854665,      867413,      880151,      892882,      905603,      918317,      931023,
      35             :     943721,      956412,      969097,      981775,      994447,      1.00711e+06, 1.01977e+06,
      36             :     1.03243e+06, 1.04508e+06, 1.05773e+06, 1.07037e+06, 1.08301e+06, 1.09565e+06, 1.10828e+06,
      37             :     1.12091e+06, 1.13354e+06, 1.14617e+06, 1.15879e+06, 1.17142e+06, 1.18404e+06, 1.19667e+06,
      38             :     1.20929e+06, 1.22191e+06, 1.23454e+06, 1.24717e+06, 1.25979e+06, 1.27243e+06, 1.28506e+06,
      39             :     1.29769e+06, 1.31033e+06, 1.32298e+06, 1.33562e+06, 1.34828e+06, 1.36093e+06, 1.3736e+06,
      40             :     1.38626e+06, 1.39894e+06, 1.41162e+06, 1.42431e+06, 1.43701e+06, 1.44971e+06, 1.46243e+06};
      41             : // sodium enthalpy vector corresponding to _temperature_vec temperature vector
      42             : const std::vector<Real>
      43             :     PBSodiumFluidProperties::_e_vec(sodium_e, sodium_e + sizeof(sodium_e) / sizeof(sodium_e[0]));
      44             : 
      45             : InputParameters
      46         286 : PBSodiumFluidProperties::validParams()
      47             : {
      48         286 :   InputParameters params = SinglePhaseFluidProperties::validParams();
      49         572 :   params.addParam<Real>("p_0", 1.e5, "Reference pressure");
      50         286 :   params.addClassDescription(
      51             :       "Class that provides the methods that realize the equations of state for Liquid Sodium");
      52         286 :   return params;
      53           0 : }
      54             : 
      55         155 : PBSodiumFluidProperties::PBSodiumFluidProperties(const InputParameters & parameters)
      56         310 :   : SinglePhaseFluidProperties(parameters), _p_0(getParam<Real>("p_0"))
      57             : {
      58         155 :   _H0 = cp_from_p_T(_p_0, _T0) * _T0;
      59         155 :   _Cp_Tmax = cp_from_p_T(_p_0, _Tmax);
      60         155 :   _Cp_Tmin = cp_from_p_T(_p_0, _Tmin);
      61         155 :   _H_Tmax = h_from_p_T(_p_0, _Tmax);
      62         155 :   _H_Tmin = h_from_p_T(_p_0, _Tmin);
      63         155 : }
      64             : 
      65             : Real
      66     4015951 : PBSodiumFluidProperties::rho_from_p_T(Real /*pressure*/, Real temperature) const
      67             : {
      68             :   Real A12 = 1.00423e3;
      69             :   Real A13 = -0.21390;
      70             :   Real A14 = -1.1046e-5;
      71     4015951 :   return (A12 + A13 * temperature + A14 * temperature * temperature);
      72             : }
      73             : 
      74             : void
      75           1 : PBSodiumFluidProperties::rho_from_p_T(
      76             :     Real pressure, Real temperature, Real & rho, Real & drho_dp, Real & drho_dT) const
      77             : {
      78           1 :   rho = rho_from_p_T(pressure, temperature);
      79           1 :   drho_dp = 0;
      80             :   Real A13 = -0.21390;
      81             :   Real A14 = -1.1046e-5;
      82           1 :   drho_dT = (A13 + 2.0 * A14 * temperature);
      83           1 : }
      84             : 
      85             : Real
      86      395375 : PBSodiumFluidProperties::h_from_p_T(Real /*pressure*/, Real temperature) const
      87             : {
      88      395375 :   if (temperature > _Tmax + 1.e-3)
      89           0 :     return _H_Tmax + _Cp_Tmax * (temperature - _Tmax);
      90      395375 :   else if (temperature < _Tmin - 1.e-3)
      91       25200 :     return _H_Tmin + _Cp_Tmin * (temperature - _Tmin);
      92             :   else
      93      370175 :     return _H0 + F_enthalpy(temperature) - F_enthalpy(_T0);
      94             : }
      95             : 
      96             : Real
      97           1 : PBSodiumFluidProperties::beta_from_p_T(Real /*pressure*/, Real temperature) const
      98             : {
      99             :   Real A42 = 2.5156e-6;
     100             :   Real A43 = 0.79919;
     101             :   Real A44 = -6.9716e2;
     102             :   Real A45 = 3.3140e5;
     103             :   Real A46 = -7.0502e7;
     104             :   Real A47 = 5.4920e9;
     105           1 :   Real dt = 2503.3 - temperature;
     106           1 :   return (A42 + A43 / dt + A44 / dt / dt + A45 / (dt * dt * dt) + A46 / (dt * dt * dt * dt) +
     107           1 :           A47 / (dt * dt * dt * dt * dt));
     108             : }
     109             : 
     110             : Real
     111           1 : PBSodiumFluidProperties::cv_from_p_T(Real pressure, Real temperature) const
     112             : {
     113             :   // Consistent with SAM model cv is assumed to be equal to cp
     114             :   // cv is currentl not being used in subchannel algorithm.
     115           1 :   return cp_from_p_T(pressure, temperature);
     116             : }
     117             : 
     118             : Real
     119    33488285 : PBSodiumFluidProperties::cp_from_p_T(Real /*pressure*/, Real temperature) const
     120             : {
     121    33488285 :   if (temperature < 388.15)
     122             :   {
     123         155 :     temperature = 388.15;
     124         155 :     _console << "Warning - minimum temperature in cp caluclation bounded to 388.15 K \n";
     125             :   }
     126    33488285 :   if (temperature > 1148.15)
     127             :   {
     128         155 :     temperature = 1148.15;
     129         155 :     _console << "Warning - maximum temperature bounded in cp calculation to 1148.15 \n";
     130             :   }
     131    33488285 :   temperature = temperature_correction(temperature);
     132             :   Real A28 = 7.3898e5;
     133             :   Real A29 = 3.154e5;
     134             :   Real A30 = 1.1340e3;
     135             :   Real A31 = -2.2153e-1;
     136             :   Real A32 = 1.1156e-4;
     137    33488285 :   Real dt = 2503.3 - temperature;
     138    33488285 :   return (A28 / dt / dt + A29 / dt + A30 + A31 * dt + A32 * dt * dt);
     139             : }
     140             : 
     141             : void
     142           1 : PBSodiumFluidProperties::cp_from_p_T(
     143             :     Real pressure, Real temperature, Real & cp, Real & dcp_dp, Real & dcp_dT) const
     144             : {
     145           1 :   cp = cp_from_p_T(pressure, temperature);
     146           1 :   dcp_dp = 0;
     147             :   Real A28 = 7.3898e5;
     148             :   Real A29 = 3.154e5;
     149             :   Real A31 = -2.2153e-1;
     150             :   Real A32 = 1.1156e-4;
     151           1 :   Real dt = 2503.3 - temperature;
     152           1 :   if (temperature < _Tmax && temperature > _Tmin)
     153           1 :     dcp_dT = (2 * A28 / dt / dt / dt + A29 / dt / dt - A31 - 2 * A32 * dt);
     154             :   else
     155           0 :     dcp_dT = 0.;
     156           1 : }
     157             : 
     158             : Real
     159     4015945 : PBSodiumFluidProperties::mu_from_p_T(Real /*pressure*/, Real temperature) const
     160             : {
     161             :   Real A52 = 3.6522e-5;
     162             :   Real A53 = 0.16626;
     163             :   Real A54 = -4.56877e1;
     164             :   Real A55 = 2.8733e4;
     165     4015945 :   return (A52 + A53 / temperature + A54 / temperature / temperature +
     166     4015945 :           A55 / (temperature * temperature * temperature));
     167             : }
     168             : 
     169             : Real
     170           1 : PBSodiumFluidProperties::mu_from_rho_T(Real /*rho*/, Real temperature) const
     171             : {
     172             :   Real A52 = 3.6522e-5;
     173             :   Real A53 = 0.16626;
     174             :   Real A54 = -4.56877e1;
     175             :   Real A55 = 2.8733e4;
     176           1 :   return (A52 + A53 / temperature + A54 / temperature / temperature +
     177           1 :           A55 / (temperature * temperature * temperature));
     178             : }
     179             : 
     180             : Real
     181    33523021 : PBSodiumFluidProperties::k_from_p_T(Real /*pressure*/, Real temperature) const
     182             : {
     183    33523021 :   if (temperature < 388.15)
     184             :   {
     185             :     temperature = 388.15;
     186             :     _console << "Warning - minimum temperature in thermal conductivity caluclation bounded to "
     187           0 :                 "388.15 K \n";
     188             :   }
     189    33523021 :   if (temperature > 1148.15)
     190             :   {
     191             :     temperature = 1148.15;
     192             :     _console << "Warning - maximum temperature bounded in thermal conductivity calculation to "
     193           0 :                 "1148.15 \n";
     194             :   }
     195             :   Real A48 = 1.1045e2;
     196             :   Real A49 = -6.5112e-2;
     197             :   Real A50 = 1.5430e-5;
     198             :   Real A51 = -2.4617e-9;
     199    33523021 :   return (A48 + A49 * temperature + A50 * temperature * temperature +
     200    33523021 :           A51 * temperature * temperature * temperature);
     201             : }
     202             : 
     203             : Real
     204      740350 : PBSodiumFluidProperties::F_enthalpy(Real temperature) const
     205             : {
     206             :   Real A28 = 7.3898e5;
     207             :   Real A29 = 3.154e5;
     208             :   Real A30 = 1.1340e3;
     209             :   Real A31 = -2.2153e-1;
     210             :   Real A32 = 1.1156e-4;
     211      740350 :   Real dt = 2503.3 - temperature;
     212             : 
     213      740350 :   return -(-A28 / dt + A29 * std::log(dt) + A30 * dt + 0.5 * A31 * dt * dt +
     214      740350 :            1.0 / 3 * A32 * dt * dt * dt);
     215             : }
     216             : 
     217             : Real
     218    33488285 : PBSodiumFluidProperties::temperature_correction(Real & temperature) const
     219             : {
     220    33488285 :   if (temperature > _Tmax)
     221             :     return _Tmax;
     222    33488285 :   else if (temperature < _Tmin)
     223             :     return _Tmin;
     224             :   else
     225    33488285 :     return temperature;
     226             : }
     227             : 
     228             : Real
     229     3607135 : PBSodiumFluidProperties::T_from_p_h(Real /*pressure*/, Real enthalpy) const
     230             : {
     231             :   // the algorithm were made fully compliant with the enthalpy correlations above.
     232             :   // Consistent with the approach in SAM, it ignores that sodium boiling.
     233             :   // This part will be revisited in future.
     234             :   Real temperature = 0;
     235     3607135 :   if (enthalpy > _H_Tmax)
     236             :   {
     237           0 :     temperature = (enthalpy - _H_Tmax) / _Cp_Tmax + _Tmax;
     238             :   }
     239     3607135 :   else if (enthalpy < _H_Tmin)
     240             :   {
     241          30 :     temperature = (enthalpy - _H_Tmin) / _Cp_Tmin + _Tmin;
     242             :   }
     243             :   else
     244             :   {
     245    95120404 :     for (unsigned int i = 0; i < _e_vec.size() - 1; i++)
     246             :     {
     247    95120404 :       if (enthalpy > _e_vec[i] && enthalpy <= _e_vec[i + 1])
     248             :       {
     249     3607105 :         temperature = _temperature_vec[i] + (enthalpy - _e_vec[i]) / (_e_vec[i + 1] - _e_vec[i]) *
     250     3607105 :                                                 (_temperature_vec[i + 1] - _temperature_vec[i]);
     251     3607105 :         break;
     252             :       }
     253             :     }
     254             :   }
     255     3607135 :   return temperature;
     256             : }

Generated by: LCOV version 1.14