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

Generated by: LCOV version 1.14