LCOV - code coverage report
Current view: top level - src/materials/cohesive_zone_model - CZMComputeGlobalTractionTotalLagrangian.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 45 49 91.8 %
Date: 2025-07-25 05:00:39 Functions: 6 7 85.7 %
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 "CZMComputeGlobalTractionTotalLagrangian.h"
      11             : #include "CohesiveZoneModelTools.h"
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", CZMComputeGlobalTractionTotalLagrangian);
      14             : 
      15             : InputParameters
      16         132 : CZMComputeGlobalTractionTotalLagrangian::validParams()
      17             : {
      18         132 :   InputParameters params = CZMComputeGlobalTractionBase::validParams();
      19             : 
      20         132 :   params.addClassDescription("Compute the equilibrium traction (PK1) and its derivatives for the "
      21             :                              "Total Lagrangian formulation.");
      22         132 :   return params;
      23           0 : }
      24             : 
      25          60 : CZMComputeGlobalTractionTotalLagrangian::CZMComputeGlobalTractionTotalLagrangian(
      26          60 :     const InputParameters & parameters)
      27             :   : CZMComputeGlobalTractionBase(parameters),
      28          60 :     _displacement_jump_global(
      29         120 :         getMaterialPropertyByName<RealVectorValue>(_base_name + "displacement_jump_global")),
      30          60 :     _czm_reference_rotation(
      31          60 :         getMaterialPropertyByName<RankTwoTensor>(_base_name + "czm_reference_rotation")),
      32         120 :     _R(getMaterialPropertyByName<RankTwoTensor>(_base_name + "czm_rotation")),
      33         120 :     _F(getMaterialPropertyByName<RankTwoTensor>(_base_name + "F_czm")),
      34         120 :     _PK1traction(declarePropertyByName<RealVectorValue>(_base_name + "PK1traction")),
      35         300 :     _dPK1traction_dF(declarePropertyByName<RankThreeTensor>(_base_name + "dPK1traction_dF"))
      36             : {
      37          60 : }
      38             : 
      39             : void
      40           0 : CZMComputeGlobalTractionTotalLagrangian::initQpStatefulProperties()
      41             : {
      42           0 :   _PK1traction[_qp] = 0;
      43           0 : }
      44             : 
      45             : void
      46       32128 : CZMComputeGlobalTractionTotalLagrangian::computeEquilibriumTracionAndDerivatives()
      47             : {
      48       32128 :   _J = _F[_qp].det();
      49       32128 :   _F_inv = _F[_qp].inverse();
      50             : 
      51       32128 :   _area_ratio = CohesiveZoneModelTools::computeAreaRatio(_F_inv.transpose(), _J, _normals[_qp]);
      52             : 
      53       32128 :   _traction_global[_qp] = (_czm_total_rotation[_qp] * _interface_traction[_qp]);
      54       32128 :   _PK1traction[_qp] = _traction_global[_qp] * _area_ratio;
      55             : 
      56             :   // compute derivatives of _PK1traction wrt dF
      57       32128 :   computedTPK1dJumpGlobal();
      58       32128 :   computeAreaRatioAndDerivatives();
      59       32128 :   computedTPK1dF();
      60       32128 : }
      61             : 
      62             : void
      63       32128 : CZMComputeGlobalTractionTotalLagrangian::computedTPK1dJumpGlobal()
      64             : {
      65             :   // compute the PK1 traction derivatives w.r.t the displacment jump in global
      66             :   // coordinates
      67       32128 :   _dtraction_djump_global[_qp] = _area_ratio * _czm_total_rotation[_qp] *
      68       32128 :                                  _dinterface_traction_djump[_qp] *
      69       32128 :                                  _czm_total_rotation[_qp].transpose();
      70       32128 : }
      71             : 
      72             : void
      73       32128 : CZMComputeGlobalTractionTotalLagrangian::computeAreaRatioAndDerivatives()
      74             : {
      75       32128 :   _dR_dF = CohesiveZoneModelTools::computedRdF(_R[_qp], _R[_qp].transpose() * _F[_qp]);
      76             :   usingTensorIndices(i_, j_, k_, l_, m_);
      77       32128 :   _dczm_total_rotation_dF = _czm_reference_rotation[_qp].times<m_, j_, i_, m_, k_, l_>(_dR_dF);
      78             : 
      79       32128 :   const GenericRankFourTensor<false> dFinv_dF = CohesiveZoneModelTools::computedFinversedF(_F_inv);
      80             : 
      81       32128 :   _d_area_ratio_dF =
      82       32128 :       CohesiveZoneModelTools::computeDAreaRatioDF(_F_inv.transpose(), _normals[_qp], _J, dFinv_dF);
      83       32128 : }
      84             : 
      85             : void
      86       32128 : CZMComputeGlobalTractionTotalLagrangian::computedTPK1dF()
      87             : {
      88             :   // The derivative of the PK1 traction w.r.t. F
      89             :   usingTensorIndices(i_, j_, k_, l_);
      90             :   const RankThreeTensor djump_dF =
      91       32128 :       _dczm_total_rotation_dF.transposeIj().contraction<j_>(_displacement_jump_global[_qp]);
      92             : 
      93       32128 :   _dPK1traction_dF[_qp] =
      94       32128 :       _d_area_ratio_dF.mixedProductJkI(_czm_total_rotation[_qp] * _interface_traction[_qp]) +
      95       32128 :       _area_ratio *
      96       64256 :           (_dczm_total_rotation_dF.contraction<j_>(_interface_traction[_qp]) +
      97       96384 :            (_czm_total_rotation[_qp] * _dinterface_traction_djump[_qp]).contraction(djump_dF));
      98       32128 : }

Generated by: LCOV version 1.14