LCOV - code coverage report
Current view: top level - src/materials - StainlessSteelThermalExpansionEigenstrain.C (source / functions) Hit Total Coverage
Test: idaholab/malamute: 0e4c8a Lines: 35 36 97.2 %
Date: 2025-08-02 07:01:39 Functions: 9 10 90.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /****************************************************************************/
       2             : /*                        DO NOT MODIFY THIS HEADER                         */
       3             : /*                                                                          */
       4             : /* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */
       5             : /*                                                                          */
       6             : /*           Copyright 2021 - 2024, Battelle Energy Alliance, LLC           */
       7             : /*                           ALL RIGHTS RESERVED                            */
       8             : /****************************************************************************/
       9             : 
      10             : #include "StainlessSteelThermalExpansionEigenstrain.h"
      11             : #include "NonlinearSystemBase.h"
      12             : #include "TimeIntegrator.h"
      13             : 
      14             : registerMooseObject("MalamuteApp", StainlessSteelThermalExpansionEigenstrain);
      15             : registerMooseObject("MalamuteApp", ADStainlessSteelThermalExpansionEigenstrain);
      16             : 
      17             : template <bool is_ad>
      18             : InputParameters
      19          28 : StainlessSteelThermalExpansionEigenstrainTempl<is_ad>::validParams()
      20             : {
      21          28 :   InputParameters params = ComputeThermalExpansionEigenstrainBaseTempl<is_ad>::validParams();
      22          28 :   params.addClassDescription("Calculates eigenstrain due to isotropic thermal expansion in AISI "
      23             :                              "304 Stainless Steel in base SI units");
      24          56 :   params.addParam<Real>("coeffient_thermal_expansion_scale_factor",
      25          56 :                         1.0,
      26             :                         "The scaling factor for the coefficient of thermal expansion");
      27             : 
      28          28 :   return params;
      29           0 : }
      30             : 
      31             : template <bool is_ad>
      32          21 : StainlessSteelThermalExpansionEigenstrainTempl<
      33             :     is_ad>::StainlessSteelThermalExpansionEigenstrainTempl(const InputParameters & parameters)
      34             :   : ComputeThermalExpansionEigenstrainBaseTempl<is_ad>(parameters),
      35          21 :     _coeff_thermal_expansion_scale_factor(
      36          21 :         this->template getParam<Real>("coeffient_thermal_expansion_scale_factor"))
      37             : {
      38          21 : }
      39             : 
      40             : template <bool is_ad>
      41             : void
      42         177 : StainlessSteelThermalExpansionEigenstrainTempl<is_ad>::jacobianSetup()
      43             : {
      44         177 :   _check_temperature_now = false;
      45         177 :   int number_nonlinear_it = this->_fe_problem.getNonlinearSystemBase(/*nl_sys_num=*/0)
      46         177 :                                 .getCurrentNonlinearIterationNumber();
      47         177 :   if (number_nonlinear_it == 0)
      48          99 :     _check_temperature_now = true;
      49         177 : }
      50             : 
      51             : template <bool is_ad>
      52             : ValueAndDerivative<is_ad>
      53       10204 : StainlessSteelThermalExpansionEigenstrainTempl<is_ad>::computeThermalStrain()
      54             : {
      55       10204 :   if (_check_temperature_now)
      56             :   {
      57          35 :     if (_temperature[_qp] < 273.3)
      58           2 :       mooseDoOnce(mooseWarning("The temperature in ",
      59             :                                this->_name,
      60             :                                " is below the calibration lower range limit at a value of ",
      61             :                                MetaPhysicL::raw_value(_temperature[_qp])));
      62          33 :     else if (_temperature[_qp] > 810.5)
      63           2 :       mooseError("The temperature in ",
      64           2 :                  this->_name,
      65             :                  " is above the calibration upper range limit at a value of ",
      66           2 :                  MetaPhysicL::raw_value(_temperature[_qp]));
      67             : 
      68          31 :     _check_temperature_now = false;
      69             :   }
      70             : 
      71       10200 :   const auto cte = computeCoefficientThermalExpansion(_temperature[_qp]);
      72       10200 :   return cte * (_temperature[_qp] - this->_stress_free_temperature[_qp]);
      73             : }
      74             : 
      75             : template <bool is_ad>
      76             : ValueAndDerivative<is_ad>
      77        3100 : StainlessSteelThermalExpansionEigenstrainTempl<is_ad>::computeCoefficientThermalExpansion(
      78             :     const ValueAndDerivative<is_ad> & temperature)
      79             : {
      80             :   ValueAndDerivative<is_ad> coefficient_thermal_expansion;
      81       10200 :   if (temperature < 373)
      82        1340 :     coefficient_thermal_expansion = 1.72e-5; // in 1/K
      83        7740 :   else if (temperature < 588)
      84         960 :     coefficient_thermal_expansion = 1.78e-5; // in 1/K
      85             :   else
      86         800 :     coefficient_thermal_expansion = 1.84e-5; // in 1/K
      87             : 
      88        3100 :   return coefficient_thermal_expansion *= _coeff_thermal_expansion_scale_factor;
      89             : }
      90             : 
      91             : template class StainlessSteelThermalExpansionEigenstrainTempl<false>;
      92             : template class StainlessSteelThermalExpansionEigenstrainTempl<true>;

Generated by: LCOV version 1.14