LCOV - code coverage report
Current view: top level - src/materials - ComputeSmallStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 27 28 96.4 %
Date: 2025-07-25 05:00:39 Functions: 3 3 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 "ComputeSmallStrain.h"
      11             : #include "Assembly.h"
      12             : #include "libmesh/quadrature.h"
      13             : 
      14             : registerMooseObject("SolidMechanicsApp", ComputeSmallStrain);
      15             : 
      16             : InputParameters
      17        3882 : ComputeSmallStrain::validParams()
      18             : {
      19        3882 :   InputParameters params = ComputeStrainBase::validParams();
      20        3882 :   params.addClassDescription("Compute a small strain.");
      21        3882 :   return params;
      22           0 : }
      23             : 
      24        2904 : ComputeSmallStrain::ComputeSmallStrain(const InputParameters & parameters)
      25        2904 :   : ComputeStrainBase(parameters)
      26             : {
      27        2904 : }
      28             : 
      29             : void
      30     3343452 : ComputeSmallStrain::computeProperties()
      31             : {
      32             :   Real volumetric_strain = 0.0;
      33    26685672 :   for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
      34             :   {
      35             :     // strain = (grad_disp + grad_disp^T)/2
      36             :     const auto grad_tensor = RankTwoTensor ::initializeFromRows(
      37    23342220 :         (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]);
      38             : 
      39    23342220 :     _total_strain[_qp] = (grad_tensor + grad_tensor.transpose()) / 2.0;
      40             : 
      41    23342220 :     if (_volumetric_locking_correction)
      42     1039488 :       volumetric_strain += _total_strain[_qp].trace() * _JxW[_qp] * _coord[_qp];
      43             :   }
      44             : 
      45     3343452 :   if (_volumetric_locking_correction)
      46      233652 :     volumetric_strain /= _current_elem_volume;
      47             : 
      48    26685672 :   for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
      49             :   {
      50    23342220 :     if (_volumetric_locking_correction)
      51             :     {
      52     1039488 :       Real trace = _total_strain[_qp].trace();
      53     1039488 :       _total_strain[_qp](0, 0) += (volumetric_strain - trace) / 3.0;
      54     1039488 :       _total_strain[_qp](1, 1) += (volumetric_strain - trace) / 3.0;
      55     1039488 :       _total_strain[_qp](2, 2) += (volumetric_strain - trace) / 3.0;
      56             :     }
      57             : 
      58    23342220 :     if (_global_strain)
      59       71744 :       _total_strain[_qp] += (*_global_strain)[_qp];
      60             : 
      61    23342220 :     _mechanical_strain[_qp] = _total_strain[_qp];
      62             : 
      63             :     // Remove the Eigen strain
      64    25009196 :     for (auto es : _eigenstrains)
      65     1666976 :       _mechanical_strain[_qp] -= (*es)[_qp];
      66             :   }
      67     3343452 : }

Generated by: LCOV version 1.14