LCOV - code coverage report
Current view: top level - src/materials/lagrangian - ComputeLagrangianStressCauchy.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #33187 (5aa0b2) with base d7c4bd Lines: 25 26 96.2 %
Date: 2026-06-30 12:24:09 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://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 "ComputeLagrangianStressCauchy.h"
      11             : 
      12             : InputParameters
      13        3256 : ComputeLagrangianStressCauchy::validParams()
      14             : {
      15        3256 :   InputParameters params = ComputeLagrangianStressBase::validParams();
      16             : 
      17        3256 :   params.addClassDescription("Stress update based on the Cauchy stress");
      18             : 
      19        3256 :   return params;
      20           0 : }
      21             : 
      22        2442 : ComputeLagrangianStressCauchy::ComputeLagrangianStressCauchy(const InputParameters & parameters)
      23             :   : ComputeLagrangianStressBase(parameters),
      24        2442 :     _inv_df(getMaterialPropertyByName<RankTwoTensor>(_base_name +
      25             :                                                      "inverse_incremental_deformation_gradient")),
      26        2442 :     _inv_def_grad(
      27        2442 :         getMaterialPropertyByName<RankTwoTensor>(_base_name + "inverse_deformation_gradient")),
      28        7326 :     _F(getMaterialPropertyByName<RankTwoTensor>(_base_name + "deformation_gradient"))
      29             : {
      30        2442 : }
      31             : 
      32             : void
      33    30340420 : ComputeLagrangianStressCauchy::computeQpStressUpdate()
      34             : {
      35    30340420 :   computeQpCauchyStress();
      36    30340420 :   computeQpPK1Stress(); // This could be "switched"
      37    30340420 : }
      38             : 
      39             : void
      40    30340420 : ComputeLagrangianStressCauchy::computeQpPK1Stress()
      41             : {
      42             :   // Actually do the (annoying) wrapping
      43    30340420 :   if (_large_kinematics)
      44             :   {
      45    14462856 :     _pk1_stress[_qp] = _F[_qp].det() * _cauchy_stress[_qp] * _inv_def_grad[_qp].transpose();
      46             : 
      47             :     usingTensorIndices(i_, j_, k_, l_);
      48    28925712 :     _pk1_jacobian[_qp] = _pk1_stress[_qp].outerProduct(_inv_def_grad[_qp].transpose());
      49    14462856 :     _pk1_jacobian[_qp] -= _pk1_stress[_qp].times<i_, l_, j_, k_>(_inv_def_grad[_qp]);
      50    14462856 :     _pk1_jacobian[_qp] +=
      51    14462856 :         _F[_qp].det() * _cauchy_jacobian[_qp].tripleProductJkl(
      52    28925712 :                             _inv_def_grad[_qp], _inv_df[_qp].transpose(), _inv_def_grad[_qp]);
      53             :   }
      54             :   else
      55             :   {
      56    15877564 :     _pk1_stress[_qp] = _cauchy_stress[_qp];
      57    15877564 :     _pk1_jacobian[_qp] = _cauchy_jacobian[_qp];
      58             :   }
      59    30340420 : }

Generated by: LCOV version 1.14