LCOV - code coverage report
Current view: top level - src/userobjects - SolidMechanicsPlasticSimpleTester.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 49 52 94.2 %
Date: 2025-07-25 05:00:39 Functions: 8 9 88.9 %
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 "SolidMechanicsPlasticSimpleTester.h"
      11             : #include "RankFourTensor.h"
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", SolidMechanicsPlasticSimpleTester);
      14             : registerMooseObjectRenamed("SolidMechanicsApp",
      15             :                            TensorMechanicsPlasticSimpleTester,
      16             :                            "01/01/2025 00:00",
      17             :                            SolidMechanicsPlasticSimpleTester);
      18             : 
      19             : InputParameters
      20        1488 : SolidMechanicsPlasticSimpleTester::validParams()
      21             : {
      22        1488 :   InputParameters params = SolidMechanicsPlasticModel::validParams();
      23        2976 :   params.addRequiredParam<Real>("a",
      24             :                                 "Yield function = a*stress_yy + b*stress_zz + c*stress_xx + "
      25             :                                 "d*(stress_xy + stress_yx)/2 + e*(stress_xz + stress_zx)/2 + "
      26             :                                 "f*(stress_yz + stress_zy)/2 - strength");
      27        2976 :   params.addRequiredParam<Real>("b",
      28             :                                 "Yield function = a*stress_yy + b*stress_zz + c*stress_xx + "
      29             :                                 "d*(stress_xy + stress_yx)/2 + e*(stress_xz + stress_zx)/2 + "
      30             :                                 "f*(stress_yz + stress_zy)/2 - strength");
      31        2976 :   params.addParam<Real>("c",
      32        2976 :                         0,
      33             :                         "Yield function = a*stress_yy + b*stress_zz + c*stress_xx + "
      34             :                         "d*(stress_xy + stress_yx)/2 + e*(stress_xz + stress_zx)/2 + "
      35             :                         "f*(stress_yz + stress_zy)/2 - strength");
      36        2976 :   params.addParam<Real>("d",
      37        2976 :                         0,
      38             :                         "Yield function = a*stress_yy + b*stress_zz + c*stress_xx + "
      39             :                         "d*(stress_xy + stress_yx)/2 + e*(stress_xz + stress_zx)/2 + "
      40             :                         "f*(stress_yz + stress_zy)/2 - strength");
      41        2976 :   params.addParam<Real>("e",
      42        2976 :                         0,
      43             :                         "Yield function = a*stress_yy + b*stress_zz + c*stress_xx + "
      44             :                         "d*(stress_xy + stress_yx)/2 + e*(stress_xz + stress_zx)/2 + "
      45             :                         "f*(stress_yz + stress_zy)/2 - strength");
      46        2976 :   params.addParam<Real>("f",
      47        2976 :                         0,
      48             :                         "Yield function = a*stress_yy + b*stress_zz + c*stress_xx + "
      49             :                         "d*(stress_xy + stress_yx)/2 + e*(stress_xz + stress_zx)/2 + "
      50             :                         "f*(stress_yz + stress_zy)/2 - strength");
      51        2976 :   params.addRequiredParam<Real>("strength",
      52             :                                 "Yield function = a*stress_yy + b*stress_zz + "
      53             :                                 "c*stress_xx + d*(stress_xy + stress_yx)/2 + "
      54             :                                 "e*(stress_xz + stress_zx)/2 + f*(stress_yz + "
      55             :                                 "stress_zy)/2 - strength");
      56        1488 :   params.addClassDescription("Class that can be used for testing multi-surface plasticity models.  "
      57             :                              "Yield function = a*stress_yy + b*stress_zz + c*stress_xx + "
      58             :                              "d*(stress_xy + stress_yx)/2 + e*(stress_xz + stress_zx)/2 + "
      59             :                              "f*(stress_yz + stress_zy)/2 - strength");
      60             : 
      61        1488 :   return params;
      62           0 : }
      63             : 
      64         744 : SolidMechanicsPlasticSimpleTester::SolidMechanicsPlasticSimpleTester(
      65         744 :     const InputParameters & parameters)
      66             :   : SolidMechanicsPlasticModel(parameters),
      67         744 :     _a(getParam<Real>("a")),
      68        1488 :     _b(getParam<Real>("b")),
      69        1488 :     _c(getParam<Real>("c")),
      70        1488 :     _d(getParam<Real>("d")),
      71        1488 :     _e(getParam<Real>("e")),
      72        1488 :     _f(getParam<Real>("f")),
      73        2232 :     _strength(getParam<Real>("strength"))
      74             : {
      75         744 : }
      76             : 
      77             : Real
      78      430892 : SolidMechanicsPlasticSimpleTester::yieldFunction(const RankTwoTensor & stress, Real /*intnl*/) const
      79             : {
      80      430892 :   return _a * stress(1, 1) + _b * stress(2, 2) + _c * stress(0, 0) +
      81      430892 :          _d * (stress(0, 1) + stress(1, 0)) / 2.0 + _e * (stress(0, 2) + stress(2, 0)) / 2.0 +
      82      430892 :          _f * (stress(1, 2) + stress(2, 1)) / 2.0 - _strength;
      83             : }
      84             : 
      85             : RankTwoTensor
      86      551688 : SolidMechanicsPlasticSimpleTester::dyieldFunction_dstress(const RankTwoTensor & /*stress*/,
      87             :                                                           Real /*intnl*/) const
      88             : {
      89      551688 :   RankTwoTensor df_dsig;
      90      551688 :   df_dsig(1, 1) = _a;
      91      551688 :   df_dsig(2, 2) = _b;
      92      551688 :   df_dsig(0, 0) = _c;
      93      551688 :   df_dsig(0, 1) = _d / 2.0;
      94      551688 :   df_dsig(1, 0) = _d / 2.0;
      95      551688 :   df_dsig(0, 2) = _e / 2.0;
      96      551688 :   df_dsig(2, 0) = _e / 2.0;
      97      551688 :   df_dsig(1, 2) = _f / 2.0;
      98      551688 :   df_dsig(2, 1) = _f / 2.0;
      99      551688 :   return df_dsig;
     100             : }
     101             : 
     102             : Real
     103       69984 : SolidMechanicsPlasticSimpleTester::dyieldFunction_dintnl(const RankTwoTensor & /*stress*/,
     104             :                                                          Real /*intnl*/) const
     105             : {
     106       69984 :   return 0.0;
     107             : }
     108             : 
     109             : RankTwoTensor
     110      383380 : SolidMechanicsPlasticSimpleTester::flowPotential(const RankTwoTensor & stress, Real intnl) const
     111             : {
     112      383380 :   return dyieldFunction_dstress(stress, intnl);
     113             : }
     114             : 
     115             : RankFourTensor
     116      131252 : SolidMechanicsPlasticSimpleTester::dflowPotential_dstress(const RankTwoTensor & /*stress*/,
     117             :                                                           Real /*intnl*/) const
     118             : {
     119      131252 :   return RankFourTensor();
     120             : }
     121             : 
     122             : RankTwoTensor
     123      131252 : SolidMechanicsPlasticSimpleTester::dflowPotential_dintnl(const RankTwoTensor & /*stress*/,
     124             :                                                          Real /*intnl*/) const
     125             : {
     126      131252 :   return RankTwoTensor();
     127             : }
     128             : 
     129             : std::string
     130           0 : SolidMechanicsPlasticSimpleTester::modelName() const
     131             : {
     132           0 :   return "SimpleTester";
     133             : }

Generated by: LCOV version 1.14