LCOV - code coverage report
Current view: top level - src/materials - ADPowerLawSoftening.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 13 14 92.9 %
Date: 2025-07-25 05:00:39 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #include "ADPowerLawSoftening.h"
      11             : 
      12             : #include "MooseMesh.h"
      13             : 
      14             : registerMooseObject("SolidMechanicsApp", ADPowerLawSoftening);
      15             : 
      16             : InputParameters
      17          72 : ADPowerLawSoftening::validParams()
      18             : {
      19          72 :   InputParameters params = ADSmearedCrackSofteningBase::validParams();
      20          72 :   params.addClassDescription("Softening model with an abrupt stress release upon cracking. This "
      21             :                              "class is intended to be used with ADComputeSmearedCrackingStress and "
      22             :                              "relies on automatic differentiation.");
      23         144 :   params.addRequiredRangeCheckedParam<Real>(
      24             :       "stiffness_reduction",
      25             :       "stiffness_reduction <= 1 & stiffness_reduction >= 0",
      26             :       "Factor multiplied by the current stiffness each time a new crack forms");
      27          72 :   return params;
      28           0 : }
      29             : 
      30          54 : ADPowerLawSoftening::ADPowerLawSoftening(const InputParameters & parameters)
      31             :   : ADSmearedCrackSofteningBase(parameters),
      32         108 :     _stiffness_reduction(getParam<Real>("stiffness_reduction"))
      33             : {
      34          54 : }
      35             : 
      36             : void
      37      281472 : ADPowerLawSoftening::computeCrackingRelease(ADReal & stress,
      38             :                                             ADReal & stiffness_ratio,
      39             :                                             const ADReal & strain,
      40             :                                             const ADReal & /*crack_initiation_strain*/,
      41             :                                             const ADReal & /*crack_max_strain*/,
      42             :                                             const ADReal & cracking_stress,
      43             :                                             const ADReal & youngs_modulus)
      44             : {
      45      281472 :   if (stress > cracking_stress)
      46             :   {
      47             :     // This is equivalent to k = k_0 * (stiffness_reduction)^n, where n is the number of cracks
      48        3264 :     stiffness_ratio *= _stiffness_reduction;
      49        3264 :     stress = stiffness_ratio * youngs_modulus * strain;
      50             :   }
      51      281472 : }

Generated by: LCOV version 1.14