LCOV - code coverage report
Current view: top level - src/userobjects - TensorMechanicsHardeningGaussian.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 26 29 89.7 %
Date: 2024-02-27 11:53:14 Functions: 4 5 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://www.mooseframework.org
       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 "TensorMechanicsHardeningGaussian.h"
      11             : 
      12             : registerMooseObject("TensorMechanicsApp", TensorMechanicsHardeningGaussian);
      13             : 
      14             : InputParameters
      15          24 : TensorMechanicsHardeningGaussian::validParams()
      16             : {
      17          24 :   InputParameters params = TensorMechanicsHardeningModel::validParams();
      18          48 :   params.addRequiredParam<Real>(
      19             :       "value_0", "The value of the parameter for all internal_parameter <= internal_0");
      20          48 :   params.addParam<Real>("value_residual",
      21             :                         "The value of the parameter for internal_parameter = "
      22             :                         "infinity.  Default = value_0, ie perfect plasticity");
      23          48 :   params.addParam<Real>(
      24          48 :       "internal_0", 0, "The value of the internal_parameter when hardening begins");
      25          48 :   params.addParam<Real>("rate",
      26          48 :                         0,
      27             :                         "Let p = internal_parameter.  Then value = value_0 for "
      28             :                         "p<internal_0, and value = value_residual + (value_0 - "
      29             :                         "value_residual)*exp(-0.5*rate*(p - internal_0)^2)");
      30          24 :   params.addClassDescription("Hardening is Gaussian");
      31          24 :   return params;
      32           0 : }
      33             : 
      34          12 : TensorMechanicsHardeningGaussian::TensorMechanicsHardeningGaussian(
      35          12 :     const InputParameters & parameters)
      36             :   : TensorMechanicsHardeningModel(parameters),
      37          12 :     _val_0(getParam<Real>("value_0")),
      38          36 :     _val_res(parameters.isParamValid("value_residual") ? getParam<Real>("value_residual") : _val_0),
      39          24 :     _intnl_0(getParam<Real>("internal_0")),
      40          36 :     _rate(getParam<Real>("rate"))
      41             : {
      42          12 : }
      43             : 
      44             : Real
      45       22159 : TensorMechanicsHardeningGaussian::value(Real intnl) const
      46             : {
      47       22159 :   Real x = intnl - _intnl_0;
      48       22159 :   if (x <= 0)
      49        1151 :     return _val_0;
      50             :   else
      51       21008 :     return _val_res + (_val_0 - _val_res) * std::exp(-0.5 * _rate * x * x);
      52             : }
      53             : 
      54             : Real
      55        7728 : TensorMechanicsHardeningGaussian::derivative(Real intnl) const
      56             : {
      57        7728 :   Real x = intnl - _intnl_0;
      58        7728 :   if (x <= 0)
      59             :     return 0;
      60             :   else
      61        7536 :     return -_rate * x * (_val_0 - _val_res) * std::exp(-0.5 * _rate * x * x);
      62             : }
      63             : 
      64             : std::string
      65           0 : TensorMechanicsHardeningGaussian::modelName() const
      66             : {
      67           0 :   return "Gaussian";
      68             : }

Generated by: LCOV version 1.14