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

Generated by: LCOV version 1.14