LCOV - code coverage report
Current view: top level - src/materials/hardening_models - JohnsonCookHardening.C (source / functions) Hit Total Coverage
Test: coverage.info Lines: 83 86 96.5 %
Date: 2025-02-21 01:06:12 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         142 : JohnsonCookHardening::validParams()
      11             : {
      12         142 :   InputParameters params = PlasticHardeningModel::validParams();
      13         142 :   params.addClassDescription("The Johnson-Cook plasticity model.");
      14             : 
      15         284 :   params.addRequiredParam<MaterialPropertyName>("sigma_0",
      16             :                                                 "The reference yield stress $\\sigma_0$");
      17         284 :   params.addRequiredParam<Real>("n", "The exponent n in the JC Model");
      18         284 :   params.addRequiredParam<Real>("m", "The exponent m in the JC Model");
      19         284 :   params.addRequiredParam<Real>("reference_plastic_strain",
      20             :                                 "The $\\epsilon_0$ parameter in the JC Model");
      21         284 :   params.addRequiredParam<Real>("reference_plastic_strain_rate",
      22             :                                 "The ref plastic strain rate parameter in the JC model");
      23         284 :   params.addRequiredParam<Real>("T0", "Reference temperature of the material");
      24         284 :   params.addRequiredCoupledVar("T", "Temperature");
      25         284 :   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         284 :   params.addRequiredParam<MaterialPropertyName>("A", "'A' parameter for the JC model");
      31         284 :   params.addRequiredParam<Real>("B", "'B' parameter for the JC model");
      32         284 :   params.addRequiredParam<Real>("C", "'C' parameter for the JC model");
      33         284 :   params.addRequiredParam<Real>("Tm", "The melting temperature of the material");
      34             : 
      35         284 :   params.addRequiredCoupledVar("phase_field", "Name of the phase-field (damage) variable");
      36         284 :   params.addParam<MaterialPropertyName>(
      37             :       "plastic_energy_density",
      38             :       "psip",
      39             :       "Name of the plastic energy density computed by this material model");
      40         284 :   params.addParam<MaterialPropertyName>("degradation_function", "gp", "The degradation function");
      41         142 :   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             :   ADReal trial_over_stress =
      84       13936 :       effective_trial_stress / _sigma_0[_qp] / temperatureDependence() - _A[_qp];
      85        6968 :   if (trial_over_stress < 0)
      86           0 :     trial_over_stress = 0;
      87        6968 :   return std::max(_ep0 * std::pow(trial_over_stress / _B, 1 / _n),
      88       13936 :                   libMesh::TOLERANCE * libMesh::TOLERANCE);
      89             : }
      90             : 
      91             : ADReal
      92      239712 : JohnsonCookHardening::plasticEnergy(const ADReal & ep, const unsigned int derivative)
      93             : {
      94      239712 :   if (derivative == 0)
      95             :   {
      96       22048 :     _psip_active[_qp] = (1 - _tqf) * _sigma_0[_qp] *
      97       33072 :                         (_A[_qp] * ep + _B * _ep0 * std::pow(ep / _ep0, _n + 1) / (_n + 1)) *
      98       22048 :                         temperatureDependence();
      99       22048 :     _psip[_qp] = _gp[_qp] * _psip_active[_qp];
     100       22048 :     _dpsip_dd[_qp] = _dgp_dd[_qp] * _psip_active[_qp];
     101       11024 :     return _psip[_qp];
     102             :   }
     103             : 
     104      228688 :   if (derivative == 1)
     105             :   {
     106      479424 :     return _gp[_qp] * (1 - _tqf) * _sigma_0[_qp] * (_A[_qp] + _B * std::pow(ep / _ep0, _n)) *
     107      239712 :            temperatureDependence();
     108             :   }
     109      108832 :   if (derivative == 2)
     110             :   {
     111      217664 :     return _gp[_qp] * (1 - _tqf) * _sigma_0[_qp] * _B * std::pow(ep / _ep0, _n - 1) * _n / _ep0 *
     112      217664 :            temperatureDependence();
     113             :   }
     114           0 :   mooseError(name(), "internal error: unsupported derivative order.");
     115             : }
     116             : 
     117             : ADReal
     118      250720 : JohnsonCookHardening::plasticDissipation(const ADReal & delta_ep,
     119             :                                          const ADReal & ep,
     120             :                                          const unsigned int derivative)
     121             : {
     122             :   // For all cases, we are splitting between rate dependent and non rate dependent portions to avoid
     123             :   // /0 errors
     124             : 
     125      250720 :   ADReal result = 0;
     126             : 
     127      250720 :   if (derivative == 0)
     128             :   {
     129       44096 :     result += (_A[_qp] + _B * std::pow(ep / _ep0, _n)) * _tqf * delta_ep;
     130       11024 :     if (_t_step > 0 && delta_ep > libMesh::TOLERANCE * libMesh::TOLERANCE)
     131       13936 :       result += (_A[_qp] + _B * std::pow(ep / _ep0, _n)) *
     132       20904 :                 (_C * std::log(delta_ep / _dt / _epdot0) - _C) * delta_ep;
     133             :   }
     134             : 
     135      250720 :   if (derivative == 1)
     136             :   {
     137      523456 :     result += (_A[_qp] + _B * std::pow(ep / _ep0, _n)) * _tqf;
     138      130864 :     if (_t_step > 0 && delta_ep > libMesh::TOLERANCE * libMesh::TOLERANCE)
     139             :       result +=
     140      579000 :           (_A[_qp] + _B * std::pow(ep / _ep0, _n)) * (_C * std::log(delta_ep / _dt / _epdot0));
     141             :   }
     142             : 
     143      250720 :   if (derivative == 2)
     144             :   {
     145      326496 :     result += _B * std::pow(ep / _ep0, _n - 1) * _n / _ep0 * _tqf;
     146      108832 :     if (_t_step > 0 && delta_ep > libMesh::TOLERANCE * libMesh::TOLERANCE)
     147             :       result +=
     148      217664 :           (_A[_qp] + _B * std::pow(ep / _ep0, _n)) * _C / delta_ep +
     149      435328 :           _B * std::pow(ep / _ep0, _n - 1) * _n / _ep0 * _C * std::log(delta_ep / _dt / _epdot0);
     150             :   }
     151             : 
     152      501440 :   return _gp[_qp] * result * _sigma_0[_qp] * temperatureDependence();
     153             : 
     154             :   mooseError(name(), "internal error: unsupported derivative order.");
     155             : }
     156             : 
     157             : ADReal // Thermal conjugate term
     158       11008 : JohnsonCookHardening::thermalConjugate(const ADReal & ep)
     159             : {
     160             : 
     161       11008 :   return _gp[_qp] * _T[_qp] * (1 - _tqf) * _sigma_0[_qp] *
     162       33024 :          (_A[_qp] + _B * std::pow(ep / _ep0, _n)) *
     163       22016 :          (_m * (std::pow((_T0 - _T[_qp]) / (_T0 - _Tm), _m))) / (_T0 - _T[_qp]);
     164             : }

Generated by: LCOV version 1.16