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

Generated by: LCOV version 1.14