LCOV - code coverage report
Current view: top level - src/materials - ADComputeAxisymmetric1DIncrementalStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #33416 (b10b36) with base 9fbd27 Lines: 43 49 87.8 %
Date: 2026-07-23 16:20:48 Functions: 8 8 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 "ADComputeAxisymmetric1DIncrementalStrain.h"
      11             : #include "UserObject.h"
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", ADComputeAxisymmetric1DIncrementalStrain);
      14             : 
      15             : InputParameters
      16          28 : ADComputeAxisymmetric1DIncrementalStrain::validParams()
      17             : {
      18          28 :   InputParameters params = ADCompute1DIncrementalStrain::validParams();
      19          28 :   params.addClassDescription(
      20             :       "Compute strain increment for small strains in an axisymmetric 1D problem");
      21          56 :   params.addParam<UserObjectName>("subblock_index_provider",
      22             :                                   "SubblockIndexProvider user object name");
      23          56 :   params.addCoupledVar("scalar_out_of_plane_strain", "Scalar variable for axisymmetric 1D problem");
      24          56 :   params.addCoupledVar("out_of_plane_strain", "Nonlinear variable for axisymmetric 1D problem");
      25             : 
      26          28 :   return params;
      27           0 : }
      28             : 
      29          21 : ADComputeAxisymmetric1DIncrementalStrain::ADComputeAxisymmetric1DIncrementalStrain(
      30          21 :     const InputParameters & parameters)
      31             :   : ADCompute1DIncrementalStrain(parameters),
      32          21 :     _disp_old_0(coupledValueOld("displacements", 0)),
      33          21 :     _subblock_id_provider(isParamValid("subblock_index_provider")
      34          21 :                               ? &getUserObject<SubblockIndexProvider>("subblock_index_provider")
      35             :                               : nullptr),
      36          21 :     _has_out_of_plane_strain(isCoupled("out_of_plane_strain")),
      37          21 :     _out_of_plane_strain(_has_out_of_plane_strain ? adCoupledValue("out_of_plane_strain")
      38             :                                                   : _ad_zero),
      39          21 :     _out_of_plane_strain_old(_has_out_of_plane_strain ? coupledValueOld("out_of_plane_strain")
      40             :                                                       : _zero),
      41          42 :     _has_scalar_out_of_plane_strain(isCoupledScalar("scalar_out_of_plane_strain"))
      42             : {
      43          21 :   if (_has_out_of_plane_strain && _has_scalar_out_of_plane_strain)
      44           0 :     mooseError("Must define only one of out_of_plane_strain or scalar_out_of_plane_strain");
      45             : 
      46          21 :   if (_has_scalar_out_of_plane_strain)
      47             :   {
      48          21 :     const auto nscalar_strains = coupledScalarComponents("scalar_out_of_plane_strain");
      49          21 :     _scalar_out_of_plane_strain.resize(nscalar_strains);
      50          21 :     _scalar_out_of_plane_strain_old.resize(nscalar_strains);
      51          42 :     for (unsigned int i = 0; i < nscalar_strains; ++i)
      52             :     {
      53          21 :       _scalar_out_of_plane_strain[i] = &adCoupledScalarValue("scalar_out_of_plane_strain", i);
      54          21 :       _scalar_out_of_plane_strain_old[i] = &coupledScalarValueOld("scalar_out_of_plane_strain", i);
      55             :     }
      56             :   }
      57          21 : }
      58             : 
      59             : void
      60          21 : ADComputeAxisymmetric1DIncrementalStrain::initialSetup()
      61             : {
      62          21 :   ADComputeIncrementalStrainBase::initialSetup();
      63             : 
      64          21 :   if (getBlockCoordSystem() != Moose::COORD_RZ)
      65           0 :     mooseError("The coordinate system must be set to RZ for Axisymmetric 1D simulations");
      66          21 : }
      67             : 
      68             : unsigned int
      69        6600 : ADComputeAxisymmetric1DIncrementalStrain::getCurrentSubblockIndex() const
      70             : {
      71        6600 :   return _subblock_id_provider ? _subblock_id_provider->getSubblockIndex(*_current_elem) : 0;
      72             : }
      73             : 
      74             : ADReal
      75        3300 : ADComputeAxisymmetric1DIncrementalStrain::computeGradDispYY()
      76             : {
      77        3300 :   if (_has_scalar_out_of_plane_strain)
      78        3300 :     return (*_scalar_out_of_plane_strain[getCurrentSubblockIndex()])[0];
      79             :   else
      80           0 :     return _out_of_plane_strain[_qp];
      81             : }
      82             : 
      83             : Real
      84        3300 : ADComputeAxisymmetric1DIncrementalStrain::computeGradDispYYOld()
      85             : {
      86        3300 :   if (_has_scalar_out_of_plane_strain)
      87        3300 :     return (*_scalar_out_of_plane_strain_old[getCurrentSubblockIndex()])[0];
      88             :   else
      89           0 :     return _out_of_plane_strain_old[_qp];
      90             : }
      91             : 
      92             : ADReal
      93        3300 : ADComputeAxisymmetric1DIncrementalStrain::computeGradDispZZ()
      94             : {
      95        3300 :   if (!MooseUtils::absoluteFuzzyEqual(_q_point[_qp](0), 0.0))
      96        3300 :     return (*_disp[0])[_qp] / _q_point[_qp](0);
      97             :   else
      98           0 :     return 0.0;
      99             : }
     100             : 
     101             : Real
     102        3300 : ADComputeAxisymmetric1DIncrementalStrain::computeGradDispZZOld()
     103             : {
     104        3300 :   if (!MooseUtils::absoluteFuzzyEqual(_q_point[_qp](0), 0.0))
     105        3300 :     return _disp_old_0[_qp] / _q_point[_qp](0);
     106             :   else
     107             :     return 0.0;
     108             : }

Generated by: LCOV version 1.14