LCOV - code coverage report
Current view: top level - src/materials/hardening_models - LinearHardening.C (source / functions) Hit Total Coverage
Test: coverage.info Lines: 31 33 93.9 %
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             : //* By: @Sina-av
       5             : 
       6             : #include "LinearHardening.h"
       7             : 
       8             : registerMooseObject("raccoonApp", LinearHardening);
       9             : 
      10             : InputParameters
      11         146 : LinearHardening::validParams()
      12             : {
      13         146 :   InputParameters params = PlasticHardeningModel::validParams();
      14         146 :   params.addClassDescription("Plastic hardening following a linear isotropic law.");
      15             : 
      16         292 :   params.addRequiredParam<MaterialPropertyName>("yield_stress",
      17             :                                                 "The initial yield stress $\\sigma_y$");
      18         292 :   params.addRequiredParam<MaterialPropertyName>("hardening_modulus", "The hardening modulus $H$");
      19             : 
      20         292 :   params.addRequiredCoupledVar("phase_field", "Name of the phase-field (damage) variable");
      21         292 :   params.addParam<MaterialPropertyName>(
      22             :       "plastic_energy_density",
      23             :       "psip",
      24             :       "Name of the plastic energy density computed by this material model");
      25         292 :   params.addParam<MaterialPropertyName>("degradation_function", "gp", "The degradation function");
      26             : 
      27         146 :   return params;
      28           0 : }
      29             : 
      30           6 : LinearHardening::LinearHardening(const InputParameters & parameters)
      31             :   : PlasticHardeningModel(parameters),
      32             :     DerivativeMaterialPropertyNameInterface(),
      33          18 :     _sigma_y(getADMaterialProperty<Real>(prependBaseName("yield_stress", true))),
      34          12 :     _H(getADMaterialProperty<Real>(prependBaseName("hardening_modulus", true))),
      35             : 
      36          12 :     _d_name(getVar("phase_field", 0)->name()),
      37             : 
      38             :     // The strain energy density and its derivatives
      39           6 :     _psip_name(prependBaseName("plastic_energy_density", true)),
      40           6 :     _psip(declareADProperty<Real>(_psip_name)),
      41           6 :     _psip_active(declareADProperty<Real>(_psip_name + "_active")),
      42          12 :     _dpsip_dd(declareADProperty<Real>(derivativePropertyName(_psip_name, {_d_name}))),
      43             : 
      44             :     // The degradation function and its derivatives
      45           6 :     _gp_name(prependBaseName("degradation_function", true)),
      46           6 :     _gp(getADMaterialProperty<Real>(_gp_name)),
      47          24 :     _dgp_dd(getADMaterialProperty<Real>(derivativePropertyName(_gp_name, {_d_name})))
      48             : {
      49          18 : }
      50             : 
      51             : ADReal
      52      147212 : LinearHardening::plasticEnergy(const ADReal & ep, const unsigned int derivative)
      53             : {
      54      147212 :   if (derivative == 0)
      55             :   {
      56       94560 :     _psip_active[_qp] = _sigma_y[_qp] * ep + _H[_qp] / 2. * ep * ep;
      57       63040 :     _psip[_qp] = _gp[_qp] * _psip_active[_qp];
      58       63040 :     _dpsip_dd[_qp] = _dgp_dd[_qp] * _psip_active[_qp];
      59       31520 :     return _psip[_qp];
      60             :   }
      61             :   // derivative of plastic energy w.r.t equivalent plastic strain ep
      62      115692 :   if (derivative == 1)
      63      294424 :     return _gp[_qp] * (_sigma_y[_qp] + _H[_qp] * ep);
      64             : 
      65       42086 :   if (derivative == 2)
      66       42086 :     return _gp[_qp] * _H[_qp];
      67             : 
      68           0 :   mooseError(name(), "internal error: unsupported derivative order.");
      69             :   return 0;
      70             : }

Generated by: LCOV version 1.16