LCOV - code coverage report
Current view: top level - src/materials - ComputePlaneFiniteStrainNOSPD.C (source / functions) Hit Total Coverage
Test: idaholab/moose peridynamics: #31405 (292dce) with base fef103 Lines: 29 32 90.6 %
Date: 2025-09-04 07:55:08 Functions: 5 5 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 "ComputePlaneFiniteStrainNOSPD.h"
      11             : 
      12             : registerMooseObject("PeridynamicsApp", ComputePlaneFiniteStrainNOSPD);
      13             : 
      14             : InputParameters
      15          23 : ComputePlaneFiniteStrainNOSPD::validParams()
      16             : {
      17          23 :   InputParameters params = ComputeFiniteStrainNOSPD::validParams();
      18          23 :   params.addClassDescription(
      19             :       "Class for computing nodal quantities for residual and jacobian calculation "
      20             :       "for peridynamic correspondence models under planar finite strain "
      21             :       "assumptions");
      22             : 
      23          46 :   params.addCoupledVar("scalar_out_of_plane_strain",
      24             :                        "Scalar out-of-plane strain variable for generalized plane strain");
      25          46 :   params.addCoupledVar("out_of_plane_strain",
      26             :                        "Nonlinear out-of-plane strain variable for plane stress condition");
      27             : 
      28          23 :   return params;
      29           0 : }
      30             : 
      31          18 : ComputePlaneFiniteStrainNOSPD::ComputePlaneFiniteStrainNOSPD(const InputParameters & parameters)
      32             :   : ComputeFiniteStrainNOSPD(parameters),
      33          18 :     _scalar_out_of_plane_strain_coupled(isCoupledScalar("scalar_out_of_plane_strain")),
      34          36 :     _scalar_out_of_plane_strain(_scalar_out_of_plane_strain_coupled
      35          18 :                                     ? coupledScalarValue("scalar_out_of_plane_strain")
      36             :                                     : _zero),
      37          36 :     _scalar_out_of_plane_strain_old(_scalar_out_of_plane_strain_coupled
      38          18 :                                         ? coupledScalarValueOld("scalar_out_of_plane_strain")
      39             :                                         : _zero),
      40          18 :     _out_of_plane_strain_coupled(isCoupled("out_of_plane_strain")),
      41          18 :     _out_of_plane_strain(_out_of_plane_strain_coupled ? coupledValue("out_of_plane_strain")
      42             :                                                       : _zero),
      43          18 :     _out_of_plane_strain_old(_out_of_plane_strain_coupled ? coupledValueOld("out_of_plane_strain")
      44          18 :                                                           : _zero)
      45             : {
      46          18 : }
      47             : 
      48             : void
      49      155448 : ComputePlaneFiniteStrainNOSPD::computeQpFhat()
      50             : {
      51      155448 :   _deformation_gradient[_qp](2, 2) = computeQpOutOfPlaneDeformationGradient();
      52             : 
      53      155448 :   RankTwoTensor deformation_gradient_old = _deformation_gradient_old[_qp];
      54      155448 :   deformation_gradient_old(2, 2) = computeQpOutOfPlaneDeformationGradientOld();
      55             : 
      56             :   // Incremental deformation gradient of current step w.r.t previous step:
      57             :   // _Fhat = deformation_gradient * inv(deformation_gradient_old)
      58      155448 :   _Fhat[_qp] = _deformation_gradient[_qp] * deformation_gradient_old.inverse();
      59      155448 : }
      60             : 
      61             : Real
      62      155448 : ComputePlaneFiniteStrainNOSPD::computeQpOutOfPlaneDeformationGradient()
      63             : {
      64             :   // This is consistent with the approximation of stretch rate tensor
      65             :   // D = log(sqrt(Fhat^T * Fhat)) / dt
      66             : 
      67      155448 :   if (_scalar_out_of_plane_strain_coupled)
      68           0 :     return std::exp(_scalar_out_of_plane_strain[0]);
      69             :   else
      70      155448 :     return std::exp(_out_of_plane_strain[_qp]);
      71             : }
      72             : 
      73             : Real
      74      155448 : ComputePlaneFiniteStrainNOSPD::computeQpOutOfPlaneDeformationGradientOld()
      75             : {
      76      155448 :   if (_scalar_out_of_plane_strain_coupled)
      77           0 :     return std::exp(_scalar_out_of_plane_strain_old[0]);
      78             :   else
      79      155448 :     return std::exp(_out_of_plane_strain_old[_qp]);
      80             : }

Generated by: LCOV version 1.14