LCOV - code coverage report
Current view: top level - src/fluidproperties - LeadLithiumFluidProperties.C (source / functions) Hit Total Coverage
Test: idaholab/moose fluid_properties: #31405 (292dce) with base fef103 Lines: 195 204 95.6 %
Date: 2025-09-04 07:53:14 Functions: 43 45 95.6 %
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 "LeadLithiumFluidProperties.h"
      11             : 
      12             : registerMooseObject("FluidPropertiesApp", LeadLithiumFluidProperties);
      13             : 
      14             : InputParameters
      15           8 : LeadLithiumFluidProperties::validParams()
      16             : {
      17           8 :   InputParameters params = SinglePhaseFluidProperties::validParams();
      18           8 :   params.addClassDescription("Fluid properties for Lead Lithium eutectic (83% Pb, 17% Li)");
      19           8 :   return params;
      20           0 : }
      21             : 
      22           4 : LeadLithiumFluidProperties::LeadLithiumFluidProperties(const InputParameters & parameters)
      23           4 :   : SinglePhaseFluidProperties(parameters)
      24             : {
      25           4 : }
      26             : 
      27             : std::string
      28           1 : LeadLithiumFluidProperties::fluidName() const
      29             : {
      30           1 :   return "LeadLithium";
      31             : }
      32             : 
      33             : Real
      34           1 : LeadLithiumFluidProperties::molarMass() const
      35             : {
      36             :   // Approximate molar mass for 83% Pb (207.2 g/mol) and 17% Li (6.94 g/mol) by atomic fraction
      37           1 :   return 1.73e-1; // in kg/mol
      38             : }
      39             : 
      40             : Real
      41         137 : LeadLithiumFluidProperties::rho_from_p_T(Real /*p*/, Real T) const
      42             : {
      43         137 :   if (T < _T_mo || T > 880)
      44          28 :     flagInvalidSolution("Temperature out of bounds for the PbLi density computation");
      45         137 :   return 10520.35 - 1.19051 * T;
      46             : }
      47             : 
      48             : void
      49          33 : LeadLithiumFluidProperties::rho_from_p_T(
      50             :     Real p, Real T, Real & rho, Real & drho_dp, Real & drho_dT) const
      51             : {
      52          33 :   rho = rho_from_p_T(p, T);
      53          33 :   drho_dp = 0;
      54          33 :   drho_dT = -1.19051;
      55          33 : }
      56             : 
      57             : void
      58           0 : LeadLithiumFluidProperties::rho_from_p_T(
      59             :     const ADReal & p, const ADReal & T, ADReal & rho, ADReal & drho_dp, ADReal & drho_dT) const
      60             : {
      61           0 :   rho = SinglePhaseFluidProperties::rho_from_p_T(p, T);
      62           0 :   drho_dp = 0;
      63           0 :   drho_dT = -1.19051;
      64           0 : }
      65             : 
      66             : Real
      67          48 : LeadLithiumFluidProperties::v_from_p_T(Real p, Real T) const
      68             : {
      69          48 :   return 1.0 / rho_from_p_T(p, T);
      70             : }
      71             : 
      72             : void
      73           3 : LeadLithiumFluidProperties::v_from_p_T(Real p, Real T, Real & v, Real & dv_dp, Real & dv_dT) const
      74             : {
      75           3 :   v = v_from_p_T(p, T);
      76           3 :   dv_dp = 0;
      77           3 :   dv_dT = 1.19051 / Utility::pow<2>(10520.35 - 1.19051 * T);
      78           3 : }
      79             : 
      80             : Real
      81         140 : LeadLithiumFluidProperties::T_from_v_e(Real v, Real /*e*/) const
      82             : {
      83         140 :   Real T = (10520.35 - 1.0 / v) / 1.19051;
      84             :   // This is computed from rho(T), thus shares the same validity range
      85         140 :   if (T < _T_mo || T > 880)
      86          28 :     flagInvalidSolution("Specific volume out of bounds for the PbLi temperature computation");
      87         140 :   return T;
      88             : }
      89             : 
      90             : void
      91           8 : LeadLithiumFluidProperties::T_from_v_e(Real v, Real e, Real & T, Real & dT_dv, Real & dT_de) const
      92             : {
      93           8 :   T = T_from_v_e(v, e);
      94           8 :   dT_de = 0;
      95           8 :   dT_dv = 1.0 / (1.19051 * v * v);
      96           8 : }
      97             : 
      98             : Real
      99          41 : LeadLithiumFluidProperties::bulk_modulus_from_p_T(Real /*p*/, Real T) const
     100             : {
     101          41 :   return Utility::pow<2>(c_from_p_T(0, T)) * rho_from_p_T(0, T);
     102             : }
     103             : 
     104             : Real
     105          50 : LeadLithiumFluidProperties::c_from_p_T(Real /*p*/, Real T) const
     106             : {
     107          50 :   return 1876 - 0.306 * T;
     108             : }
     109             : 
     110             : Real
     111           9 : LeadLithiumFluidProperties::c_from_v_e(Real v, Real e) const
     112             : {
     113           9 :   Real T = T_from_v_e(v, e);
     114           9 :   return 1876 - 0.306 * T;
     115             : }
     116             : 
     117             : ADReal
     118           0 : LeadLithiumFluidProperties::c_from_v_e(const ADReal & v, const ADReal & e) const
     119             : {
     120           0 :   ADReal T = SinglePhaseFluidProperties::T_from_v_e(v, e);
     121           0 :   return 1876 - 0.306 * T;
     122             : }
     123             : 
     124             : Real
     125          30 : LeadLithiumFluidProperties::p_from_v_e(Real v, Real e) const
     126             : {
     127          30 :   Real h = h_from_v_e(v, e);
     128          30 :   return (h - e) / v;
     129             : }
     130             : 
     131             : void
     132           2 : LeadLithiumFluidProperties::p_from_v_e(Real v, Real e, Real & p, Real & dp_dv, Real & dp_de) const
     133             : {
     134           2 :   p = p_from_v_e(v, e);
     135             :   Real h, dh_dv, dh_de;
     136           2 :   h_from_v_e(v, e, h, dh_dv, dh_de);
     137           2 :   dp_dv = (v * dh_dv - h + e) / (v * v);
     138           2 :   dp_de = (dh_de - 1) / v;
     139           2 : }
     140             : 
     141             : Real
     142          18 : LeadLithiumFluidProperties::cp_from_v_e(Real v, Real e) const
     143             : {
     144          18 :   Real T = T_from_v_e(v, e);
     145          18 :   if (T < _T_mo || T > 800)
     146           4 :     flagInvalidSolution("Temperature out of bounds for the PbLi specific heat computation");
     147          18 :   return 195.0 - 9.116e-3 * T;
     148             : }
     149             : 
     150             : void
     151           1 : LeadLithiumFluidProperties::cp_from_v_e(
     152             :     Real v, Real e, Real & cp, Real & dcp_dv, Real & dcp_de) const
     153             : {
     154             :   Real T, dT_dv, dT_de;
     155           1 :   T_from_v_e(v, e, T, dT_dv, dT_de);
     156           1 :   cp = cp_from_v_e(v, e);
     157             :   const Real dcp_dT = -9.116e-3;
     158           1 :   dcp_dv = dcp_dT * dT_dv;
     159           1 :   dcp_de = dcp_dT * dT_de;
     160           1 : }
     161             : 
     162             : Real
     163          32 : LeadLithiumFluidProperties::cv_from_p_T(Real p, Real T) const
     164             : {
     165             :   Real rho, drho_dT, drho_dp;
     166          32 :   rho_from_p_T(p, T, rho, drho_dp, drho_dT);
     167          32 :   Real alpha = -drho_dT / rho;
     168          32 :   Real bulk_modulus = bulk_modulus_from_p_T(p, T);
     169          32 :   Real cp = cp_from_p_T(p, T);
     170          32 :   return cp / (1.0 + alpha * alpha * bulk_modulus * T / (rho * cp));
     171             : }
     172             : 
     173             : void
     174           2 : LeadLithiumFluidProperties::cv_from_p_T(
     175             :     Real p, Real T, Real & cv, Real & dcv_dp, Real & dcv_dT) const
     176             : {
     177           2 :   cv = cv_from_p_T(p, T);
     178             :   // A full analytical derivative is complex; here we assume minimal pressure dependence.
     179           2 :   dcv_dp = 0;
     180             :   const Real dT = 1e-6;
     181           2 :   Real cv_plus = cv_from_p_T(p, T + dT);
     182           2 :   dcv_dT = (cv_plus - cv) / dT;
     183           2 : }
     184             : 
     185             : Real
     186          14 : LeadLithiumFluidProperties::cv_from_v_e(Real v, Real e) const
     187             : {
     188          14 :   Real p = p_from_v_e(v, e);
     189          14 :   Real T = T_from_v_e(v, e);
     190          14 :   return cv_from_p_T(p, T);
     191             : }
     192             : 
     193             : void
     194           1 : LeadLithiumFluidProperties::cv_from_v_e(
     195             :     Real v, Real e, Real & cv, Real & dcv_dv, Real & dcv_de) const
     196             : {
     197             :   Real p, dp_dv, dp_de;
     198           1 :   p_from_v_e(v, e, p, dp_dv, dp_de);
     199             :   Real T, dT_dv, dT_de;
     200           1 :   T_from_v_e(v, e, T, dT_dv, dT_de);
     201             :   Real dcv_dp, dcv_dT;
     202           1 :   cv_from_p_T(p, T, cv, dcv_dp, dcv_dT);
     203           1 :   dcv_dv = dcv_dp * dp_dv + dcv_dT * dT_dv;
     204           1 :   dcv_de = dcv_dp * dp_de + dcv_dT * dT_de;
     205           1 : }
     206             : 
     207             : Real
     208          15 : LeadLithiumFluidProperties::mu_from_v_e(Real v, Real e) const
     209             : {
     210          15 :   Real T = T_from_v_e(v, e);
     211          15 :   if (T < _T_mo || T > 625)
     212          10 :     flagInvalidSolution("Temperature out of bounds for the PbLi viscosity computation");
     213          15 :   return 1.87e-4 * std::exp(11640.0 / (FluidProperties::_R * T));
     214             : }
     215             : 
     216             : void
     217           1 : LeadLithiumFluidProperties::mu_from_v_e(
     218             :     Real v, Real e, Real & mu, Real & dmu_dv, Real & dmu_de) const
     219             : {
     220             :   Real T, dT_dv, dT_de;
     221           1 :   T_from_v_e(v, e, T, dT_dv, dT_de);
     222           1 :   mu = mu_from_v_e(v, e);
     223           1 :   Real factor = -11640.0 / (FluidProperties::_R * T * T);
     224           1 :   dmu_dv = factor * mu * dT_dv;
     225           1 :   dmu_de = factor * mu * dT_de;
     226           1 : }
     227             : 
     228             : Real
     229          15 : LeadLithiumFluidProperties::k_from_v_e(Real v, Real e) const
     230             : {
     231          15 :   Real T = T_from_v_e(v, e);
     232          15 :   if (T < _T_mo || T > 873)
     233           4 :     flagInvalidSolution("Temperature out of bounds for the PbLi dynamic viscosity computation");
     234          15 :   return 14.51 + 1.9631e-2 * T;
     235             : }
     236             : 
     237             : void
     238           1 : LeadLithiumFluidProperties::k_from_v_e(Real v, Real e, Real & k, Real & dk_dv, Real & dk_de) const
     239             : {
     240             :   Real T, dT_dv, dT_de;
     241           1 :   T_from_v_e(v, e, T, dT_dv, dT_de);
     242           1 :   k = k_from_v_e(v, e);
     243           1 :   dk_dv = 0.019631 * dT_dv;
     244           1 :   dk_de = 0.019631 * dT_de;
     245           1 : }
     246             : 
     247             : Real
     248          97 : LeadLithiumFluidProperties::h_from_p_T(Real /*p*/, Real T) const
     249             : {
     250          97 :   if (T < _T_mo || T > 800)
     251          19 :     flagInvalidSolution("Temperature out of bounds for the PbLi enthalpy computation");
     252          97 :   return 195.0 * (T - _T_mo) - 0.5 * 9.116e-3 * (T * T - _T_mo * _T_mo);
     253             : }
     254             : 
     255             : void
     256           4 : LeadLithiumFluidProperties::h_from_p_T(Real p, Real T, Real & h, Real & dh_dp, Real & dh_dT) const
     257             : {
     258           4 :   h = h_from_p_T(p, T);
     259           4 :   dh_dp = 0;
     260           4 :   dh_dT = cp_from_p_T(p, T);
     261           4 : }
     262             : 
     263             : Real
     264          47 : LeadLithiumFluidProperties::h_from_v_e(Real v, Real e) const
     265             : {
     266          47 :   Real T = T_from_v_e(v, e);
     267          47 :   return h_from_p_T(0, T);
     268             : }
     269             : 
     270             : void
     271           3 : LeadLithiumFluidProperties::h_from_v_e(Real v, Real e, Real & h, Real & dh_dv, Real & dh_de) const
     272             : {
     273             :   Real T, dT_dv, dT_de;
     274           3 :   T_from_v_e(v, e, T, dT_dv, dT_de);
     275           3 :   h = h_from_v_e(v, e);
     276           3 :   Real cp = cp_from_v_e(v, e);
     277           3 :   dh_dv = cp * dT_dv;
     278           3 :   dh_de = cp * dT_de;
     279           3 : }
     280             : 
     281             : Real
     282          31 : LeadLithiumFluidProperties::e_from_p_T(Real p, Real T) const
     283             : {
     284          31 :   Real v = v_from_p_T(p, T);
     285          31 :   Real h = h_from_p_T(p, T);
     286          31 :   return h - p * v;
     287             : }
     288             : 
     289             : void
     290           2 : LeadLithiumFluidProperties::e_from_p_T(Real p, Real T, Real & e, Real & de_dp, Real & de_dT) const
     291             : {
     292             :   Real dh_dp, dv_dp, dh_dT, dv_dT, v, h;
     293           2 :   h_from_p_T(p, T, h, dh_dp, dh_dT);
     294           2 :   v_from_p_T(p, T, v, dv_dp, dv_dT);
     295           2 :   e = e_from_p_T(p, T);
     296           2 :   de_dp = dh_dp - v - dv_dp * p;
     297           2 :   de_dT = dh_dT - dv_dT * p;
     298           2 : }
     299             : 
     300             : Real
     301          14 : LeadLithiumFluidProperties::e_from_p_rho(Real p, Real rho) const
     302             : {
     303          14 :   return e_from_p_T(p, T_from_p_rho(p, rho));
     304             : }
     305             : 
     306             : void
     307           1 : LeadLithiumFluidProperties::e_from_p_rho(
     308             :     Real p, Real rho, Real & e, Real & de_dp, Real & de_drho) const
     309             : {
     310             :   Real T, dT_dp, dT_drho;
     311           1 :   T_from_p_rho(p, rho, T, dT_dp, dT_drho);
     312             :   Real de_dp_T, de_dT;
     313           1 :   e_from_p_T(p, T, e, de_dp_T, de_dT);
     314           1 :   de_dp = de_dp_T + de_dT * dT_dp;
     315           1 :   de_drho = de_dT * dT_drho;
     316           1 : }
     317             : 
     318             : Real
     319          30 : LeadLithiumFluidProperties::T_from_p_rho(Real /*p*/, Real rho) const
     320             : {
     321          30 :   Real T = (10520.35 - rho) / 1.19051;
     322          30 :   if (T < _T_mo || T > 880)
     323           7 :     flagInvalidSolution("Temperature out of bounds for the PbLi density computation");
     324          30 :   return T;
     325             : }
     326             : 
     327             : void
     328           2 : LeadLithiumFluidProperties::T_from_p_rho(
     329             :     Real p, Real rho, Real & T, Real & dT_dp, Real & dT_drho) const
     330             : {
     331           2 :   T = T_from_p_rho(p, rho);
     332           2 :   dT_dp = 0;
     333           2 :   dT_drho = -1.0 / 1.19051;
     334           2 : }
     335             : 
     336             : Real
     337          15 : LeadLithiumFluidProperties::T_from_p_h(Real /*p*/, Real h) const
     338             : {
     339             :   // h = 195.0 * (T - _T_mo) - 0.5 * 9.116e-3 * (T * T - _T_mo * _T_mo);
     340             :   //
     341             :   const auto a = -0.5 * 9.116e-3;
     342             :   const auto b = 195.;
     343          15 :   const auto c = 0.5 * 9.116e-3 * _T_mo * _T_mo - h - 195. * _T_mo;
     344          15 :   const auto T = (-b + std::sqrt(b * b - 4 * a * c)) / (2 * a);
     345          15 :   return T;
     346             : }
     347             : 
     348             : void
     349           1 : LeadLithiumFluidProperties::T_from_p_h(Real p, Real h, Real & T, Real & dT_dp, Real & dT_dh) const
     350             : {
     351           1 :   T = T_from_p_h(p, h);
     352           1 :   dT_dp = 0;
     353             :   Real h1, dh_dp, dh_dT;
     354           1 :   h_from_p_T(p, T, h1, dh_dp, dh_dT);
     355           1 :   dT_dh = 1.0 / dh_dT;
     356           1 : }
     357             : 
     358             : Real
     359          51 : LeadLithiumFluidProperties::cp_from_p_T(Real /*p*/, Real T) const
     360             : {
     361          51 :   if (T < _T_mo || T > 800)
     362          10 :     flagInvalidSolution("Temperature out of bounds for the PbLi specific heat computation");
     363          51 :   return 195.0 - 9.116e-3 * T;
     364             : }
     365             : 
     366             : void
     367           1 : LeadLithiumFluidProperties::cp_from_p_T(
     368             :     Real p, Real T, Real & cp, Real & dcp_dp, Real & dcp_dT) const
     369             : {
     370           1 :   cp = cp_from_p_T(p, T);
     371           1 :   dcp_dp = 0;
     372           1 :   dcp_dT = -9.116e-3;
     373           1 : }
     374             : 
     375             : Real
     376          15 : LeadLithiumFluidProperties::mu_from_p_T(Real /*p*/, Real T) const
     377             : {
     378          15 :   if (T < _T_mo || T > 625)
     379          10 :     flagInvalidSolution("Temperature out of bounds for the PbLi viscosity computation");
     380          15 :   return 1.87e-4 * std::exp(11640.0 / (FluidProperties::_R * T));
     381             : }
     382             : 
     383             : void
     384           1 : LeadLithiumFluidProperties::mu_from_p_T(
     385             :     Real p, Real T, Real & mu, Real & dmu_dp, Real & dmu_dT) const
     386             : {
     387           1 :   mu = mu_from_p_T(p, T);
     388           1 :   dmu_dp = 0;
     389           1 :   dmu_dT = -11640.0 / (FluidProperties::_R * T * T) * mu;
     390           1 : }
     391             : 
     392             : Real
     393          15 : LeadLithiumFluidProperties::k_from_p_T(Real /*p*/, Real T) const
     394             : {
     395          15 :   if (T < _T_mo || T > 873)
     396           4 :     flagInvalidSolution("Temperature out of bounds for the PbLi dynamic viscosity computation");
     397          15 :   return 14.51 + 1.9631e-2 * T;
     398             : }
     399             : 
     400             : void
     401           1 : LeadLithiumFluidProperties::k_from_p_T(Real p, Real T, Real & k, Real & dk_dp, Real & dk_dT) const
     402             : {
     403           1 :   k = k_from_p_T(p, T);
     404           1 :   dk_dp = 0;
     405           1 :   dk_dT = 0.019631;
     406           1 : }

Generated by: LCOV version 1.14