LCOV - code coverage report
Current view: top level - src/materials - ComputeMeanThermalExpansionFunctionEigenstrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 18 19 94.7 %
Date: 2025-07-25 05:00:39 Functions: 8 8 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 "ComputeMeanThermalExpansionFunctionEigenstrain.h"
      11             : #include "Function.h"
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", ComputeMeanThermalExpansionFunctionEigenstrain);
      14             : registerMooseObject("SolidMechanicsApp", ADComputeMeanThermalExpansionFunctionEigenstrain);
      15             : 
      16             : template <bool is_ad>
      17             : InputParameters
      18         408 : ComputeMeanThermalExpansionFunctionEigenstrainTempl<is_ad>::validParams()
      19             : {
      20         408 :   InputParameters params = ComputeMeanThermalExpansionEigenstrainBaseTempl<is_ad>::validParams();
      21         408 :   params.addClassDescription("Computes eigenstrain due to thermal expansion using a function that "
      22             :                              "describes the mean thermal expansion as a function of temperature");
      23         816 :   params.addRequiredParam<FunctionName>(
      24             :       "thermal_expansion_function",
      25             :       "Function describing the mean thermal expansion as a function of temperature");
      26         816 :   params.addRequiredParam<Real>("thermal_expansion_function_reference_temperature",
      27             :                                 "Reference temperature for thermal_exansion_function (IMPORTANT: "
      28             :                                 "this is different in general from the stress_free_temperature)");
      29             : 
      30         408 :   return params;
      31           0 : }
      32             : 
      33             : template <bool is_ad>
      34         306 : ComputeMeanThermalExpansionFunctionEigenstrainTempl<
      35             :     is_ad>::ComputeMeanThermalExpansionFunctionEigenstrainTempl(const InputParameters & parameters)
      36             :   : ComputeMeanThermalExpansionEigenstrainBaseTempl<is_ad>(parameters),
      37         306 :     _thermal_expansion_function(this->getFunction("thermal_expansion_function")),
      38         306 :     _thexp_func_ref_temp(
      39         612 :         this->template getParam<Real>("thermal_expansion_function_reference_temperature"))
      40             : {
      41         306 : }
      42             : 
      43             : template <bool is_ad>
      44             : Real
      45     4430272 : ComputeMeanThermalExpansionFunctionEigenstrainTempl<is_ad>::referenceTemperature()
      46             : {
      47     4430272 :   return _thexp_func_ref_temp;
      48             : }
      49             : 
      50             : template <bool is_ad>
      51             : ValueAndDerivative<is_ad>
      52     4430272 : ComputeMeanThermalExpansionFunctionEigenstrainTempl<is_ad>::meanThermalExpansionCoefficient(
      53             :     const ValueAndDerivative<is_ad> & temperature)
      54             : {
      55             :   // we need these two branches because we cannot yet evaluate Functions with ChainedReals
      56             :   if constexpr (is_ad)
      57     4189632 :     return _thermal_expansion_function.value(temperature);
      58             :   else
      59      240640 :     return {_thermal_expansion_function.value(temperature.value()),
      60      240640 :             _thermal_expansion_function.timeDerivative(temperature.value()) *
      61      240640 :                 temperature.derivatives()};
      62             : }
      63             : 
      64             : template class ComputeMeanThermalExpansionFunctionEigenstrainTempl<false>;
      65             : template class ComputeMeanThermalExpansionFunctionEigenstrainTempl<true>;

Generated by: LCOV version 1.14