LCOV - code coverage report
Current view: top level - src/materials - ExponentialSoftening.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 25 27 92.6 %
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 "ExponentialSoftening.h"
      11             : 
      12             : #include "MooseMesh.h"
      13             : 
      14             : registerMooseObject("SolidMechanicsApp", ExponentialSoftening);
      15             : 
      16             : InputParameters
      17         184 : ExponentialSoftening::validParams()
      18             : {
      19         184 :   InputParameters params = SmearedCrackSofteningBase::validParams();
      20         184 :   params.addClassDescription(
      21             :       "Softening model with an exponential softening response upon cracking. This "
      22             :       "class is intended to be used with ComputeSmearedCrackingStress.");
      23         552 :   params.addRangeCheckedParam<Real>(
      24             :       "residual_stress",
      25         368 :       0.0,
      26             :       "residual_stress <= 1 & residual_stress >= 0",
      27             :       "The fraction of the cracking stress allowed to be maintained following a crack.");
      28         552 :   params.addRangeCheckedParam<Real>(
      29             :       "alpha",
      30         368 :       -1.0,
      31             :       "alpha <= 0",
      32             :       "Initial slope of the exponential softening curve at crack initiation. "
      33             :       "If not specified, it is equal to the negative of the Young's modulus.");
      34         552 :   params.addRangeCheckedParam<Real>(
      35             :       "beta",
      36         368 :       1.0,
      37             :       "beta >= 0",
      38             :       "Multiplier applied to alpha to control the exponential softening "
      39             :       "behavior.");
      40         184 :   return params;
      41           0 : }
      42             : 
      43         138 : ExponentialSoftening::ExponentialSoftening(const InputParameters & parameters)
      44             :   : SmearedCrackSofteningBase(parameters),
      45         138 :     _residual_stress(getParam<Real>("residual_stress")),
      46         276 :     _alpha(getParam<Real>("alpha")),
      47         138 :     _alpha_set_by_user(parameters.isParamSetByUser("alpha")),
      48         414 :     _beta(getParam<Real>("beta"))
      49             : {
      50         138 : }
      51             : 
      52             : void
      53      171872 : ExponentialSoftening::computeCrackingRelease(Real & stress,
      54             :                                              Real & stiffness_ratio,
      55             :                                              const Real /*strain*/,
      56             :                                              const Real crack_initiation_strain,
      57             :                                              const Real crack_max_strain,
      58             :                                              const Real cracking_stress,
      59             :                                              const Real youngs_modulus)
      60             : {
      61             :   mooseAssert(crack_max_strain >= crack_initiation_strain,
      62             :               "crack_max_strain must be >= crack_initiation_strain");
      63             : 
      64             :   Real alpha = 0.0;
      65      171872 :   if (_alpha_set_by_user)
      66           0 :     alpha = _alpha;
      67             :   else
      68      171872 :     alpha = -youngs_modulus;
      69             : 
      70             :   // Compute stress that follows exponental curve
      71      171872 :   stress = cracking_stress *
      72      171872 :            (_residual_stress +
      73      171872 :             (1.0 - _residual_stress) * std::exp(alpha * _beta / cracking_stress *
      74      171872 :                                                 (crack_max_strain - crack_initiation_strain)));
      75             :   // Compute ratio of current stiffness to original stiffness
      76      171872 :   stiffness_ratio = stress * crack_initiation_strain / (crack_max_strain * cracking_stress);
      77      171872 : }

Generated by: LCOV version 1.14