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

Generated by: LCOV version 1.14