LCOV - code coverage report
Current view: top level - src/materials - StressUpdateBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 17 28 60.7 %
Date: 2024-02-27 11:53:14 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://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 "StressUpdateBase.h"
      11             : 
      12             : #include "MooseMesh.h"
      13             : 
      14             : template <bool is_ad, typename R2, typename R4>
      15             : InputParameters
      16        4820 : StressUpdateBaseTempl<is_ad, R2, R4>::validParams()
      17             : {
      18        4820 :   InputParameters params = Material::validParams();
      19        4820 :   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        9640 :   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        4820 :   params.set<bool>("compute") = false;
      31        4820 :   params.suppressParameter<bool>("compute");
      32        4820 :   return params;
      33           0 : }
      34             : 
      35             : template <bool is_ad, typename R2, typename R4>
      36        3617 : StressUpdateBaseTempl<is_ad, R2, R4>::StressUpdateBaseTempl(const InputParameters & parameters)
      37             :   : Material(parameters),
      38        6559 :     _base_name(this->isParamValid("base_name")
      39        3617 :                    ? this->template getParam<std::string>("base_name") + "_"
      40        3617 :                    : "")
      41             : {
      42        3617 : }
      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    29375833 :   _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      866944 : StressUpdateBaseTempl<is_ad, R2, R4>::computeTimeStepLimit()
      62             : {
      63      866944 :   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->template paramError(
      96             :       "use_substep",
      97             :       "updateStateSubstep called: it needs to be implemented by your inelastic model");
      98             : }
      99             : 
     100             : template <bool is_ad, typename R2, typename R4>
     101             : TangentCalculationMethod
     102       41514 : StressUpdateBaseTempl<is_ad, R2, R4>::getTangentCalculationMethod()
     103             : {
     104       41514 :   return TangentCalculationMethod::ELASTIC;
     105             : }
     106             : 
     107             : template <>
     108             : TangentCalculationMethod
     109           0 : StressUpdateBaseTempl<true>::getTangentCalculationMethod()
     110             : {
     111           0 :   mooseError(
     112             :       "getTangentCalculationMethod called: no tangent moduli calculation is needed while using AD");
     113             :   return TangentCalculationMethod::ELASTIC;
     114             : }
     115             : 
     116             : template class StressUpdateBaseTempl<false>;
     117             : template class StressUpdateBaseTempl<true>;

Generated by: LCOV version 1.14