LCOV - code coverage report
Current view: top level - src/materials/lagrangian - ComputeHypoelasticStVenantKirchhoffStress.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 34 35 97.1 %
Date: 2025-07-25 05:00:39 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #include "ComputeHypoelasticStVenantKirchhoffStress.h"
      11             : 
      12             : registerMooseObject("SolidMechanicsApp", ComputeHypoelasticStVenantKirchhoffStress);
      13             : 
      14             : InputParameters
      15          72 : ComputeHypoelasticStVenantKirchhoffStress::validParams()
      16             : {
      17          72 :   InputParameters params = ComputeLagrangianObjectiveStress::validParams();
      18          72 :   params.addClassDescription(
      19             :       "Calculate a small strain elastic stress that is equivalent to the hyperelastic St. "
      20             :       "Venant-Kirchhoff model if integrated using the Truesdell rate.");
      21             : 
      22         144 :   params.addParam<MaterialPropertyName>(
      23             :       "elasticity_tensor", "elasticity_tensor", "The name of the elasticity tensor.");
      24             : 
      25          72 :   return params;
      26           0 : }
      27             : 
      28          54 : ComputeHypoelasticStVenantKirchhoffStress::ComputeHypoelasticStVenantKirchhoffStress(
      29          54 :     const InputParameters & parameters)
      30             :   : ComputeLagrangianObjectiveStress(parameters),
      31          54 :     _elasticity_tensor(getMaterialProperty<RankFourTensor>(
      32         108 :         getParam<MaterialPropertyName>(_base_name + "elasticity_tensor"))),
      33         162 :     _def_grad(getMaterialProperty<RankTwoTensor>(_base_name + "deformation_gradient"))
      34             : {
      35          54 : }
      36             : 
      37             : void
      38     3895744 : ComputeHypoelasticStVenantKirchhoffStress::computeQpSmallStress()
      39             : {
      40             :   usingTensorIndices(i, j, k, l);
      41             : 
      42             :   // The increment in the spatial velocity gradient
      43     3895744 :   RankTwoTensor dL = _strain_increment[_qp] + _vorticity_increment[_qp];
      44             : 
      45             :   // If small kinematics, it falls back to the grade-zero hypoelasticity
      46     3895744 :   if (!_large_kinematics)
      47             :   {
      48     1947648 :     _small_stress[_qp] = _small_stress_old[_qp] + _elasticity_tensor[_qp] * dL;
      49     1947648 :     _small_jacobian[_qp] = _elasticity_tensor[_qp];
      50             :     return;
      51             :   }
      52             : 
      53             :   // Large kinematics:
      54             :   // First push forward the elasticity tensor
      55     1948096 :   const RankTwoTensor F = _def_grad[_qp];
      56     1948096 :   const Real J = F.det();
      57     1948096 :   const RankFourTensor FF = F.times<i, k, j, l>(F);
      58     1948096 :   const RankFourTensor FtFt = F.times<k, i, l, j>(F);
      59     1948096 :   const RankFourTensor C0 = _elasticity_tensor[_qp];
      60     1948096 :   const RankFourTensor C = FF * C0 * FtFt / J;
      61             : 
      62             :   // Update the small stress
      63     1948096 :   const RankTwoTensor dS = C * dL;
      64     1948096 :   _small_stress[_qp] = _small_stress_old[_qp] + dS;
      65             : 
      66             :   // Compute the small Jacobian
      67     1948096 :   if (_fe_problem.currentlyComputingJacobian())
      68             :   {
      69        7264 :     const RankFourTensor dFddL = _inv_df[_qp].inverse().times<i, k, l, j>(F);
      70        7264 :     _small_jacobian[_qp] =
      71        7264 :         C +
      72        7264 :         (dFddL.singleProductJ((C0.tripleProductJkl(F, F, F) * dL).transpose()) +
      73       14528 :          dFddL.singleProductJ(C0.tripleProductIkl(F, F, F) * dL).transposeIj() +
      74       14528 :          FF * C0.singleProductL(F * dL).transposeKl() * dFddL +
      75       14528 :          FF * C0.singleProductK(dL.transpose() * F) * dFddL) /
      76        7264 :             J -
      77       14528 :         dS.outerProduct(_inv_def_grad[_qp].transpose().initialContraction(dFddL));
      78             :   }
      79             : }

Generated by: LCOV version 1.14