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

Generated by: LCOV version 1.14