LCOV - code coverage report
Current view: top level - src/materials/hardening_models - ExponentialHardening.C (source / functions) Hit Total Coverage
Test: coverage.info Lines: 41 43 95.3 %
Date: 2025-02-21 01:06:12 Functions: 3 3 100.0 %

          Line data    Source code
       1             : //* This file is part of the RACCOON application
       2             : //* being developed at Dolbow lab at Duke University
       3             : //* http://dolbow.pratt.duke.edu
       4             : 
       5             : #include "ExponentialHardening.h"
       6             : 
       7             : registerMooseObject("raccoonApp", ExponentialHardening);
       8             : 
       9             : InputParameters
      10         142 : ExponentialHardening::validParams()
      11             : {
      12         142 :   InputParameters params = PlasticHardeningModel::validParams();
      13         142 :   params.addClassDescription("Plastic hardening in exponential form.");
      14             : 
      15         284 :   params.addRequiredParam<MaterialPropertyName>("yield_stress", "The yield stress $\\sigma_y$");
      16         284 :   params.addRequiredParam<MaterialPropertyName>("ultimate_stress",
      17             :                                                 "The ultimate stress $\\sigma_\\infty$");
      18         284 :   params.addRequiredParam<MaterialPropertyName>(
      19             :       "reference_plastic_strain", "The $\\epsilon_0$ parameter in the exponential hardening");
      20         284 :   params.addRequiredParam<MaterialPropertyName>("hardening_modulus", "The hardening modulus $H$");
      21             : 
      22         284 :   params.addRequiredCoupledVar("phase_field", "Name of the phase-field (damage) variable");
      23         284 :   params.addParam<MaterialPropertyName>(
      24             :       "plastic_energy_density",
      25             :       "psip",
      26             :       "Name of the plastic energy density computed by this material model");
      27         284 :   params.addParam<MaterialPropertyName>("degradation_function", "gp", "The degradation function");
      28             : 
      29         142 :   return params;
      30           0 : }
      31             : 
      32           3 : ExponentialHardening::ExponentialHardening(const InputParameters & parameters)
      33             :   : PlasticHardeningModel(parameters),
      34             :     DerivativeMaterialPropertyNameInterface(),
      35           9 :     _sigma_y(getADMaterialProperty<Real>(prependBaseName("yield_stress", true))),
      36           9 :     _sigma_ult(getADMaterialProperty<Real>(prependBaseName("ultimate_stress", true))),
      37           9 :     _ep0(getADMaterialProperty<Real>(prependBaseName("reference_plastic_strain", true))),
      38           6 :     _H(getADMaterialProperty<Real>(prependBaseName("hardening_modulus", true))),
      39             : 
      40           6 :     _d_name(getVar("phase_field", 0)->name()),
      41             : 
      42             :     // The strain energy density and its derivatives
      43           3 :     _psip_name(prependBaseName("plastic_energy_density", true)),
      44           3 :     _psip(declareADProperty<Real>(_psip_name)),
      45           3 :     _psip_active(declareADProperty<Real>(_psip_name + "_active")),
      46           6 :     _dpsip_dd(declareADProperty<Real>(derivativePropertyName(_psip_name, {_d_name}))),
      47             : 
      48             :     // The degradation function and its derivatives
      49           3 :     _gp_name(prependBaseName("degradation_function", true)),
      50           3 :     _gp(getADMaterialProperty<Real>(_gp_name)),
      51          12 :     _dgp_dd(getADMaterialProperty<Real>(derivativePropertyName(_gp_name, {_d_name})))
      52             : {
      53           9 : }
      54             : 
      55             : ADReal
      56       89804 : ExponentialHardening::plasticEnergy(const ADReal & ep, const unsigned int derivative)
      57             : {
      58       89804 :   if (derivative == 0)
      59             :   {
      60       15024 :     _psip_active[_qp] =
      61       15024 :         _sigma_ult[_qp] * ep +
      62       60096 :         _ep0[_qp] * (_sigma_ult[_qp] - _sigma_y[_qp]) * (std::exp(-ep / _ep0[_qp]) - 1) +
      63       30048 :         0.5 * _H[_qp] * ep * ep;
      64       30048 :     _psip[_qp] = _gp[_qp] * _psip_active[_qp];
      65       30048 :     _dpsip_dd[_qp] = _dgp_dd[_qp] * _psip_active[_qp];
      66       15024 :     return _psip[_qp];
      67             :   }
      68             : 
      69       74780 :   if (derivative == 1)
      70       44902 :     return _gp[_qp] *
      71      134706 :            (_sigma_ult[_qp] - (_sigma_ult[_qp] - _sigma_y[_qp]) * std::exp(-ep / _ep0[_qp]) +
      72       89804 :             _H[_qp] * ep);
      73             : 
      74       29878 :   if (derivative == 2)
      75       29878 :     return _gp[_qp] *
      76       89634 :            ((_sigma_ult[_qp] - _sigma_y[_qp]) * std::exp(-ep / _ep0[_qp]) / _ep0[_qp] + _H[_qp]);
      77             : 
      78           0 :   mooseError(name(), "internal error: unsupported derivative order.");
      79             :   return 0;
      80             : }

Generated by: LCOV version 1.16