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

Generated by: LCOV version 1.14