LCOV - code coverage report
Current view: top level - src/userobjects - HEVPLinearHardening.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 18 19 94.7 %
Date: 2025-07-25 05:00:39 Functions: 4 4 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 "HEVPLinearHardening.h"
      11             : 
      12             : registerMooseObject("SolidMechanicsApp", HEVPLinearHardening);
      13             : 
      14             : InputParameters
      15          12 : HEVPLinearHardening::validParams()
      16             : {
      17          12 :   InputParameters params = HEVPStrengthUOBase::validParams();
      18          24 :   params.addParam<Real>("yield_stress", "Yield strength");
      19          24 :   params.addParam<Real>("slope", "Linear hardening slope");
      20          12 :   params.addClassDescription("User Object for linear hardening");
      21          12 :   return params;
      22           0 : }
      23             : 
      24           6 : HEVPLinearHardening::HEVPLinearHardening(const InputParameters & parameters)
      25             :   : HEVPStrengthUOBase(parameters),
      26           6 :     _sig0(getParam<Real>("yield_stress")),
      27          18 :     _slope(getParam<Real>("slope"))
      28             : {
      29           6 : }
      30             : 
      31             : bool
      32      212960 : HEVPLinearHardening::computeValue(unsigned int qp, Real & val) const
      33             : {
      34      212960 :   val = _sig0 + _slope * _intvar[qp];
      35      212960 :   return true;
      36             : }
      37             : 
      38             : bool
      39      177184 : HEVPLinearHardening::computeDerivative(unsigned int /*qp*/,
      40             :                                        const std::string & coupled_var_name,
      41             :                                        Real & val) const
      42             : {
      43      177184 :   val = 0;
      44             : 
      45      177184 :   if (_intvar_prop_name == coupled_var_name)
      46      177184 :     val = _slope;
      47             : 
      48      177184 :   return true;
      49             : }

Generated by: LCOV version 1.14