LCOV - code coverage report
Current view: top level - src/materials - ComputeDilatationThermalExpansionFunctionEigenstrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 11 12 91.7 %
Date: 2024-02-27 11:53:14 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://www.mooseframework.org
       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 "ComputeDilatationThermalExpansionFunctionEigenstrain.h"
      11             : 
      12             : #include "Function.h"
      13             : 
      14             : registerMooseObject("TensorMechanicsApp", ComputeDilatationThermalExpansionFunctionEigenstrain);
      15             : registerMooseObject("TensorMechanicsApp", ADComputeDilatationThermalExpansionFunctionEigenstrain);
      16             : 
      17             : template <bool is_ad>
      18             : InputParameters
      19          24 : ComputeDilatationThermalExpansionFunctionEigenstrainTempl<is_ad>::validParams()
      20             : {
      21             :   InputParameters params = ComputeDilatationThermalExpansionEigenstrainBase::validParams();
      22          24 :   params.addClassDescription("Computes eigenstrain due to thermal expansion using a function that "
      23             :                              "describes the total dilatation as a function of temperature");
      24          48 :   params.addRequiredParam<FunctionName>(
      25             :       "dilatation_function",
      26             :       "Function describing the thermal dilatation as a function of temperature");
      27          24 :   return params;
      28           0 : }
      29             : 
      30             : template <bool is_ad>
      31          18 : ComputeDilatationThermalExpansionFunctionEigenstrainTempl<is_ad>::
      32             :     ComputeDilatationThermalExpansionFunctionEigenstrainTempl(const InputParameters & parameters)
      33             :   : ComputeDilatationThermalExpansionEigenstrainBaseTempl<is_ad>(parameters),
      34          18 :     _dilatation_function(this->getFunction("dilatation_function"))
      35             : {
      36          18 : }
      37             : 
      38             : template <bool is_ad>
      39             : ValueAndDerivative<is_ad>
      40        5440 : ComputeDilatationThermalExpansionFunctionEigenstrainTempl<is_ad>::computeDilatation(
      41             :     const ValueAndDerivative<is_ad> & temperature)
      42             : {
      43             :   // we need these two branches because we cannot yet evaluate Functions with ChainedReals
      44             :   if constexpr (is_ad)
      45        2720 :     return _dilatation_function.value(temperature);
      46             :   else
      47        2720 :     return {_dilatation_function.value(temperature.value()),
      48        2720 :             _dilatation_function.timeDerivative(temperature.value()) * temperature.derivatives()};
      49             : }
      50             : 
      51             : template class ComputeDilatationThermalExpansionFunctionEigenstrainTempl<false>;
      52             : template class ComputeDilatationThermalExpansionFunctionEigenstrainTempl<true>;

Generated by: LCOV version 1.14