LCOV - code coverage report
Current view: top level - src/materials - FiniteStrainHyperElasticViscoPlastic.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #32971 (54bef8) with base c6cf66 Lines: 347 351 98.9 %
Date: 2026-05-29 20:40:07 Functions: 40 40 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 "FiniteStrainHyperElasticViscoPlastic.h"
      11             : #include "libmesh/utility.h"
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", FiniteStrainHyperElasticViscoPlastic);
      14             : 
      15             : InputParameters
      16          64 : FiniteStrainHyperElasticViscoPlastic::validParams()
      17             : {
      18          64 :   InputParameters params = ComputeStressBase::validParams();
      19         128 :   params.addParam<Real>(
      20         128 :       "resid_abs_tol", 1e-10, "Absolute Tolerance for flow rate residual equation");
      21         128 :   params.addParam<Real>(
      22         128 :       "resid_rel_tol", 1e-6, "Relative Tolerance for flow rate residual equation");
      23         128 :   params.addParam<unsigned int>("maxiters", 50, "Maximum iteration for flow rate update");
      24         128 :   params.addParam<unsigned int>("max_substep_iteration", 1, "Maximum number of substep iteration");
      25         128 :   params.addParam<std::vector<UserObjectName>>(
      26             :       "flow_rate_user_objects",
      27             :       "List of User object names that computes flow rate and derivatives");
      28         128 :   params.addParam<std::vector<UserObjectName>>(
      29             :       "strength_user_objects",
      30             :       "List of User object names that computes strength variables and derivatives");
      31         128 :   params.addParam<std::vector<UserObjectName>>(
      32             :       "internal_var_user_objects",
      33             :       "List of User object names that integrates internal variables and computes derivatives");
      34         128 :   params.addParam<std::vector<UserObjectName>>(
      35             :       "internal_var_rate_user_objects",
      36             :       "List of User object names that computes internal variable rates and derivatives");
      37          64 :   params.addClassDescription("Material class for hyper-elastic viscoplatic flow: Can handle "
      38             :                              "multiple flow models defined by flowratemodel type user objects");
      39             : 
      40          64 :   return params;
      41           0 : }
      42             : 
      43          48 : FiniteStrainHyperElasticViscoPlastic::FiniteStrainHyperElasticViscoPlastic(
      44          48 :     const InputParameters & parameters)
      45             :   : ComputeStressBase(parameters),
      46          48 :     _resid_abs_tol(getParam<Real>("resid_abs_tol")),
      47          96 :     _resid_rel_tol(getParam<Real>("resid_rel_tol")),
      48          96 :     _maxiters(getParam<unsigned int>("maxiters")),
      49          96 :     _max_substep_iter(getParam<unsigned int>("max_substep_iteration")),
      50         192 :     _flow_rate_uo_names(isParamValid("flow_rate_user_objects")
      51          48 :                             ? getParam<std::vector<UserObjectName>>("flow_rate_user_objects")
      52             :                             : std::vector<UserObjectName>(0)),
      53         192 :     _strength_uo_names(isParamValid("strength_user_objects")
      54          48 :                            ? getParam<std::vector<UserObjectName>>("strength_user_objects")
      55             :                            : std::vector<UserObjectName>(0)),
      56         192 :     _int_var_uo_names(isParamValid("internal_var_user_objects")
      57          48 :                           ? getParam<std::vector<UserObjectName>>("internal_var_user_objects")
      58             :                           : std::vector<UserObjectName>(0)),
      59         144 :     _int_var_rate_uo_names(
      60          96 :         isParamValid("internal_var_rate_user_objects")
      61          48 :             ? getParam<std::vector<UserObjectName>>("internal_var_rate_user_objects")
      62             :             : std::vector<UserObjectName>(0)),
      63          48 :     _pk2_prop_name(_base_name + "pk2"),
      64          48 :     _pk2(declareProperty<RankTwoTensor>(_pk2_prop_name)),
      65          48 :     _fp(declareProperty<RankTwoTensor>(_base_name + "fp")),
      66          96 :     _fp_old(getMaterialPropertyOld<RankTwoTensor>(_base_name + "fp")),
      67          48 :     _ce(declareProperty<RankTwoTensor>(_base_name + "ce")),
      68          48 :     _elasticity_tensor_name(_base_name + "elasticity_tensor"),
      69          48 :     _elasticity_tensor(getMaterialPropertyByName<RankFourTensor>(_elasticity_tensor_name)),
      70          96 :     _deformation_gradient(getMaterialProperty<RankTwoTensor>(_base_name + "deformation_gradient")),
      71          48 :     _deformation_gradient_old(
      72          48 :         getMaterialPropertyOld<RankTwoTensor>(_base_name + "deformation_gradient")),
      73         144 :     _rotation_increment(getMaterialProperty<RankTwoTensor>(_base_name + "rotation_increment"))
      74             : {
      75          48 :   initUOVariables();
      76             : 
      77          48 :   initJacobianVariables();
      78             : 
      79          48 :   _dflow_rate.resize(_num_flow_rate_uos);
      80          48 :   _flow_rate.resize(_num_flow_rate_uos);
      81          48 :   _resid.resize(_num_flow_rate_uos);
      82             : 
      83          48 :   _flow_dirn.resize(_num_flow_rate_uos);
      84          48 : }
      85             : 
      86             : void
      87          48 : FiniteStrainHyperElasticViscoPlastic::initUOVariables()
      88             : {
      89          48 :   initNumUserObjects(_flow_rate_uo_names, _num_flow_rate_uos);
      90          48 :   initNumUserObjects(_strength_uo_names, _num_strength_uos);
      91          48 :   initNumUserObjects(_int_var_uo_names, _num_int_var_uos);
      92          48 :   initNumUserObjects(_int_var_rate_uo_names, _num_int_var_rate_uos);
      93             : 
      94          48 :   initProp(_flow_rate_uo_names, _num_flow_rate_uos, _flow_rate_prop);
      95          48 :   initProp(_strength_uo_names, _num_strength_uos, _strength_prop);
      96          48 :   initProp(_int_var_uo_names, _num_int_var_uos, _int_var_stateful_prop);
      97          48 :   initProp(_int_var_rate_uo_names, _num_int_var_rate_uos, _int_var_rate_prop);
      98             : 
      99          48 :   initPropOld(_int_var_uo_names, _num_int_var_uos, _int_var_stateful_prop_old);
     100             : 
     101          48 :   initUserObjects(_flow_rate_uo_names, _num_flow_rate_uos, _flow_rate_uo);
     102          48 :   initUserObjects(_strength_uo_names, _num_strength_uos, _strength_uo);
     103          48 :   initUserObjects(_int_var_uo_names, _num_int_var_uos, _int_var_uo);
     104          48 :   initUserObjects(_int_var_rate_uo_names, _num_int_var_rate_uos, _int_var_rate_uo);
     105             : 
     106          48 :   _int_var_old.resize(_num_int_var_uos, 0.0);
     107          48 : }
     108             : 
     109             : void
     110         192 : FiniteStrainHyperElasticViscoPlastic::initNumUserObjects(
     111             :     const std::vector<UserObjectName> & uo_names, unsigned int & uo_num)
     112             : {
     113         192 :   uo_num = uo_names.size();
     114         192 : }
     115             : 
     116             : template <typename T>
     117             : void
     118         192 : FiniteStrainHyperElasticViscoPlastic::initProp(const std::vector<UserObjectName> & uo_names,
     119             :                                                unsigned int uo_num,
     120             :                                                std::vector<MaterialProperty<T> *> & uo_prop)
     121             : {
     122         192 :   uo_prop.resize(uo_num);
     123         432 :   for (unsigned int i = 0; i < uo_num; ++i)
     124         240 :     uo_prop[i] = &declareProperty<T>(uo_names[i]);
     125         192 : }
     126             : 
     127             : template <typename T>
     128             : void
     129          48 : FiniteStrainHyperElasticViscoPlastic::initPropOld(
     130             :     const std::vector<UserObjectName> & uo_names,
     131             :     unsigned int uo_num,
     132             :     std::vector<const MaterialProperty<T> *> & uo_prop_old)
     133             : {
     134          48 :   uo_prop_old.resize(uo_num);
     135         108 :   for (unsigned int i = 0; i < uo_num; ++i)
     136          60 :     uo_prop_old[i] = &getMaterialPropertyOld<T>(uo_names[i]);
     137          48 : }
     138             : 
     139             : template <typename T>
     140             : void
     141         192 : FiniteStrainHyperElasticViscoPlastic::initUserObjects(const std::vector<UserObjectName> & uo_names,
     142             :                                                       unsigned int uo_num,
     143             :                                                       std::vector<const T *> & uo)
     144             : {
     145         192 :   uo.resize(uo_num);
     146             : 
     147         192 :   if (uo_num == 0)
     148           0 :     mooseError("Specify atleast one user object of type", typeid(T).name());
     149             : 
     150         432 :   for (unsigned int i = 0; i < uo_num; ++i)
     151         240 :     uo[i] = &getUserObjectByName<T>(uo_names[i]);
     152         192 : }
     153             : 
     154             : void
     155          48 : FiniteStrainHyperElasticViscoPlastic::initJacobianVariables()
     156             : {
     157          48 :   _dintvarrate_dflowrate.resize(_num_flow_rate_uos);
     158         108 :   for (unsigned int i = 0; i < _num_flow_rate_uos; ++i)
     159          60 :     _dintvarrate_dflowrate[i].resize(_num_int_var_rate_uos);
     160             : 
     161          48 :   _dintvar_dflowrate_tmp.resize(_num_flow_rate_uos);
     162         108 :   for (unsigned int i = 0; i < _num_flow_rate_uos; ++i)
     163          60 :     _dintvar_dflowrate_tmp[i].resize(_num_int_var_uos);
     164             : 
     165          48 :   _dintvarrate_dintvar.resize(_num_int_var_rate_uos, _num_int_var_uos);
     166          48 :   _dintvar_dintvarrate.resize(_num_int_var_uos, _num_int_var_rate_uos);
     167          48 :   _dintvar_dflowrate.resize(_num_int_var_uos, _num_flow_rate_uos);
     168          48 :   _dintvar_dintvar.resize(_num_int_var_uos, _num_int_var_uos);
     169          48 :   _dstrength_dintvar.resize(_num_strength_uos, _num_int_var_uos);
     170          48 :   _dflowrate_dstrength.resize(_num_flow_rate_uos, _num_strength_uos);
     171          48 :   _dintvar_dintvar_x.resize(_num_int_var_uos);
     172             : 
     173          48 :   _dpk2_dflowrate.resize(_num_flow_rate_uos);
     174          48 :   _dflowrate_dpk2.resize(_num_flow_rate_uos);
     175          48 :   _dfpinv_dflowrate.resize(_num_flow_rate_uos);
     176             : 
     177          48 :   _jac.resize(_num_flow_rate_uos, _num_flow_rate_uos);
     178             : 
     179          48 :   computeDeeDce();
     180          48 : }
     181             : 
     182             : void
     183         192 : FiniteStrainHyperElasticViscoPlastic::initQpStatefulProperties()
     184             : {
     185         192 :   _stress[_qp].zero();
     186         192 :   _ce[_qp].zero();
     187         192 :   _pk2[_qp].zero();
     188         192 :   _fp[_qp].setToIdentity();
     189             : 
     190         432 :   for (unsigned int i = 0; i < _num_flow_rate_uos; ++i)
     191         240 :     (*_flow_rate_prop[i])[_qp] = 0.0;
     192             : 
     193         432 :   for (unsigned int i = 0; i < _num_strength_uos; ++i)
     194         240 :     (*_strength_prop[i])[_qp] = 0.0;
     195             : 
     196         432 :   for (unsigned int i = 0; i < _num_int_var_uos; ++i)
     197             :   {
     198         240 :     (*_int_var_stateful_prop[i])[_qp] = 0.0;
     199             :     // TODO: remove this nasty const_cast if you can figure out how
     200         240 :     const_cast<MaterialProperty<Real> &>(*_int_var_stateful_prop_old[i])[_qp] = 0.0;
     201             :   }
     202             : 
     203         432 :   for (unsigned int i = 0; i < _num_int_var_rate_uos; ++i)
     204         240 :     (*_int_var_rate_prop[i])[_qp] = 0.0;
     205         192 : }
     206             : 
     207             : void
     208       14112 : FiniteStrainHyperElasticViscoPlastic::computeQpStress()
     209             : {
     210             :   bool converge;
     211       14112 :   RankTwoTensor delta_dfgrd = _deformation_gradient[_qp] - _deformation_gradient_old[_qp];
     212       14112 :   unsigned int num_substep = 1;
     213             :   unsigned int substep_iter = 1;
     214             : 
     215       14112 :   saveOldState();
     216             : 
     217             :   do
     218             :   {
     219       45088 :     preSolveQp();
     220             : 
     221             :     converge = true;
     222       45088 :     _dt_substep = _dt / num_substep;
     223             : 
     224      126440 :     for (unsigned int istep = 0; istep < num_substep; ++istep)
     225             :     {
     226      112328 :       _dfgrd_tmp = (istep + 1.0) * delta_dfgrd / num_substep + _deformation_gradient_old[_qp];
     227      112328 :       if (!solveQp())
     228             :       {
     229             :         converge = false;
     230       30976 :         substep_iter++;
     231       30976 :         num_substep *= 2;
     232       30976 :         break;
     233             :       }
     234             :     }
     235             : 
     236       45088 :     if (substep_iter > _max_substep_iter)
     237           0 :       mooseError("Constitutive failure with substepping at quadrature point ",
     238             :                  _q_point[_qp](0),
     239             :                  " ",
     240             :                  _q_point[_qp](1),
     241             :                  " ",
     242           0 :                  _q_point[_qp](2));
     243       45088 :   } while (!converge);
     244             : 
     245       14112 :   postSolveQp();
     246       14112 : }
     247             : 
     248             : void
     249       14112 : FiniteStrainHyperElasticViscoPlastic::saveOldState()
     250             : {
     251       31752 :   for (unsigned int i = 0; i < _num_int_var_uos; ++i)
     252       17640 :     _int_var_old[i] = (*_int_var_stateful_prop_old[i])[_qp];
     253       14112 : }
     254             : 
     255             : void
     256       45088 : FiniteStrainHyperElasticViscoPlastic::preSolveQp()
     257             : {
     258       45088 :   _fp_tmp_old_inv = _fp_old[_qp].inverse();
     259             : 
     260             :   // TODO: remove this nasty const_cast if you can figure out how
     261      101448 :   for (unsigned int i = 0; i < _num_int_var_uos; ++i)
     262       56360 :     (*_int_var_stateful_prop[i])[_qp] =
     263       56360 :         const_cast<MaterialProperty<Real> &>(*_int_var_stateful_prop_old[i])[_qp] = _int_var_old[i];
     264             : 
     265       45088 :   _dpk2_dce = _elasticity_tensor[_qp] * _dee_dce;
     266       45088 : }
     267             : 
     268             : bool
     269      112328 : FiniteStrainHyperElasticViscoPlastic::solveQp()
     270             : {
     271      112328 :   preSolveFlowrate();
     272      112328 :   if (!solveFlowrate())
     273             :     return false;
     274       81352 :   postSolveFlowrate();
     275             : 
     276       81352 :   return true;
     277             : }
     278             : 
     279             : void
     280       14112 : FiniteStrainHyperElasticViscoPlastic::postSolveQp()
     281             : {
     282       14112 :   recoverOldState();
     283             : 
     284       14112 :   _stress[_qp] = _fe * _pk2[_qp] * _fe.transpose() / _fe.det();
     285       14112 :   _fp[_qp] = _fp_tmp_inv.inverse();
     286             : 
     287       14112 :   computeQpJacobian();
     288       14112 : }
     289             : 
     290             : void
     291       14112 : FiniteStrainHyperElasticViscoPlastic::recoverOldState()
     292             : {
     293             :   // TODO: remove this nasty const_cast if you can figure out how
     294       31752 :   for (unsigned int i = 0; i < _num_int_var_uos; ++i)
     295       17640 :     const_cast<MaterialProperty<Real> &>(*_int_var_stateful_prop_old[i])[_qp] = _int_var_old[i];
     296       14112 : }
     297             : 
     298             : void
     299      112328 : FiniteStrainHyperElasticViscoPlastic::preSolveFlowrate()
     300             : {
     301      253008 :   for (unsigned int i = 0; i < _num_flow_rate_uos; ++i)
     302             :   {
     303      140680 :     _flow_rate(i) = 0.0;
     304      140680 :     (*_flow_rate_prop[i])[_qp] = 0.0;
     305             :   }
     306             : 
     307      253008 :   for (unsigned int i = 0; i < _num_int_var_uos; ++i)
     308      140680 :     (*_int_var_stateful_prop[i])[_qp] = (*_int_var_stateful_prop_old[i])[_qp];
     309             : 
     310      112328 :   _fp_tmp_inv = _fp_tmp_old_inv;
     311      112328 :   _fe = _dfgrd_tmp * _fp_tmp_inv;
     312      112328 : }
     313             : 
     314             : bool
     315      112328 : FiniteStrainHyperElasticViscoPlastic::solveFlowrate()
     316             : {
     317             :   Real resid0, rnorm;
     318             :   unsigned int iter = 0;
     319             : 
     320             : #ifdef DEBUG
     321             :   std::vector<Real> rnormst(_maxiters + 1), flowratest(_maxiters + 1);
     322             : #endif
     323             : 
     324      112328 :   if (!computeFlowRateResidual())
     325             :     return false;
     326             : 
     327       81352 :   rnorm = computeNorm(_resid.get_values());
     328             :   resid0 = rnorm;
     329             : 
     330             : #ifdef DEBUG
     331             :   rnormst[iter] = rnorm;
     332             :   flowratest[iter] = computeNorm(_flow_rate.get_values());
     333             : #endif
     334             : 
     335      636032 :   while (rnorm > _resid_abs_tol && rnorm > _resid_rel_tol * resid0 && iter < _maxiters)
     336             :   {
     337      554680 :     computeFlowRateJacobian();
     338             : 
     339      554680 :     updateFlowRate();
     340             : 
     341      554680 :     computeElasticPlasticDeformGrad();
     342             : 
     343      554680 :     if (!computeFlowRateResidual())
     344             :       return false;
     345             : 
     346      554680 :     rnorm = computeNorm(_resid.get_values());
     347      554680 :     iter++;
     348             : 
     349             : #ifdef DEBUG
     350             :     rnormst[iter] = rnorm;
     351             :     flowratest[iter] = computeNorm(_flow_rate.get_values());
     352             : #endif
     353             :   }
     354             : 
     355       81352 :   if (iter == _maxiters && rnorm > _resid_abs_tol && rnorm > _resid_rel_tol * resid0)
     356             :     return false;
     357             : 
     358             :   return true;
     359             : }
     360             : 
     361             : void
     362       81352 : FiniteStrainHyperElasticViscoPlastic::postSolveFlowrate()
     363             : {
     364       81352 :   _fp_tmp_old_inv = _fp_tmp_inv;
     365             : 
     366             :   // TODO: remove this nasty const_cast if you can figure out how
     367      183312 :   for (unsigned int i = 0; i < _num_int_var_uos; ++i)
     368      101960 :     const_cast<MaterialProperty<Real> &>(*_int_var_stateful_prop_old[i])[_qp] =
     369      101960 :         (*_int_var_stateful_prop[i])[_qp];
     370       81352 : }
     371             : 
     372             : bool
     373      667008 : FiniteStrainHyperElasticViscoPlastic::computeFlowRateResidual()
     374             : {
     375      667008 :   if (!computeIntVarRates())
     376             :     return false;
     377             : 
     378      667008 :   if (!computeIntVar())
     379             :     return false;
     380             : 
     381      667008 :   if (!computeStrength())
     382             :     return false;
     383             : 
     384      667008 :   computeElasticRightCauchyGreenTensor();
     385      667008 :   computePK2StressAndDerivative();
     386             : 
     387      667008 :   if (!computeFlowRateFunction())
     388             :     return false;
     389             : 
     390      636032 :   if (!computeFlowDirection())
     391             :     return false;
     392             : 
     393      636032 :   _resid += _flow_rate;
     394             : 
     395      636032 :   return true;
     396             : }
     397             : 
     398             : void
     399      554680 : FiniteStrainHyperElasticViscoPlastic::computeFlowRateJacobian()
     400             : {
     401      554680 :   computeIntVarRateDerivatives();
     402      554680 :   computeIntVarDerivatives();
     403      554680 :   computeStrengthDerivatives();
     404             : 
     405     1250912 :   for (unsigned int i = 0; i < _num_flow_rate_uos; ++i)
     406     1675568 :     for (unsigned int j = 0; j < _num_strength_uos; ++j)
     407      979336 :       _flow_rate_uo[i]->computeDerivative(_qp, _strength_uo_names[j], _dflowrate_dstrength(i, j));
     408             : 
     409     1250912 :   for (unsigned int i = 0; i < _num_flow_rate_uos; ++i)
     410      696232 :     _flow_rate_uo[i]->computeTensorDerivative(_qp, _pk2_prop_name, _dflowrate_dpk2[i]);
     411             : 
     412      554680 :   computeDpk2Dfpinv();
     413             : 
     414     1250912 :   for (unsigned int i = 0; i < _num_flow_rate_uos; ++i)
     415             :   {
     416      696232 :     _dfpinv_dflowrate[i] = -_fp_tmp_old_inv * _flow_dirn[i] * _dt_substep;
     417      696232 :     _dpk2_dflowrate[i] = _dpk2_dfpinv * _dfpinv_dflowrate[i];
     418             :   }
     419             : 
     420      554680 :   DenseMatrix<Real> dflowrate_dflowrate;
     421      554680 :   dflowrate_dflowrate = _dflowrate_dstrength;
     422      554680 :   dflowrate_dflowrate.right_multiply(_dstrength_dintvar);
     423      554680 :   dflowrate_dflowrate.right_multiply(_dintvar_dflowrate);
     424             : 
     425             :   _jac.zero();
     426     1250912 :   for (unsigned int i = 0; i < _num_flow_rate_uos; ++i)
     427     1675568 :     for (unsigned int j = 0; j < _num_flow_rate_uos; ++j)
     428             :     {
     429      979336 :       if (i == j)
     430      696232 :         _jac(i, j) = 1;
     431      979336 :       _jac(i, j) -= dflowrate_dflowrate(i, j);
     432      979336 :       _jac(i, j) -= _dflowrate_dpk2[i].doubleContraction(_dpk2_dflowrate[j]);
     433             :     }
     434      554680 : }
     435             : 
     436             : bool
     437      636032 : FiniteStrainHyperElasticViscoPlastic::computeFlowDirection()
     438             : {
     439     1434224 :   for (unsigned i = 0; i < _num_flow_rate_uos; ++i)
     440             :   {
     441      798192 :     if (!_flow_rate_uo[i]->computeDirection(_qp, _flow_dirn[i]))
     442             :       return false;
     443             :   }
     444             :   return true;
     445             : }
     446             : 
     447             : bool
     448      667008 : FiniteStrainHyperElasticViscoPlastic::computeFlowRateFunction()
     449             : {
     450      667008 :   Real val = 0;
     451     1465200 :   for (unsigned i = 0; i < _num_flow_rate_uos; ++i)
     452             :   {
     453      829168 :     if (_flow_rate_uo[i]->computeValue(_qp, val))
     454      798192 :       _resid(i) = -val;
     455             :     else
     456             :       return false;
     457             :   }
     458             :   return true;
     459             : }
     460             : 
     461             : void
     462      667008 : FiniteStrainHyperElasticViscoPlastic::computePK2StressAndDerivative()
     463             : {
     464      667008 :   computeElasticStrain();
     465      667008 :   _pk2[_qp] = _elasticity_tensor[_qp] * _ee;
     466             : 
     467      667008 :   _dce_dfe.zero();
     468     2668032 :   for (const auto i : make_range(Moose::dim))
     469     8004096 :     for (const auto j : make_range(Moose::dim))
     470    24012288 :       for (const auto k : make_range(Moose::dim))
     471             :       {
     472    18009216 :         _dce_dfe(i, j, k, i) = _dce_dfe(i, j, k, i) + _fe(k, j);
     473    18009216 :         _dce_dfe(i, j, k, j) = _dce_dfe(i, j, k, j) + _fe(k, i);
     474             :       }
     475             : 
     476      667008 :   _dpk2_dfe = _dpk2_dce * _dce_dfe;
     477      667008 : }
     478             : 
     479             : void
     480      667008 : FiniteStrainHyperElasticViscoPlastic::computeElasticStrain()
     481             : {
     482      667008 :   RankTwoTensor iden(RankTwoTensor::initIdentity);
     483      667008 :   _ee = 0.5 * (_ce[_qp] - iden);
     484      667008 : }
     485             : 
     486             : void
     487          48 : FiniteStrainHyperElasticViscoPlastic::computeDeeDce()
     488             : {
     489          48 :   _dee_dce.zero();
     490             : 
     491         192 :   for (const auto i : make_range(Moose::dim))
     492         576 :     for (const auto j : make_range(Moose::dim))
     493         432 :       _dee_dce(i, j, i, j) = 0.5;
     494          48 : }
     495             : 
     496             : void
     497      667008 : FiniteStrainHyperElasticViscoPlastic::computeElasticRightCauchyGreenTensor()
     498             : {
     499      667008 :   _ce[_qp] = _fe.transpose() * _fe;
     500      667008 : }
     501             : 
     502             : void
     503      554680 : FiniteStrainHyperElasticViscoPlastic::computeElasticPlasticDeformGrad()
     504             : {
     505      554680 :   RankTwoTensor iden(RankTwoTensor::initIdentity);
     506             : 
     507      554680 :   RankTwoTensor val;
     508     1250912 :   for (unsigned int i = 0; i < _num_flow_rate_uos; ++i)
     509      696232 :     val += _flow_rate(i) * _flow_dirn[i] * _dt_substep;
     510             : 
     511      554680 :   _fp_tmp_inv = _fp_tmp_old_inv * (iden - val);
     512      554680 :   _fp_tmp_inv = std::pow(_fp_tmp_inv.det(), -1.0 / 3.0) * _fp_tmp_inv;
     513      554680 :   _fe = _dfgrd_tmp * _fp_tmp_inv;
     514      554680 : }
     515             : 
     516             : void
     517      554680 : FiniteStrainHyperElasticViscoPlastic::computeDpk2Dfpinv()
     518             : {
     519     2218720 :   for (const auto i : make_range(Moose::dim))
     520     6656160 :     for (const auto j : make_range(Moose::dim))
     521    19968480 :       for (const auto k : make_range(Moose::dim))
     522    14976360 :         _dfe_dfpinv(i, j, k, j) = _dfgrd_tmp(i, k);
     523             : 
     524      554680 :   _dpk2_dfpinv = _dpk2_dce * _dce_dfe * _dfe_dfpinv;
     525      554680 : }
     526             : 
     527             : Real
     528      636032 : FiniteStrainHyperElasticViscoPlastic::computeNorm(const std::vector<Real> & var)
     529             : {
     530             :   Real val = 0.0;
     531     1434224 :   for (unsigned int i = 0; i < var.size(); ++i)
     532      798192 :     val += Utility::pow<2>(var[i]);
     533      636032 :   return std::sqrt(val);
     534             : }
     535             : 
     536             : void
     537      554680 : FiniteStrainHyperElasticViscoPlastic::updateFlowRate()
     538             : {
     539      554680 :   _jac.lu_solve(_resid, _dflow_rate);
     540      554680 :   _flow_rate -= _dflow_rate;
     541             : 
     542     1250912 :   for (unsigned int i = 0; i < _num_flow_rate_uos; ++i)
     543      696232 :     (*_flow_rate_prop[i])[_qp] = _flow_rate(i);
     544      554680 : }
     545             : 
     546             : void
     547       14112 : FiniteStrainHyperElasticViscoPlastic::computeQpJacobian()
     548             : {
     549             :   usingTensorIndices(i_, j_, k_, l_);
     550       14112 :   _tan_mod = _fe.times<i_, k_, j_, l_>(_fe) * _dpk2_dfe;
     551       14112 :   _pk2_fet = _pk2[_qp] * _fe.transpose();
     552       14112 :   _fe_pk2 = _fe * _pk2[_qp];
     553             : 
     554       56448 :   for (const auto i : make_range(Moose::dim))
     555      169344 :     for (const auto j : make_range(Moose::dim))
     556      508032 :       for (const auto l : make_range(Moose::dim))
     557             :       {
     558      381024 :         _tan_mod(i, j, i, l) += _pk2_fet(l, j);
     559      381024 :         _tan_mod(i, j, j, l) += _fe_pk2(i, l);
     560             :       }
     561             : 
     562       14112 :   _tan_mod /= _fe.det();
     563             : 
     564       56448 :   for (const auto i : make_range(Moose::dim))
     565      169344 :     for (const auto j : make_range(Moose::dim))
     566      508032 :       for (const auto l : make_range(Moose::dim))
     567      381024 :         _dfe_df(i, j, i, l) = _fp_tmp_inv(l, j);
     568             : 
     569       56448 :   for (const auto i : make_range(Moose::dim))
     570      169344 :     for (const auto j : make_range(Moose::dim))
     571      508032 :       for (const auto k : make_range(Moose::dim))
     572     1524096 :         for (const auto l : make_range(Moose::dim))
     573     1143072 :           _df_dstretch_inc(i, j, k, l) =
     574     1143072 :               _rotation_increment[_qp](i, k) * _deformation_gradient_old[_qp](l, j);
     575             : 
     576       14112 :   _Jacobian_mult[_qp] = _tan_mod * _dfe_df * _df_dstretch_inc;
     577       14112 : }
     578             : 
     579             : bool
     580      667008 : FiniteStrainHyperElasticViscoPlastic::computeIntVarRates()
     581             : {
     582      667008 :   Real val = 0;
     583     1503920 :   for (unsigned int i = 0; i < _num_int_var_rate_uos; ++i)
     584             :   {
     585      836912 :     if (_int_var_rate_uo[i]->computeValue(_qp, val))
     586      836912 :       (*_int_var_rate_prop[i])[_qp] = val;
     587             :     else
     588             :       return false;
     589             :   }
     590             :   return true;
     591             : }
     592             : 
     593             : bool
     594      667008 : FiniteStrainHyperElasticViscoPlastic::computeIntVar()
     595             : {
     596      667008 :   Real val = 0;
     597     1503920 :   for (unsigned int i = 0; i < _num_int_var_uos; ++i)
     598             :   {
     599      836912 :     if (_int_var_uo[i]->computeValue(_qp, _dt_substep, val))
     600      836912 :       (*_int_var_stateful_prop[i])[_qp] = val;
     601             :     else
     602             :       return false;
     603             :   }
     604             :   return true;
     605             : }
     606             : 
     607             : bool
     608      667008 : FiniteStrainHyperElasticViscoPlastic::computeStrength()
     609             : {
     610      667008 :   Real val = 0;
     611     1503920 :   for (unsigned int i = 0; i < _num_strength_uos; ++i)
     612             :   {
     613      836912 :     if (_strength_uo[i]->computeValue(_qp, val))
     614      836912 :       (*_strength_prop[i])[_qp] = val;
     615             :     else
     616             :       return false;
     617             :   }
     618             :   return true;
     619             : }
     620             : 
     621             : void
     622      554680 : FiniteStrainHyperElasticViscoPlastic::computeIntVarRateDerivatives()
     623             : {
     624      554680 :   Real val = 0;
     625             : 
     626     1250912 :   for (unsigned int i = 0; i < _num_int_var_rate_uos; ++i)
     627     1675568 :     for (unsigned int j = 0; j < _num_flow_rate_uos; ++j)
     628             :     {
     629      979336 :       _int_var_rate_uo[i]->computeDerivative(_qp, _flow_rate_uo_names[j], val);
     630      979336 :       _dintvarrate_dflowrate[j](i) = val;
     631             :     }
     632      554680 : }
     633             : 
     634             : void
     635      554680 : FiniteStrainHyperElasticViscoPlastic::computeIntVarDerivatives()
     636             : {
     637      554680 :   Real val = 0;
     638             : 
     639     1250912 :   for (unsigned int i = 0; i < _num_int_var_uos; ++i)
     640     1675568 :     for (unsigned int j = 0; j < _num_int_var_rate_uos; ++j)
     641             :     {
     642      979336 :       _int_var_uo[i]->computeDerivative(_qp, _dt_substep, _int_var_rate_uo_names[j], val);
     643      979336 :       _dintvar_dintvarrate(i, j) = val;
     644             :     }
     645             : 
     646             :   _dintvar_dintvar.zero();
     647             : 
     648     1250912 :   for (unsigned int i = 0; i < _num_int_var_uos; ++i)
     649     1675568 :     for (unsigned int j = 0; j < _num_int_var_uos; ++j)
     650             :     {
     651      979336 :       if (i == j)
     652      696232 :         _dintvar_dintvar(i, j) = 1;
     653     2524880 :       for (unsigned int k = 0; k < _num_int_var_rate_uos; ++k)
     654     1545544 :         _dintvar_dintvar(i, j) -= _dintvar_dintvarrate(i, k) * _dintvarrate_dintvar(k, j);
     655             :     }
     656             : 
     657     1250912 :   for (unsigned int i = 0; i < _num_flow_rate_uos; ++i)
     658      696232 :     _dintvar_dintvarrate.vector_mult(_dintvar_dflowrate_tmp[i], _dintvarrate_dflowrate[i]);
     659             : 
     660     1250912 :   for (unsigned int i = 0; i < _num_flow_rate_uos; ++i)
     661             :   {
     662             :     _dintvar_dintvar_x.zero();
     663      696232 :     _dintvar_dintvar.lu_solve(_dintvar_dflowrate_tmp[i], _dintvar_dintvar_x);
     664     1675568 :     for (unsigned int j = 0; j < _num_int_var_uos; ++j)
     665      979336 :       _dintvar_dflowrate(j, i) = _dintvar_dintvar_x(j);
     666             :   }
     667      554680 : }
     668             : 
     669             : void
     670      554680 : FiniteStrainHyperElasticViscoPlastic::computeStrengthDerivatives()
     671             : {
     672      554680 :   Real val = 0;
     673             : 
     674     1250912 :   for (unsigned int i = 0; i < _num_strength_uos; ++i)
     675     1675568 :     for (unsigned int j = 0; j < _num_int_var_uos; ++j)
     676             :     {
     677      979336 :       _strength_uo[i]->computeDerivative(_qp, _int_var_uo_names[j], val);
     678      979336 :       _dstrength_dintvar(i, j) = val;
     679             :     }
     680      554680 : }

Generated by: LCOV version 1.14