LCOV - code coverage report
Current view: top level - src/materials - GraphiteThermalExpansionEigenstrain.C (source / functions) Hit Total Coverage
Test: idaholab/malamute: 0e4c8a Lines: 30 31 96.8 %
Date: 2025-08-02 07:01:39 Functions: 10 10 100.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 "GraphiteThermalExpansionEigenstrain.h"
      11             : #include "NonlinearSystemBase.h"
      12             : #include "TimeIntegrator.h"
      13             : 
      14             : registerMooseObject("MalamuteApp", GraphiteThermalExpansionEigenstrain);
      15             : registerMooseObject("MalamuteApp", ADGraphiteThermalExpansionEigenstrain);
      16             : 
      17             : template <bool is_ad>
      18             : InputParameters
      19          40 : GraphiteThermalExpansionEigenstrainTempl<is_ad>::validParams()
      20             : {
      21          40 :   InputParameters params = ComputeThermalExpansionEigenstrainBaseTempl<is_ad>::validParams();
      22          40 :   params.addClassDescription(
      23             :       "Calculates eigenstrain due to isotropic thermal expansion in AT 101 graphite");
      24          80 :   params.addParam<Real>("coeffient_thermal_expansion_scale_factor",
      25          80 :                         1.0,
      26             :                         "The scaling factor for the coefficient of thermal expansion");
      27             : 
      28          40 :   return params;
      29           0 : }
      30             : 
      31             : template <bool is_ad>
      32          30 : GraphiteThermalExpansionEigenstrainTempl<is_ad>::GraphiteThermalExpansionEigenstrainTempl(
      33             :     const InputParameters & parameters)
      34             :   : ComputeThermalExpansionEigenstrainBaseTempl<is_ad>(parameters),
      35          30 :     _coeff_thermal_expansion_scale_factor(
      36          30 :         this->template getParam<Real>("coeffient_thermal_expansion_scale_factor"))
      37             : {
      38          30 : }
      39             : 
      40             : template <bool is_ad>
      41             : void
      42         162 : GraphiteThermalExpansionEigenstrainTempl<is_ad>::jacobianSetup()
      43             : {
      44         162 :   _check_temperature_now = false;
      45         162 :   int number_nonlinear_it = this->_fe_problem.getNonlinearSystemBase(/*nl_sys_num=*/0)
      46         162 :                                 .getCurrentNonlinearIterationNumber();
      47         162 :   if (number_nonlinear_it == 0)
      48          90 :     _check_temperature_now = true;
      49         162 : }
      50             : 
      51             : template <bool is_ad>
      52             : ValueAndDerivative<is_ad>
      53        9484 : GraphiteThermalExpansionEigenstrainTempl<is_ad>::computeThermalStrain()
      54             : {
      55        9484 :   if (_check_temperature_now)
      56             :   {
      57          33 :     if (_temperature[_qp] < 290.9)
      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          31 :     else if (_temperature[_qp] > 2383.0)
      63           2 :       mooseDoOnce(mooseWarning("The temperature in ",
      64             :                                this->_name,
      65             :                                " is above the calibration upper range limit at a value of ",
      66             :                                MetaPhysicL::raw_value(_temperature[_qp])));
      67             : 
      68          29 :     _check_temperature_now = false;
      69             :   }
      70             : 
      71        9480 :   const auto cte = computeCoefficientThermalExpansion(_temperature[_qp]);
      72        9480 :   return cte * (_temperature[_qp] - this->_stress_free_temperature[_qp]);
      73             : }
      74             : 
      75             : template <bool is_ad>
      76             : ValueAndDerivative<is_ad>
      77        9480 : GraphiteThermalExpansionEigenstrainTempl<is_ad>::computeCoefficientThermalExpansion(
      78             :     const ValueAndDerivative<is_ad> & temperature)
      79             : {
      80        9480 :   const auto coefficient_thermal_expansion =
      81        5840 :       1.996e-6 * std::log(4.799e-2 * temperature) - 4.041e-6; // in 1/K
      82        9480 :   return coefficient_thermal_expansion * _coeff_thermal_expansion_scale_factor;
      83             : }

Generated by: LCOV version 1.14