LCOV - code coverage report
Current view: top level - src/materials - HyperbolicViscoplasticityStressUpdate.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 56 62 90.3 %
Date: 2025-07-25 05:00:39 Functions: 9 10 90.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 "HyperbolicViscoplasticityStressUpdate.h"
      11             : 
      12             : #include "Function.h"
      13             : #include "ElasticityTensorTools.h"
      14             : 
      15             : registerMooseObject("SolidMechanicsApp", HyperbolicViscoplasticityStressUpdate);
      16             : 
      17             : InputParameters
      18          24 : HyperbolicViscoplasticityStressUpdate::validParams()
      19             : {
      20          24 :   InputParameters params = RadialReturnStressUpdate::validParams();
      21          24 :   params.addClassDescription("This class uses the discrete material for a hyperbolic sine "
      22             :                              "viscoplasticity model in which the effective plastic strain is "
      23             :                              "solved for using a creep approach.");
      24             : 
      25             :   // Linear strain hardening parameters
      26          48 :   params.addRequiredParam<Real>("yield_stress",
      27             :                                 "The point at which plastic strain begins accumulating");
      28          48 :   params.addRequiredParam<Real>("hardening_constant", "Hardening slope");
      29             : 
      30             :   // Viscoplasticity constitutive equation parameters
      31          48 :   params.addRequiredParam<Real>("c_alpha",
      32             :                                 "Viscoplasticity coefficient, scales the hyperbolic function");
      33          48 :   params.addRequiredParam<Real>("c_beta",
      34             :                                 "Viscoplasticity coefficient inside the hyperbolic sin function");
      35          48 :   params.addDeprecatedParam<std::string>(
      36             :       "plastic_prepend",
      37             :       "",
      38             :       "String that is prepended to the plastic_strain Material Property",
      39             :       "This has been replaced by the 'base_name' parameter");
      40          24 :   params.set<std::string>("effective_inelastic_strain_name") = "effective_plastic_strain";
      41             : 
      42          24 :   return params;
      43           0 : }
      44             : 
      45          18 : HyperbolicViscoplasticityStressUpdate::HyperbolicViscoplasticityStressUpdate(
      46          18 :     const InputParameters & parameters)
      47             :   : RadialReturnStressUpdate(parameters),
      48          36 :     _plastic_prepend(getParam<std::string>("plastic_prepend")),
      49          18 :     _yield_stress(parameters.get<Real>("yield_stress")),
      50          18 :     _hardening_constant(parameters.get<Real>("hardening_constant")),
      51          18 :     _c_alpha(parameters.get<Real>("c_alpha")),
      52          18 :     _c_beta(parameters.get<Real>("c_beta")),
      53          18 :     _yield_condition(-1.0), // set to a non-physical value to catch uninitalized yield condition
      54          18 :     _hardening_variable(declareProperty<Real>("hardening_variable")),
      55          36 :     _hardening_variable_old(getMaterialPropertyOld<Real>("hardening_variable")),
      56             : 
      57          18 :     _plastic_strain(
      58          36 :         declareProperty<RankTwoTensor>(_base_name + _plastic_prepend + "plastic_strain")),
      59          18 :     _plastic_strain_old(
      60          36 :         getMaterialPropertyOld<RankTwoTensor>(_base_name + _plastic_prepend + "plastic_strain"))
      61             : {
      62          18 : }
      63             : 
      64             : void
      65          64 : HyperbolicViscoplasticityStressUpdate::initQpStatefulProperties()
      66             : {
      67          64 :   _hardening_variable[_qp] = 0.0;
      68          64 :   _plastic_strain[_qp].zero();
      69          64 : }
      70             : 
      71             : void
      72           0 : HyperbolicViscoplasticityStressUpdate::propagateQpStatefulProperties()
      73             : {
      74           0 :   _hardening_variable[_qp] = _hardening_variable_old[_qp];
      75           0 :   _plastic_strain[_qp] = _plastic_strain_old[_qp];
      76             : 
      77           0 :   propagateQpStatefulPropertiesRadialReturn();
      78           0 : }
      79             : 
      80             : void
      81       10528 : HyperbolicViscoplasticityStressUpdate::computeStressInitialize(
      82             :     const Real & effective_trial_stress, const RankFourTensor & elasticity_tensor)
      83             : {
      84             :   RadialReturnStressUpdate::computeStressInitialize(effective_trial_stress, elasticity_tensor);
      85             : 
      86       10528 :   _yield_condition = effective_trial_stress - _hardening_variable_old[_qp] - _yield_stress;
      87             : 
      88       10528 :   _hardening_variable[_qp] = _hardening_variable_old[_qp];
      89       10528 :   _plastic_strain[_qp] = _plastic_strain_old[_qp];
      90       10528 : }
      91             : 
      92             : Real
      93       49184 : HyperbolicViscoplasticityStressUpdate::computeResidual(const Real & effective_trial_stress,
      94             :                                                        const Real & scalar)
      95             : {
      96             :   Real residual = 0.0;
      97             : 
      98             :   mooseAssert(_yield_condition != -1.0,
      99             :               "the yield stress was not updated by computeStressInitialize");
     100             : 
     101       49184 :   if (_yield_condition > 0.0)
     102             :   {
     103       97888 :     const Real xflow = _c_beta * (effective_trial_stress - (_three_shear_modulus * scalar) -
     104       48944 :                                   computeHardeningValue(scalar) - _yield_stress);
     105       48944 :     const Real xphi = _c_alpha * std::sinh(xflow);
     106             : 
     107       48944 :     _xphidp = -_three_shear_modulus * _c_alpha * _c_beta * std::cosh(xflow);
     108       48944 :     _xphir = -_c_alpha * _c_beta * std::cosh(xflow);
     109       48944 :     residual = xphi * _dt - scalar;
     110             :   }
     111       49184 :   return residual;
     112             : }
     113             : 
     114             : Real
     115       49184 : HyperbolicViscoplasticityStressUpdate::computeDerivative(const Real & /*effective_trial_stress*/,
     116             :                                                          const Real & /*scalar*/)
     117             : {
     118             :   Real derivative = 1.0;
     119       49184 :   if (_yield_condition > 0.0)
     120       48944 :     derivative = _xphidp * _dt + _hardening_constant * _xphir * _dt - 1.0;
     121             : 
     122       49184 :   return derivative;
     123             : }
     124             : 
     125             : void
     126       38912 : HyperbolicViscoplasticityStressUpdate::iterationFinalize(const Real & scalar)
     127             : {
     128       38912 :   if (_yield_condition > 0.0)
     129       38672 :     _hardening_variable[_qp] = computeHardeningValue(scalar);
     130       38912 : }
     131             : 
     132             : Real
     133       87616 : HyperbolicViscoplasticityStressUpdate::computeHardeningValue(Real scalar)
     134             : {
     135       87616 :   return _hardening_variable_old[_qp] + (_hardening_constant * scalar);
     136             : }
     137             : 
     138             : void
     139       10528 : HyperbolicViscoplasticityStressUpdate::computeStressFinalize(
     140             :     const RankTwoTensor & plasticStrainIncrement)
     141             : {
     142       10528 :   _plastic_strain[_qp] += plasticStrainIncrement;
     143       10528 : }

Generated by: LCOV version 1.14