LCOV - code coverage report
Current view: top level - src/userobjects - CrystalPlasticityStateVarRateComponentGSS.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 34 35 97.1 %
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 "CrystalPlasticityStateVarRateComponentGSS.h"
      11             : #include <cmath>
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", CrystalPlasticityStateVarRateComponentGSS);
      14             : 
      15             : InputParameters
      16         144 : CrystalPlasticityStateVarRateComponentGSS::validParams()
      17             : {
      18         144 :   InputParameters params = CrystalPlasticityStateVarRateComponent::validParams();
      19         288 :   params.addParam<std::string>(
      20             :       "uo_slip_rate_name",
      21             :       "Name of slip rate property: Same as slip rate user object specified in input file.");
      22         288 :   params.addParam<std::string>("uo_state_var_name",
      23             :                                "Name of state variable property: Same as "
      24             :                                "state variable user object specified in input "
      25             :                                "file.");
      26         288 :   params.addParam<FileName>(
      27             :       "slip_sys_hard_prop_file_name",
      28             :       "",
      29             :       "Name of the file containing the values of hardness evolution parameters");
      30         288 :   params.addParam<std::vector<Real>>("hprops", "Hardening properties");
      31         144 :   params.addClassDescription("Phenomenological constitutive model state variable evolution rate "
      32             :                              "component base class.  Override the virtual functions in your class");
      33         144 :   return params;
      34           0 : }
      35             : 
      36          72 : CrystalPlasticityStateVarRateComponentGSS::CrystalPlasticityStateVarRateComponentGSS(
      37          72 :     const InputParameters & parameters)
      38             :   : CrystalPlasticityStateVarRateComponent(parameters),
      39          72 :     _mat_prop_slip_rate(
      40          72 :         getMaterialProperty<std::vector<Real>>(parameters.get<std::string>("uo_slip_rate_name"))),
      41          72 :     _mat_prop_state_var(
      42          72 :         getMaterialProperty<std::vector<Real>>(parameters.get<std::string>("uo_state_var_name"))),
      43          72 :     _slip_sys_hard_prop_file_name(getParam<FileName>("slip_sys_hard_prop_file_name")),
      44         216 :     _hprops(getParam<std::vector<Real>>("hprops"))
      45             : {
      46          72 : }
      47             : 
      48             : bool
      49      304128 : CrystalPlasticityStateVarRateComponentGSS::calcStateVariableEvolutionRateComponent(
      50             :     unsigned int qp, std::vector<Real> & val) const
      51             : {
      52      304128 :   val.assign(_variable_size, 0.0);
      53             : 
      54      304128 :   Real r = _hprops[0];
      55      304128 :   Real h0 = _hprops[1];
      56      304128 :   Real tau_sat = _hprops[2];
      57             : 
      58      304128 :   DenseVector<Real> hb(_variable_size);
      59             :   Real qab;
      60      304128 :   Real a = _hprops[3]; // Kalidindi
      61             : 
      62     3953664 :   for (unsigned int i = 0; i < _variable_size; ++i)
      63     3649536 :     hb(i) = h0 * std::pow(std::abs(1.0 - _mat_prop_state_var[qp][i] / tau_sat), a) *
      64     3649536 :             std::copysign(1.0, 1.0 - _mat_prop_state_var[qp][i] / tau_sat);
      65             : 
      66     3953664 :   for (unsigned int i = 0; i < _variable_size; ++i)
      67             :   {
      68    47443968 :     for (unsigned int j = 0; j < _variable_size; ++j)
      69             :     {
      70             :       unsigned int iplane, jplane;
      71    43794432 :       iplane = i / 3;
      72    43794432 :       jplane = j / 3;
      73             : 
      74    43794432 :       if (iplane == jplane) // Kalidindi
      75             :         qab = 1.0;
      76             :       else
      77             :         qab = r;
      78             : 
      79    43794432 :       val[i] += std::abs(_mat_prop_slip_rate[qp][j]) * qab * hb(j);
      80             :     }
      81             :   }
      82             : 
      83      304128 :   return true;
      84             : }

Generated by: LCOV version 1.14