LCOV - code coverage report
Current view: top level - src/materials - ComputePlaneSmallStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 24 26 92.3 %
Date: 2025-07-25 05:00:39 Functions: 3 3 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 "ComputePlaneSmallStrain.h"
      11             : #include "UserObject.h"
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", ComputePlaneSmallStrain);
      14             : 
      15             : InputParameters
      16         776 : ComputePlaneSmallStrain::validParams()
      17             : {
      18         776 :   InputParameters params = Compute2DSmallStrain::validParams();
      19         776 :   params.addClassDescription("Compute a small strain under generalized plane strain assumptions "
      20             :                              "where the out of plane strain is generally nonzero.");
      21        1552 :   params.addParam<UserObjectName>("subblock_index_provider",
      22             :                                   "SubblockIndexProvider user object name");
      23        1552 :   params.addCoupledVar("scalar_out_of_plane_strain",
      24             :                        "Scalar variable for generalized plane strain");
      25        1552 :   params.addCoupledVar("out_of_plane_strain", "Nonlinear variable for plane stress condition");
      26             : 
      27         776 :   return params;
      28           0 : }
      29             : 
      30         582 : ComputePlaneSmallStrain::ComputePlaneSmallStrain(const InputParameters & parameters)
      31             :   : Compute2DSmallStrain(parameters),
      32        1746 :     _subblock_id_provider(isParamValid("subblock_index_provider")
      33         600 :                               ? &getUserObject<SubblockIndexProvider>("subblock_index_provider")
      34             :                               : nullptr),
      35         582 :     _scalar_out_of_plane_strain_coupled(isCoupledScalar("scalar_out_of_plane_strain")),
      36         582 :     _out_of_plane_strain_coupled(isCoupled("out_of_plane_strain")),
      37        1200 :     _out_of_plane_strain(_out_of_plane_strain_coupled ? coupledValue("out_of_plane_strain") : _zero)
      38             : {
      39         582 :   if (_out_of_plane_strain_coupled && _scalar_out_of_plane_strain_coupled)
      40           0 :     paramError("_out_of_plane_strain_coupled",
      41             :                "Must define only one of out_of_plane_strain or scalar_out_of_plane_strain");
      42             : 
      43         582 :   if (_scalar_out_of_plane_strain_coupled)
      44             :   {
      45         270 :     const auto nscalar_strains = coupledScalarComponents("scalar_out_of_plane_strain");
      46         270 :     _scalar_out_of_plane_strain.resize(nscalar_strains);
      47         558 :     for (unsigned int i = 0; i < nscalar_strains; ++i)
      48         288 :       _scalar_out_of_plane_strain[i] = &coupledScalarValue("scalar_out_of_plane_strain", i);
      49             :   }
      50         582 : }
      51             : 
      52             : Real
      53      630448 : ComputePlaneSmallStrain::computeOutOfPlaneStrain()
      54             : {
      55      630448 :   if (_scalar_out_of_plane_strain_coupled)
      56      197088 :     return (*_scalar_out_of_plane_strain[getCurrentSubblockIndex()])[0];
      57             :   else
      58      433360 :     return _out_of_plane_strain[_qp];
      59             : }

Generated by: LCOV version 1.14