LCOV - code coverage report
Current view: top level - src/materials - ComputeIncrementalStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 38 39 97.4 %
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 "ComputeIncrementalStrain.h"
      11             : #include "Assembly.h"
      12             : #include "libmesh/quadrature.h"
      13             : 
      14             : registerMooseObject("SolidMechanicsApp", ComputeIncrementalStrain);
      15             : registerMooseObjectRenamed("SolidMechanicsApp",
      16             :                            ComputeIncrementalSmallStrain,
      17             :                            "04/01/2025 00:00",
      18             :                            ComputeIncrementalStrain);
      19             : 
      20             : InputParameters
      21        6144 : ComputeIncrementalStrain::validParams()
      22             : {
      23        6144 :   InputParameters params = ComputeIncrementalStrainBase::validParams();
      24        6144 :   params.addClassDescription(
      25             :       "Compute a strain increment and rotation increment for small strains.");
      26        6144 :   return params;
      27           0 : }
      28             : 
      29        4608 : ComputeIncrementalStrain::ComputeIncrementalStrain(const InputParameters & parameters)
      30        4608 :   : ComputeIncrementalStrainBase(parameters)
      31             : {
      32        4608 : }
      33             : 
      34             : void
      35     1194418 : ComputeIncrementalStrain::computeProperties()
      36             : {
      37             :   Real volumetric_strain = 0.0;
      38     8112962 :   for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
      39             :   {
      40     6918544 :     RankTwoTensor total_strain_increment;
      41     6918544 :     computeTotalStrainIncrement(total_strain_increment);
      42             : 
      43     6918544 :     _strain_increment[_qp] = total_strain_increment;
      44             : 
      45     6918544 :     if (_volumetric_locking_correction)
      46      406432 :       volumetric_strain += total_strain_increment.trace() * _JxW[_qp] * _coord[_qp];
      47             :   }
      48     1194418 :   if (_volumetric_locking_correction)
      49      101372 :     volumetric_strain /= _current_elem_volume;
      50             : 
      51     8112962 :   for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
      52             :   {
      53     6918544 :     Real trace = _strain_increment[_qp].trace();
      54     6918544 :     if (_volumetric_locking_correction)
      55             :     {
      56      406432 :       _strain_increment[_qp](0, 0) += (volumetric_strain - trace) / 3.0;
      57      406432 :       _strain_increment[_qp](1, 1) += (volumetric_strain - trace) / 3.0;
      58      406432 :       _strain_increment[_qp](2, 2) += (volumetric_strain - trace) / 3.0;
      59             :     }
      60             : 
      61     6918544 :     _total_strain[_qp] = _total_strain_old[_qp] + _strain_increment[_qp];
      62             : 
      63             :     // Remove the Eigen strain increment
      64     6918544 :     subtractEigenstrainIncrementFromStrain(_strain_increment[_qp]);
      65             : 
      66             :     // strain rate
      67     6918544 :     if (_dt > 0)
      68     6899304 :       _strain_rate[_qp] = _strain_increment[_qp] / _dt;
      69             :     else
      70       19240 :       _strain_rate[_qp].zero();
      71             : 
      72             :     // Update strain in intermediate configuration: rotations are not needed
      73     6918544 :     _mechanical_strain[_qp] = _mechanical_strain_old[_qp] + _strain_increment[_qp];
      74             : 
      75             :     // incremental small strain does not include rotation
      76     6918544 :     _rotation_increment[_qp].setToIdentity();
      77             :   }
      78     1194418 : }
      79             : 
      80             : void
      81     6668788 : ComputeIncrementalStrain::computeTotalStrainIncrement(RankTwoTensor & total_strain_increment)
      82             : {
      83             :   // Deformation gradient
      84             :   auto A = RankTwoTensor::initializeFromRows(
      85     6668788 :       (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]);
      86             : 
      87             :   // Old Deformation gradient
      88             :   auto Fbar = RankTwoTensor ::initializeFromRows(
      89     6668788 :       (*_grad_disp_old[0])[_qp], (*_grad_disp_old[1])[_qp], (*_grad_disp_old[2])[_qp]);
      90             : 
      91     6668788 :   _deformation_gradient[_qp] = A;
      92     6668788 :   _deformation_gradient[_qp].addIa(1.0);
      93             : 
      94     6668788 :   A -= Fbar; // A = grad_disp - grad_disp_old
      95             : 
      96     6668788 :   total_strain_increment = 0.5 * (A + A.transpose());
      97     6668788 : }

Generated by: LCOV version 1.14