LCOV - code coverage report
Current view: top level - src/materials/lagrangian - ComputeLagrangianStressPK1.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 23 24 95.8 %
Date: 2024-02-27 11:53:14 Functions: 4 4 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 "ComputeLagrangianStressPK1.h"
      11             : 
      12             : InputParameters
      13         196 : ComputeLagrangianStressPK1::validParams()
      14             : {
      15         196 :   InputParameters params = ComputeLagrangianStressBase::validParams();
      16             : 
      17         196 :   params.addClassDescription("Stress update based on the first Piola-Kirchhoff stress");
      18             : 
      19         196 :   return params;
      20           0 : }
      21             : 
      22         147 : ComputeLagrangianStressPK1::ComputeLagrangianStressPK1(const InputParameters & parameters)
      23             :   : ComputeLagrangianStressBase(parameters),
      24         147 :     _inv_df(getMaterialPropertyByName<RankTwoTensor>(_base_name +
      25             :                                                      "inverse_incremental_deformation_gradient")),
      26         441 :     _F(getMaterialPropertyByName<RankTwoTensor>(_base_name + "deformation_gradient"))
      27             : {
      28         147 : }
      29             : 
      30             : void
      31     4273920 : ComputeLagrangianStressPK1::computeQpStressUpdate()
      32             : {
      33     4273920 :   computeQpPK1Stress();
      34     4273920 :   computeQpCauchyStress(); // This could be "switched"
      35     4273920 : }
      36             : 
      37             : void
      38     4273920 : ComputeLagrangianStressPK1::computeQpCauchyStress()
      39             : {
      40             :   // Actually do the (annoying) wrapping
      41     4273920 :   if (_large_kinematics)
      42             :   {
      43     2320832 :     _cauchy_stress[_qp] = _pk1_stress[_qp] * _F[_qp].transpose() / _F[_qp].det();
      44             : 
      45     2320832 :     auto f = _inv_df[_qp].inverse();
      46             :     usingTensorIndices(i_, j_, k_, l_);
      47     4641664 :     _cauchy_jacobian[_qp] = _cauchy_stress[_qp].times<i_, l_, j_, k_>(f) -
      48     4641664 :                             _cauchy_stress[_qp].times<i_, j_, k_, l_>(f.transpose());
      49     2320832 :     _cauchy_jacobian[_qp] +=
      50     4641664 :         _pk1_jacobian[_qp].tripleProductJkl(_F[_qp], f.transpose(), _F[_qp]) / _F[_qp].det();
      51             :   }
      52             :   // Small deformations these are the same
      53             :   else
      54             :   {
      55     1953088 :     _cauchy_stress[_qp] = _pk1_stress[_qp];
      56     1953088 :     _cauchy_jacobian[_qp] = _pk1_jacobian[_qp];
      57             :   }
      58     4273920 : }

Generated by: LCOV version 1.14