LCOV - code coverage report
Current view: top level - src/materials/hardening_models - JohnsonCookHardening.C (source / functions) Hit Total Coverage
Test: coverage.info Lines: 81 84 96.4 %
Date: 2025-11-27 01:11:00 Functions: 7 7 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 "JohnsonCookHardening.h"
       6             : 
       7             : registerMooseObject("raccoonApp", JohnsonCookHardening);
       8             : 
       9             : InputParameters
      10         140 : JohnsonCookHardening::validParams()
      11             : {
      12         140 :   InputParameters params = PlasticHardeningModel::validParams();
      13         140 :   params.addClassDescription("The Johnson-Cook plasticity model.");
      14             : 
      15         280 :   params.addRequiredParam<MaterialPropertyName>("sigma_0",
      16             :                                                 "The reference yield stress $\\sigma_0$");
      17         280 :   params.addRequiredParam<Real>("n", "The exponent n in the JC Model");
      18         280 :   params.addRequiredParam<Real>("m", "The exponent m in the JC Model");
      19         280 :   params.addRequiredParam<Real>("reference_plastic_strain",
      20             :                                 "The $\\epsilon_0$ parameter in the JC Model");
      21         280 :   params.addRequiredParam<Real>("reference_plastic_strain_rate",
      22             :                                 "The ref plastic strain rate parameter in the JC model");
      23         280 :   params.addRequiredParam<Real>("T0", "Reference temperature of the material");
      24         280 :   params.addRequiredCoupledVar("T", "Temperature");
      25         280 :   params.addRangeCheckedParam<Real>(
      26             :       "taylor_quinney_factor",
      27             :       1,
      28             :       "taylor_quinney_factor<=1 & taylor_quinney_factor>=0",
      29             :       "The Taylor-Quinney factor. 1 (default) for purely dissipative, 0 for purely energetic.");
      30         280 :   params.addRequiredParam<MaterialPropertyName>("A", "'A' parameter for the JC model");
      31         280 :   params.addRequiredParam<Real>("B", "'B' parameter for the JC model");
      32         280 :   params.addRequiredParam<Real>("C", "'C' parameter for the JC model");
      33         280 :   params.addRequiredParam<Real>("Tm", "The melting temperature of the material");
      34             : 
      35         280 :   params.addRequiredCoupledVar("phase_field", "Name of the phase-field (damage) variable");
      36         280 :   params.addParam<MaterialPropertyName>(
      37             :       "plastic_energy_density",
      38             :       "psip",
      39             :       "Name of the plastic energy density computed by this material model");
      40         280 :   params.addParam<MaterialPropertyName>("degradation_function", "gp", "The degradation function");
      41         140 :   return params;
      42           0 : }
      43             : 
      44           3 : JohnsonCookHardening::JohnsonCookHardening(const InputParameters & parameters)
      45             :   : PlasticHardeningModel(parameters),
      46             :     DerivativeMaterialPropertyNameInterface(),
      47           6 :     _sigma_0(getADMaterialProperty<Real>(prependBaseName("sigma_0", true))),
      48           6 :     _n(getParam<Real>("n")),
      49           6 :     _m(getParam<Real>("m")),
      50           6 :     _ep0(getParam<Real>("reference_plastic_strain")),
      51           6 :     _epdot0(getParam<Real>("reference_plastic_strain_rate")),
      52           6 :     _T0(getParam<Real>("T0")),
      53           3 :     _T(coupledValueOld("T")),
      54           6 :     _tqf(getParam<Real>("taylor_quinney_factor")),
      55           6 :     _A(getADMaterialProperty<Real>("A")),
      56           6 :     _B(getParam<Real>("B")),
      57           6 :     _C(getParam<Real>("C")),
      58           6 :     _Tm(getParam<Real>("Tm")),
      59           6 :     _d_name(getVar("phase_field", 0)->name()),
      60             : 
      61             :     // The strain energy density and its derivatives
      62           3 :     _psip_name(prependBaseName("plastic_energy_density", true)),
      63           3 :     _psip(declareADProperty<Real>(_psip_name)),
      64           3 :     _psip_active(declareADProperty<Real>(_psip_name + "_active")),
      65           6 :     _dpsip_dd(declareADProperty<Real>(derivativePropertyName(_psip_name, {_d_name}))),
      66             : 
      67             :     // The degradation function and its derivatives
      68           3 :     _gp_name(prependBaseName("degradation_function", true)),
      69           3 :     _gp(getADMaterialProperty<Real>(_gp_name)),
      70          12 :     _dgp_dd(getADMaterialProperty<Real>(derivativePropertyName(_gp_name, {_d_name})))
      71             : {
      72           9 : }
      73             : 
      74             : ADReal // Temperature degradation
      75      497400 : JohnsonCookHardening::temperatureDependence()
      76             : {
      77      497400 :   return 1 - std::pow((_T[_qp] - _T0) / (_Tm - _T0), _m);
      78             : }
      79             : 
      80             : ADReal
      81        6968 : JohnsonCookHardening::initialGuess(const ADReal & effective_trial_stress)
      82             : {
      83             :   using std::max;
      84             :   using std::pow;
      85             :   ADReal trial_over_stress =
      86       13936 :       effective_trial_stress / _sigma_0[_qp] / temperatureDependence() - _A[_qp];
      87        6968 :   if (trial_over_stress < 0)
      88           0 :     trial_over_stress = 0;
      89       20904 :   return max(_ep0 * pow(trial_over_stress / _B, 1 / _n), libMesh::TOLERANCE * libMesh::TOLERANCE);
      90             : }
      91             : 
      92             : ADReal
      93      239712 : JohnsonCookHardening::plasticEnergy(const ADReal & ep, const unsigned int derivative)
      94             : {
      95      239712 :   if (derivative == 0)
      96             :   {
      97             :     using std::pow;
      98       22048 :     _psip_active[_qp] = (1 - _tqf) * _sigma_0[_qp] *
      99       33072 :                         (_A[_qp] * ep + _B * _ep0 * pow(ep / _ep0, _n + 1) / (_n + 1)) *
     100       22048 :                         temperatureDependence();
     101       22048 :     _psip[_qp] = _gp[_qp] * _psip_active[_qp];
     102       22048 :     _dpsip_dd[_qp] = _dgp_dd[_qp] * _psip_active[_qp];
     103       11024 :     return _psip[_qp];
     104             :   }
     105             : 
     106      228688 :   if (derivative == 1)
     107             :   {
     108             :     using std::pow;
     109      479424 :     return _gp[_qp] * (1 - _tqf) * _sigma_0[_qp] * (_A[_qp] + _B * pow(ep / _ep0, _n)) *
     110      239712 :            temperatureDependence();
     111             :   }
     112      108832 :   if (derivative == 2)
     113             :   {
     114             :     using std::pow;
     115      217664 :     return _gp[_qp] * (1 - _tqf) * _sigma_0[_qp] * _B * pow(ep / _ep0, _n - 1) * _n / _ep0 *
     116      217664 :            temperatureDependence();
     117             :   }
     118           0 :   mooseError(name(), "internal error: unsupported derivative order.");
     119             : }
     120             : 
     121             : ADReal
     122      250720 : JohnsonCookHardening::plasticDissipation(const ADReal & delta_ep,
     123             :                                          const ADReal & ep,
     124             :                                          const unsigned int derivative)
     125             : {
     126             :   // For all cases, we are splitting between rate dependent and non rate dependent portions to avoid
     127             :   // /0 errors
     128             : 
     129      250720 :   ADReal result = 0;
     130             : 
     131      250720 :   if (derivative == 0)
     132             :   {
     133             :     using std::log;
     134             :     using std::pow;
     135       44096 :     result += (_A[_qp] + _B * pow(ep / _ep0, _n)) * _tqf * delta_ep;
     136       11024 :     if (_t_step > 0 && delta_ep > libMesh::TOLERANCE * libMesh::TOLERANCE)
     137       34840 :       result += (_A[_qp] + _B * pow(ep / _ep0, _n)) * (_C * log(delta_ep / _dt / _epdot0) - _C) *
     138        6968 :                 delta_ep;
     139             :   }
     140             : 
     141      250720 :   if (derivative == 1)
     142             :   {
     143             :     using std::log;
     144             :     using std::pow;
     145      523456 :     result += (_A[_qp] + _B * pow(ep / _ep0, _n)) * _tqf;
     146      130864 :     if (_t_step > 0 && delta_ep > libMesh::TOLERANCE * libMesh::TOLERANCE)
     147      579000 :       result += (_A[_qp] + _B * pow(ep / _ep0, _n)) * (_C * log(delta_ep / _dt / _epdot0));
     148             :   }
     149             : 
     150      250720 :   if (derivative == 2)
     151             :   {
     152             :     using std::log;
     153             :     using std::pow;
     154      326496 :     result += _B * pow(ep / _ep0, _n - 1) * _n / _ep0 * _tqf;
     155      108832 :     if (_t_step > 0 && delta_ep > libMesh::TOLERANCE * libMesh::TOLERANCE)
     156      217664 :       result += (_A[_qp] + _B * pow(ep / _ep0, _n)) * _C / delta_ep +
     157      435328 :                 _B * pow(ep / _ep0, _n - 1) * _n / _ep0 * _C * log(delta_ep / _dt / _epdot0);
     158             :   }
     159             : 
     160      501440 :   return _gp[_qp] * result * _sigma_0[_qp] * temperatureDependence();
     161             : 
     162             :   mooseError(name(), "internal error: unsupported derivative order.");
     163             : }
     164             : 
     165             : ADReal // Thermal conjugate term
     166       11008 : JohnsonCookHardening::thermalConjugate(const ADReal & ep)
     167             : {
     168             :   using std::pow;
     169             : 
     170       44032 :   return _gp[_qp] * _T[_qp] * (1 - _tqf) * _sigma_0[_qp] * (_A[_qp] + _B * pow(ep / _ep0, _n)) *
     171       22016 :          (_m * (pow((_T0 - _T[_qp]) / (_T0 - _Tm), _m))) / (_T0 - _T[_qp]);
     172             : }

Generated by: LCOV version 1.16