LCOV - code coverage report
Current view: top level - src/materials/hardening_models - PowerLawHardening.C (source / functions) Hit Total Coverage
Test: coverage.info Lines: 35 37 94.6 %
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 "PowerLawHardening.h"
       6             : 
       7             : registerMooseObject("raccoonApp", PowerLawHardening);
       8             : 
       9             : InputParameters
      10         166 : PowerLawHardening::validParams()
      11             : {
      12         166 :   InputParameters params = PlasticHardeningModel::validParams();
      13         166 :   params.addClassDescription("Plastic hardening following a power law.");
      14             : 
      15         332 :   params.addRequiredParam<MaterialPropertyName>("yield_stress", "The yield stress $\\sigma_y$");
      16         332 :   params.addRequiredParam<MaterialPropertyName>("exponent",
      17             :                                                 "The exponent n in the power law hardening $n$");
      18         332 :   params.addRequiredParam<MaterialPropertyName>(
      19             :       "reference_plastic_strain", "The $\\epsilon_0$ parameter in the power law hardening");
      20             : 
      21         332 :   params.addRequiredCoupledVar("phase_field", "Name of the phase-field (damage) variable");
      22         332 :   params.addParam<MaterialPropertyName>(
      23             :       "plastic_energy_density",
      24             :       "psip",
      25             :       "Name of the plastic energy density computed by this material model");
      26         332 :   params.addParam<MaterialPropertyName>("degradation_function", "gp", "The degradation function");
      27             : 
      28         166 :   return params;
      29           0 : }
      30             : 
      31          21 : PowerLawHardening::PowerLawHardening(const InputParameters & parameters)
      32             :   : PlasticHardeningModel(parameters),
      33             :     DerivativeMaterialPropertyNameInterface(),
      34          63 :     _sigma_y(getADMaterialProperty<Real>(prependBaseName("yield_stress", true))),
      35          63 :     _n(getADMaterialProperty<Real>(prependBaseName("exponent", true))),
      36          42 :     _ep0(getADMaterialProperty<Real>(prependBaseName("reference_plastic_strain", true))),
      37             : 
      38          42 :     _d_name(getVar("phase_field", 0)->name()),
      39             : 
      40             :     // The strain energy density and its derivatives
      41          21 :     _psip_name(prependBaseName("plastic_energy_density", true)),
      42          21 :     _psip(declareADProperty<Real>(_psip_name)),
      43          21 :     _psip_active(declareADProperty<Real>(_psip_name + "_active")),
      44          42 :     _dpsip_dd(declareADProperty<Real>(derivativePropertyName(_psip_name, {_d_name}))),
      45             : 
      46             :     // The degradation function and its derivatives
      47          21 :     _gp_name(prependBaseName("degradation_function", true)),
      48          21 :     _gp(getADMaterialProperty<Real>(_gp_name)),
      49          84 :     _dgp_dd(getADMaterialProperty<Real>(derivativePropertyName(_gp_name, {_d_name})))
      50             : {
      51          63 : }
      52             : 
      53             : ADReal
      54      701508 : PowerLawHardening::plasticEnergy(const ADReal & ep, const unsigned int derivative)
      55             : {
      56      701508 :   if (derivative == 0)
      57             :   {
      58      565456 :     _psip_active[_qp] = _n[_qp] * _sigma_y[_qp] * _ep0[_qp] / (_n[_qp] + 1) *
      59     1413640 :                         (std::pow(1 + ep / _ep0[_qp], 1 / _n[_qp] + 1) - 1);
      60      565456 :     _psip[_qp] = _gp[_qp] * _psip_active[_qp];
      61      565456 :     _dpsip_dd[_qp] = _dgp_dd[_qp] * _psip_active[_qp];
      62      282728 :     return _psip[_qp];
      63             :   }
      64             : 
      65      418780 :   if (derivative == 1)
      66     1753770 :     return _gp[_qp] * _sigma_y[_qp] * std::pow(1 + ep / _ep0[_qp], 1 / _n[_qp]);
      67             : 
      68       68026 :   if (derivative == 2)
      69      340130 :     return _gp[_qp] * _sigma_y[_qp] * std::pow(1 + ep / _ep0[_qp], 1 / _n[_qp] - 1) / _n[_qp] /
      70       68026 :            _ep0[_qp];
      71             : 
      72           0 :   mooseError(name(), "internal error: unsupported derivative order.");
      73             :   return 0;
      74             : }

Generated by: LCOV version 1.16