LCOV - code coverage report
Current view: top level - src/materials - TungstenThermalPropertiesMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_properties: #31706 (f8ed4a) with base bb0a08 Lines: 42 48 87.5 %
Date: 2025-11-03 17:28:48 Functions: 3 6 50.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             : /**
      11             :  * This material computes Tungsten thermal properties as a function of temperature.
      12             :  * Constants are taken from Milner, J. L., Karkos, P., & Bowers, J. J. (2024).
      13             :  * Space Nuclear Propulsion (SNP) Material Property Handbook (No. SNP-HDBK-0008).
      14             :  * National Aeronautics and Space Administration (NASA). https://ntrs.nasa.gov/citations/20240004217
      15             :  */
      16             : 
      17             : #include "TungstenThermalPropertiesMaterial.h"
      18             : #include "SolidPropertiesNames.h"
      19             : #include "libmesh/utility.h"
      20             : #include <cmath>
      21             : 
      22             : registerMooseObject("SolidPropertiesApp", TungstenThermalPropertiesMaterial);
      23             : registerMooseObject("SolidPropertiesApp", ADTungstenThermalPropertiesMaterial);
      24             : 
      25             : template <bool is_ad>
      26             : InputParameters
      27          85 : TungstenThermalPropertiesMaterialTempl<is_ad>::validParams()
      28             : {
      29          85 :   InputParameters params = Material::validParams();
      30         170 :   params.addRequiredCoupledVar("temperature", "Temperature");
      31          85 :   params.addParam<std::string>(SolidPropertiesNames::thermal_conductivity,
      32             :                                SolidPropertiesNames::thermal_conductivity,
      33             :                                "Name to be used for the thermal conductivity");
      34          85 :   params.addParam<std::string>(SolidPropertiesNames::specific_heat,
      35             :                                SolidPropertiesNames::specific_heat,
      36             :                                "Name to be used for the specific heat");
      37          85 :   params.addParam<std::string>(SolidPropertiesNames::density,
      38             :                                SolidPropertiesNames::density,
      39             :                                "Name to be used for the density");
      40          85 :   params.addClassDescription("Computes tungsten thermal properties as a function of temperature");
      41          85 :   return params;
      42           0 : }
      43             : template <bool is_ad>
      44          66 : TungstenThermalPropertiesMaterialTempl<is_ad>::TungstenThermalPropertiesMaterialTempl(
      45             :     const InputParameters & parameters)
      46             :   : Material(parameters),
      47          66 :     _temperature(coupledGenericValue<is_ad>("temperature")),
      48         132 :     _k(declareGenericProperty<Real, is_ad>(
      49             :         getParam<std::string>(SolidPropertiesNames::thermal_conductivity))),
      50          66 :     _c_p(declareGenericProperty<Real, is_ad>(
      51             :         getParam<std::string>(SolidPropertiesNames::specific_heat))),
      52          66 :     _rho(declareGenericProperty<Real, is_ad>(getParam<std::string>(SolidPropertiesNames::density)))
      53             : {
      54          66 : }
      55             : 
      56             : template <bool is_ad>
      57             : void
      58        2700 : TungstenThermalPropertiesMaterialTempl<is_ad>::computeQpProperties()
      59             : {
      60             :   using std::pow;
      61             : 
      62        2700 :   if (_temperature[_qp] < 5 || _temperature[_qp] > 3600)
      63           0 :     flagInvalidSolution("The temperature is out of bounds to calculate tungsten density. "
      64             :                         "Temperature has to be between 5 K and 3600 K.");
      65             : 
      66        2700 :   if (_temperature[_qp] < 1 || _temperature[_qp] > 3653)
      67           0 :     flagInvalidSolution("The temperature is out of bounds to calculate tungsten thermal "
      68             :                         "conductivity. Temperature has to be between 1 K and 3653 K.");
      69             : 
      70        2700 :   if (_temperature[_qp] < 11 || _temperature[_qp] > 3700)
      71           0 :     flagInvalidSolution("The temperature is out of bounds to calculate tungsten specific "
      72             :                         "heat. Temperature has to be between 11 K and 3700 K.");
      73             : 
      74        2700 :   const auto temperature_scaled = _temperature[_qp] / 1000;
      75             : 
      76        2700 :   _k[_qp] = (_temperature[_qp] < 55)
      77        2700 :                 ? _kA0 * pow(temperature_scaled, 8.740e-01) /
      78          27 :                       (1 + _kA1 * temperature_scaled + _kA2 * Utility::pow<2>(temperature_scaled) +
      79          27 :                        _kA3 * Utility::pow<3>(temperature_scaled))
      80        2673 :                 : (_kB0 + _kB1 * temperature_scaled + _kB2 * Utility::pow<2>(temperature_scaled) +
      81        2673 :                    _kB3 * Utility::pow<3>(temperature_scaled)) /
      82        2673 :                       (_kC0 + _kC1 * temperature_scaled + Utility::pow<2>(temperature_scaled));
      83             : 
      84        2700 :   _c_p[_qp] =
      85        2700 :       (_temperature[_qp] <= 293)
      86        2700 :           ? _cA0 * pow(temperature_scaled, 3.030) /
      87         216 :                 (1 + _cA1 * temperature_scaled + _cA2 * Utility::pow<2>(temperature_scaled) +
      88         216 :                  _cA3 * Utility::pow<3>(temperature_scaled))
      89        2484 :           : _cB0 + _cB1 * temperature_scaled + _cB2 * Utility::pow<2>(temperature_scaled) +
      90        2484 :                 _cB3 * Utility::pow<3>(temperature_scaled) +
      91        2484 :                 _cB_2 / Utility::pow<2>(temperature_scaled);
      92             : 
      93        2700 :   _rho[_qp] = (_temperature[_qp] <= 294)
      94        2700 :                   ? _rA0 / Utility::pow<3>(1 + (_rA1 + _rA2 * temperature_scaled +
      95         216 :                                                 _rA3 * Utility::pow<2>(temperature_scaled) +
      96         216 :                                                 _rA4 * Utility::pow<3>(temperature_scaled)) /
      97           0 :                                                    100)
      98        2484 :                   : _rA0 / Utility::pow<3>(1 + (_rB0 + _rB1 * temperature_scaled +
      99        2484 :                                                 _rB2 * Utility::pow<2>(temperature_scaled) +
     100        2484 :                                                 _rB3 * Utility::pow<3>(temperature_scaled)) /
     101           0 :                                                    100);
     102        2700 : }
     103             : 
     104             : template class TungstenThermalPropertiesMaterialTempl<false>;
     105             : template class TungstenThermalPropertiesMaterialTempl<true>;

Generated by: LCOV version 1.14