LCOV - code coverage report
Current view: top level - src/materials - ComputePlaneIncrementalStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #31405 (292dce) with base fef103 Lines: 32 34 94.1 %
Date: 2025-09-04 07:57:23 Functions: 4 4 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 "ComputePlaneIncrementalStrain.h"
      11             : #include "UserObject.h"
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", ComputePlaneIncrementalStrain);
      14             : 
      15             : InputParameters
      16         384 : ComputePlaneIncrementalStrain::validParams()
      17             : {
      18         384 :   InputParameters params = Compute2DIncrementalStrain::validParams();
      19         384 :   params.addClassDescription(
      20             :       "Compute strain increment for small strain under 2D planar assumptions.");
      21         768 :   params.addParam<UserObjectName>("subblock_index_provider",
      22             :                                   "SubblockIndexProvider user object name");
      23         768 :   params.addCoupledVar("scalar_out_of_plane_strain",
      24             :                        "Scalar variable for generalized plane strain");
      25         768 :   params.addCoupledVar("out_of_plane_strain", "Nonlinear variable for plane stress condition");
      26             : 
      27         384 :   return params;
      28           0 : }
      29             : 
      30         288 : ComputePlaneIncrementalStrain::ComputePlaneIncrementalStrain(const InputParameters & parameters)
      31             :   : Compute2DIncrementalStrain(parameters),
      32         864 :     _subblock_id_provider(isParamValid("subblock_index_provider")
      33         288 :                               ? &getUserObject<SubblockIndexProvider>("subblock_index_provider")
      34             :                               : nullptr),
      35         288 :     _scalar_out_of_plane_strain_coupled(isCoupledScalar("scalar_out_of_plane_strain")),
      36         288 :     _out_of_plane_strain_coupled(isCoupled("out_of_plane_strain")),
      37         288 :     _out_of_plane_strain(_out_of_plane_strain_coupled ? coupledValue("out_of_plane_strain")
      38             :                                                       : _zero),
      39         288 :     _out_of_plane_strain_old(_out_of_plane_strain_coupled ? coupledValueOld("out_of_plane_strain")
      40         288 :                                                           : _zero)
      41             : {
      42         288 :   if (_out_of_plane_strain_coupled && _scalar_out_of_plane_strain_coupled)
      43           0 :     mooseError("Must define only one of out_of_plane_strain or scalar_out_of_plane_strain");
      44             : 
      45         288 :   if (_scalar_out_of_plane_strain_coupled)
      46             :   {
      47         105 :     const auto nscalar_strains = coupledScalarComponents("scalar_out_of_plane_strain");
      48         105 :     _scalar_out_of_plane_strain.resize(nscalar_strains);
      49         105 :     _scalar_out_of_plane_strain_old.resize(nscalar_strains);
      50         210 :     for (unsigned int i = 0; i < nscalar_strains; ++i)
      51             :     {
      52         105 :       _scalar_out_of_plane_strain[i] = &coupledScalarValue("scalar_out_of_plane_strain", i);
      53         105 :       _scalar_out_of_plane_strain_old[i] = &coupledScalarValueOld("scalar_out_of_plane_strain", i);
      54             :     }
      55             :   }
      56         288 : }
      57             : 
      58             : Real
      59       90888 : ComputePlaneIncrementalStrain::computeOutOfPlaneGradDisp()
      60             : {
      61       90888 :   if (_scalar_out_of_plane_strain_coupled)
      62       47928 :     return (*_scalar_out_of_plane_strain[getCurrentSubblockIndex()])[0];
      63             :   else
      64       42960 :     return _out_of_plane_strain[_qp];
      65             : }
      66             : 
      67             : Real
      68       90888 : ComputePlaneIncrementalStrain::computeOutOfPlaneGradDispOld()
      69             : {
      70       90888 :   if (_scalar_out_of_plane_strain_coupled)
      71       47928 :     return (*_scalar_out_of_plane_strain_old[getCurrentSubblockIndex()])[0];
      72             :   else
      73       42960 :     return _out_of_plane_strain_old[_qp];
      74             : }

Generated by: LCOV version 1.14