LCOV - code coverage report
Current view: top level - src/materials - ADAbruptSoftening.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 15 18 83.3 %
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 "ADAbruptSoftening.h"
      11             : 
      12             : #include "MooseMesh.h"
      13             : 
      14             : registerMooseObject("SolidMechanicsApp", ADAbruptSoftening);
      15             : 
      16             : InputParameters
      17         130 : ADAbruptSoftening::validParams()
      18             : {
      19         130 :   InputParameters params = ADSmearedCrackSofteningBase::validParams();
      20         130 :   params.addClassDescription("Softening model with an abrupt stress release upon cracking. This "
      21             :                              "class relies on automatic differentiation and is intended to be used "
      22             :                              "with ADComputeSmearedCrackingStress.");
      23         390 :   params.addRangeCheckedParam<Real>(
      24             :       "residual_stress",
      25         260 :       0.0,
      26             :       "residual_stress <= 1 & residual_stress >= 0",
      27             :       "The fraction of the cracking stress allowed to be maintained following a crack.");
      28         130 :   return params;
      29           0 : }
      30             : 
      31          96 : ADAbruptSoftening::ADAbruptSoftening(const InputParameters & parameters)
      32         192 :   : ADSmearedCrackSofteningBase(parameters), _residual_stress(getParam<Real>("residual_stress"))
      33             : {
      34          96 : }
      35             : 
      36             : void
      37       97680 : ADAbruptSoftening::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       97680 :   if (_residual_stress == 0.0)
      46             :   {
      47       97680 :     const Real tiny = 1.e-16;
      48       97680 :     stiffness_ratio = tiny;
      49       97680 :     stress = tiny * crack_initiation_strain * youngs_modulus;
      50             :   }
      51             :   else
      52             :   {
      53           0 :     stress = _residual_stress * cracking_stress;
      54           0 :     stiffness_ratio = stress / (crack_max_strain * youngs_modulus);
      55             :   }
      56       97680 : }

Generated by: LCOV version 1.14