LCOV - code coverage report
Current view: top level - src/materials - StressUpdateBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 17 28 60.7 %
Date: 2025-07-25 05:00:39 Functions: 6 16 37.5 %
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 "StressUpdateBase.h"
      11             : 
      12             : #include "MooseMesh.h"
      13             : 
      14             : template <bool is_ad, typename R2, typename R4>
      15             : InputParameters
      16       10054 : StressUpdateBaseTempl<is_ad, R2, R4>::validParams()
      17             : {
      18       10054 :   InputParameters params = Material::validParams();
      19       10054 :   params.addClassDescription("Calculates an admissible state (stress that lies on or within the "
      20             :                              "yield surface, plastic strains, internal parameters, etc).  This "
      21             :                              "class is intended to be a parent class for classes with specific "
      22             :                              "constitutive models.");
      23       20108 :   params.addParam<std::string>(
      24             :       "base_name",
      25             :       "Optional parameter that defines a prefix for all material "
      26             :       "properties related to this stress update model. This allows for "
      27             :       "multiple models of the same type to be used without naming conflicts.");
      28             :   // The return stress increment classes are intended to be iterative materials, so must set compute
      29             :   // = false for all inheriting classes
      30       10054 :   params.set<bool>("compute") = false;
      31       10054 :   params.suppressParameter<bool>("compute");
      32       10054 :   return params;
      33           0 : }
      34             : 
      35             : template <bool is_ad, typename R2, typename R4>
      36        7546 : StressUpdateBaseTempl<is_ad, R2, R4>::StressUpdateBaseTempl(const InputParameters & parameters)
      37             :   : Material(parameters),
      38       13430 :     _base_name(this->isParamValid("base_name")
      39        7546 :                    ? this->template getParam<std::string>("base_name") + "_"
      40        7546 :                    : "")
      41             : {
      42        7546 : }
      43             : 
      44             : template <bool is_ad, typename R2, typename R4>
      45             : void
      46           0 : StressUpdateBaseTempl<is_ad, R2, R4>::setQp(unsigned int qp)
      47             : {
      48    62065714 :   _qp = qp;
      49           0 : }
      50             : 
      51             : template <bool is_ad, typename R2, typename R4>
      52             : void
      53           0 : StressUpdateBaseTempl<is_ad, R2, R4>::propagateQpStatefulProperties()
      54             : {
      55           0 :   mooseError(
      56             :       "propagateQpStatefulProperties called: it needs to be implemented by your inelastic model");
      57             : }
      58             : 
      59             : template <bool is_ad, typename R2, typename R4>
      60             : Real
      61     1517040 : StressUpdateBaseTempl<is_ad, R2, R4>::computeTimeStepLimit()
      62             : {
      63     1517040 :   return std::numeric_limits<Real>::max();
      64             : }
      65             : 
      66             : template <bool is_ad, typename R2, typename R4>
      67             : void
      68           0 : StressUpdateBaseTempl<is_ad, R2, R4>::updateState(
      69             :     GR2 & /*strain_increment*/,
      70             :     GR2 & /*inelastic_strain_increment*/,
      71             :     const GR2 & /*rotation_increment*/,
      72             :     GR2 & /*stress_new*/,
      73             :     const RankTwoTensor & /*stress_old*/,
      74             :     const GR4 & /*elasticity_tensor*/,
      75             :     const RankTwoTensor & /*elastic_strain_old*/,
      76             :     bool /*compute_full_tangent_operator = false*/,
      77             :     RankFourTensor & /*tangent_operator = _identityTensor*/)
      78             : {
      79           0 :   mooseError("updateState called: it needs to be implemented by your inelastic model");
      80             : }
      81             : 
      82             : template <bool is_ad, typename R2, typename R4>
      83             : void
      84           0 : StressUpdateBaseTempl<is_ad, R2, R4>::updateStateSubstep(
      85             :     GR2 & /*strain_increment*/,
      86             :     GR2 & /*inelastic_strain_increment*/,
      87             :     const GR2 & /*rotation_increment*/,
      88             :     GR2 & /*stress_new*/,
      89             :     const RankTwoTensor & /*stress_old*/,
      90             :     const GR4 & /*elasticity_tensor*/,
      91             :     const RankTwoTensor & /*elastic_strain_old*/,
      92             :     bool /*compute_full_tangent_operator*/,
      93             :     RankFourTensor & /*tangent_operator*/)
      94             : {
      95           0 :   this->paramError("use_substep",
      96             :                    "updateStateSubstep called: it needs to be implemented by your inelastic model");
      97             : }
      98             : 
      99             : template <bool is_ad, typename R2, typename R4>
     100             : TangentCalculationMethod
     101       80920 : StressUpdateBaseTempl<is_ad, R2, R4>::getTangentCalculationMethod()
     102             : {
     103       80920 :   return TangentCalculationMethod::ELASTIC;
     104             : }
     105             : 
     106             : template <>
     107             : TangentCalculationMethod
     108           0 : StressUpdateBaseTempl<true>::getTangentCalculationMethod()
     109             : {
     110           0 :   mooseError(
     111             :       "getTangentCalculationMethod called: no tangent moduli calculation is needed while using AD");
     112             :   return TangentCalculationMethod::ELASTIC;
     113             : }
     114             : 
     115             : template class StressUpdateBaseTempl<false>;
     116             : template class StressUpdateBaseTempl<true>;

Generated by: LCOV version 1.14