LCOV - code coverage report
Current view: top level - src/materials - ComputeSmallStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #32971 (54bef8) with base c6cf66 Lines: 27 28 96.4 %
Date: 2026-05-29 20:40:07 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        2549 : ComputeSmallStrain::validParams()
      18             : {
      19        2549 :   InputParameters params = ComputeStrainBase::validParams();
      20        2549 :   params.addClassDescription("Compute a small strain.");
      21        2549 :   return params;
      22           0 : }
      23             : 
      24        1908 : ComputeSmallStrain::ComputeSmallStrain(const InputParameters & parameters)
      25        1908 :   : ComputeStrainBase(parameters)
      26             : {
      27        1908 : }
      28             : 
      29             : void
      30     2213424 : ComputeSmallStrain::computeProperties()
      31             : {
      32             :   Real volumetric_strain = 0.0;
      33    17363614 :   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    15150190 :         (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]);
      38             : 
      39    15150190 :     _total_strain[_qp] = (grad_tensor + grad_tensor.transpose()) / 2.0;
      40             : 
      41    15150190 :     if (_volumetric_locking_correction)
      42      770976 :       volumetric_strain += _total_strain[_qp].trace() * _JxW[_qp] * _coord[_qp];
      43             :   }
      44             : 
      45     2213424 :   if (_volumetric_locking_correction)
      46      174159 :     volumetric_strain /= _current_elem_volume;
      47             : 
      48    17363614 :   for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
      49             :   {
      50    15150190 :     if (_volumetric_locking_correction)
      51             :     {
      52      770976 :       Real trace = _total_strain[_qp].trace();
      53      770976 :       _total_strain[_qp](0, 0) += (volumetric_strain - trace) / 3.0;
      54      770976 :       _total_strain[_qp](1, 1) += (volumetric_strain - trace) / 3.0;
      55      770976 :       _total_strain[_qp](2, 2) += (volumetric_strain - trace) / 3.0;
      56             :     }
      57             : 
      58    15150190 :     if (_global_strain)
      59       63912 :       _total_strain[_qp] += (*_global_strain)[_qp];
      60             : 
      61    15150190 :     _mechanical_strain[_qp] = _total_strain[_qp];
      62             : 
      63             :     // Remove the Eigen strain
      64    16401038 :     for (auto es : _eigenstrains)
      65     1250848 :       _mechanical_strain[_qp] -= (*es)[_qp];
      66             :   }
      67     2213424 : }

Generated by: LCOV version 1.14