LCOV - code coverage report
Current view: top level - src/materials - ADComputeAxisymmetric1DSmallStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #33416 (b10b36) with base 9fbd27 Lines: 33 38 86.8 %
Date: 2026-07-23 16:20:48 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 "ADComputeAxisymmetric1DSmallStrain.h"
      11             : #include "UserObject.h"
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", ADComputeAxisymmetric1DSmallStrain);
      14             : 
      15             : InputParameters
      16          28 : ADComputeAxisymmetric1DSmallStrain::validParams()
      17             : {
      18          28 :   InputParameters params = ADCompute1DSmallStrain::validParams();
      19          28 :   params.addClassDescription("Compute a small strain in an Axisymmetric 1D problem");
      20          56 :   params.addParam<UserObjectName>("subblock_index_provider",
      21             :                                   "SubblockIndexProvider user object name");
      22          56 :   params.addCoupledVar("scalar_out_of_plane_strain", "Scalar variable for axisymmetric 1D problem");
      23          56 :   params.addCoupledVar("out_of_plane_strain", "Nonlinear variable for axisymmetric 1D problem");
      24             : 
      25          28 :   return params;
      26           0 : }
      27             : 
      28          21 : ADComputeAxisymmetric1DSmallStrain::ADComputeAxisymmetric1DSmallStrain(
      29          21 :     const InputParameters & parameters)
      30             :   : ADCompute1DSmallStrain(parameters),
      31          63 :     _subblock_id_provider(isParamValid("subblock_index_provider")
      32          21 :                               ? &getUserObject<SubblockIndexProvider>("subblock_index_provider")
      33             :                               : nullptr),
      34          21 :     _has_out_of_plane_strain(isCoupled("out_of_plane_strain")),
      35          21 :     _out_of_plane_strain(_has_out_of_plane_strain ? adCoupledValue("out_of_plane_strain")
      36             :                                                   : _ad_zero),
      37          42 :     _has_scalar_out_of_plane_strain(isCoupledScalar("scalar_out_of_plane_strain"))
      38             : {
      39          21 :   if (_has_out_of_plane_strain && _has_scalar_out_of_plane_strain)
      40           0 :     mooseError("Must define only one of out_of_plane_strain or scalar_out_of_plane_strain");
      41             : 
      42          21 :   if (_has_scalar_out_of_plane_strain)
      43             :   {
      44          21 :     const auto nscalar_strains = coupledScalarComponents("scalar_out_of_plane_strain");
      45          21 :     _scalar_out_of_plane_strain.resize(nscalar_strains);
      46          42 :     for (unsigned int i = 0; i < nscalar_strains; ++i)
      47          21 :       _scalar_out_of_plane_strain[i] = &adCoupledScalarValue("scalar_out_of_plane_strain", i);
      48             :   }
      49          21 : }
      50             : 
      51             : void
      52          21 : ADComputeAxisymmetric1DSmallStrain::initialSetup()
      53             : {
      54          21 :   ADComputeStrainBase::initialSetup();
      55             : 
      56          21 :   if (getBlockCoordSystem() != Moose::COORD_RZ)
      57           0 :     mooseError("The coordinate system must be set to RZ for Axisymmetric geometries.");
      58          21 : }
      59             : 
      60             : unsigned int
      61        3360 : ADComputeAxisymmetric1DSmallStrain::getCurrentSubblockIndex() const
      62             : {
      63        3360 :   return _subblock_id_provider ? _subblock_id_provider->getSubblockIndex(*_current_elem) : 0;
      64             : }
      65             : 
      66             : ADReal
      67        3360 : ADComputeAxisymmetric1DSmallStrain::computeStrainYY()
      68             : {
      69        3360 :   if (_has_scalar_out_of_plane_strain)
      70        3360 :     return (*_scalar_out_of_plane_strain[getCurrentSubblockIndex()])[0];
      71             :   else
      72           0 :     return _out_of_plane_strain[_qp];
      73             : }
      74             : 
      75             : ADReal
      76        3360 : ADComputeAxisymmetric1DSmallStrain::computeStrainZZ()
      77             : {
      78        3360 :   if (!MooseUtils::absoluteFuzzyEqual(_q_point[_qp](0), 0.0))
      79        3360 :     return (*_disp[0])[_qp] / _q_point[_qp](0);
      80             :   else
      81           0 :     return 0.0;
      82             : }

Generated by: LCOV version 1.14