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

Generated by: LCOV version 1.14