LCOV - code coverage report
Current view: top level - src/materials - ADComputeSmallStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #31405 (292dce) with base fef103 Lines: 25 27 92.6 %
Date: 2025-09-04 07:57:23 Functions: 6 6 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 "ADComputeSmallStrain.h"
      11             : #include "RankTwoTensor.h"
      12             : #include "SymmetricRankTwoTensor.h"
      13             : #include "libmesh/quadrature.h"
      14             : 
      15             : registerMooseObject("SolidMechanicsApp", ADComputeSmallStrain);
      16             : registerMooseObject("SolidMechanicsApp", ADSymmetricSmallStrain);
      17             : 
      18             : template <typename R2>
      19             : InputParameters
      20        1660 : ADComputeSmallStrainTempl<R2>::validParams()
      21             : {
      22        1660 :   InputParameters params = ADComputeStrainBase::validParams();
      23        1660 :   params.addClassDescription("Compute a small strain.");
      24        1660 :   return params;
      25           0 : }
      26             : 
      27             : template <typename R2>
      28        1245 : ADComputeSmallStrainTempl<R2>::ADComputeSmallStrainTempl(const InputParameters & parameters)
      29        1245 :   : ADComputeStrainBaseTempl<R2>(parameters)
      30             : {
      31        1245 : }
      32             : 
      33             : template <typename R2>
      34             : void
      35     1393137 : ADComputeSmallStrainTempl<R2>::computeProperties()
      36             : {
      37     1393137 :   ADReal volumetric_strain = 0.0;
      38             : 
      39     9440681 :   for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
      40             :   {
      41             :     // strain = (grad_disp + grad_disp^R2)/2
      42     8047544 :     _total_strain[_qp] = Moose::ADType<R2>::type::initializeSymmetric(
      43     8047544 :         (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]);
      44             : 
      45     8047544 :     if (_volumetric_locking_correction)
      46        4848 :       volumetric_strain += _total_strain[_qp].trace() * _JxW[_qp] * _coord[_qp];
      47             :   }
      48             : 
      49     1393137 :   if (_volumetric_locking_correction)
      50         303 :     volumetric_strain /= _current_elem_volume;
      51             : 
      52     9440681 :   for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
      53             :   {
      54     8047544 :     if (_volumetric_locking_correction)
      55             :     {
      56        2424 :       ADReal correction = (volumetric_strain - _total_strain[_qp].trace()) / 3.0;
      57        2424 :       _total_strain[_qp].addIa(correction);
      58             :     }
      59             : 
      60     8047544 :     if (_global_strain)
      61           0 :       _total_strain[_qp] += (*_global_strain)[_qp];
      62             : 
      63     8047544 :     _mechanical_strain[_qp] = _total_strain[_qp];
      64             : 
      65             :     // Remove the Eigen strain
      66    12256340 :     for (auto es : _eigenstrains)
      67     4208796 :       _mechanical_strain[_qp] -= (*es)[_qp];
      68             :   }
      69     1393137 : }
      70             : 
      71             : template class ADComputeSmallStrainTempl<RankTwoTensor>;
      72             : template class ADComputeSmallStrainTempl<SymmetricRankTwoTensor>;

Generated by: LCOV version 1.14