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

Generated by: LCOV version 1.14