LCOV - code coverage report
Current view: top level - src/userobjects - SolidMechanicsPlasticWeakPlaneTensile.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 49 50 98.0 %
Date: 2025-07-25 05:00:39 Functions: 12 12 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 "SolidMechanicsPlasticWeakPlaneTensile.h"
      11             : #include "RankFourTensor.h"
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", SolidMechanicsPlasticWeakPlaneTensile);
      14             : registerMooseObjectRenamed("SolidMechanicsApp",
      15             :                            TensorMechanicsPlasticWeakPlaneTensile,
      16             :                            "01/01/2025 00:00",
      17             :                            SolidMechanicsPlasticWeakPlaneTensile);
      18             : 
      19             : InputParameters
      20         162 : SolidMechanicsPlasticWeakPlaneTensile::validParams()
      21             : {
      22         162 :   InputParameters params = SolidMechanicsPlasticModel::validParams();
      23         324 :   params.addParam<Real>("stress_coefficient",
      24         324 :                         1.0,
      25             :                         "The yield function is stress_coefficient * stress_zz - tensile_strength");
      26         324 :   params.addRequiredParam<UserObjectName>("tensile_strength",
      27             :                                           "A SolidMechanicsHardening "
      28             :                                           "UserObject that defines hardening "
      29             :                                           "of the weak-plane tensile strength");
      30         162 :   params.addClassDescription("Associative weak-plane tensile plasticity with hardening/softening");
      31             : 
      32         162 :   return params;
      33           0 : }
      34             : 
      35          82 : SolidMechanicsPlasticWeakPlaneTensile::SolidMechanicsPlasticWeakPlaneTensile(
      36          82 :     const InputParameters & parameters)
      37             :   : SolidMechanicsPlasticModel(parameters),
      38          82 :     _a(getParam<Real>("stress_coefficient")),
      39         164 :     _strength(getUserObject<SolidMechanicsHardeningModel>("tensile_strength"))
      40             : {
      41             :   // cannot check the following for all values of strength, but this is a start
      42          82 :   if (_strength.value(0) < 0)
      43           2 :     mooseError("Weak plane tensile strength must not be negative");
      44          80 : }
      45             : 
      46             : Real
      47      187088 : SolidMechanicsPlasticWeakPlaneTensile::yieldFunction(const RankTwoTensor & stress, Real intnl) const
      48             : {
      49      187088 :   return _a * stress(2, 2) - tensile_strength(intnl);
      50             : }
      51             : 
      52             : RankTwoTensor
      53       53872 : SolidMechanicsPlasticWeakPlaneTensile::dyieldFunction_dstress(const RankTwoTensor & /*stress*/,
      54             :                                                               Real /*intnl*/) const
      55             : {
      56       53872 :   RankTwoTensor df_dsig;
      57       53872 :   df_dsig(2, 2) = _a;
      58       53872 :   return df_dsig;
      59             : }
      60             : 
      61             : Real
      62       53872 : SolidMechanicsPlasticWeakPlaneTensile::dyieldFunction_dintnl(const RankTwoTensor & /*stress*/,
      63             :                                                              Real intnl) const
      64             : {
      65       53872 :   return -dtensile_strength(intnl);
      66             : }
      67             : 
      68             : RankTwoTensor
      69      145568 : SolidMechanicsPlasticWeakPlaneTensile::flowPotential(const RankTwoTensor & /*stress*/,
      70             :                                                      Real /*intnl*/) const
      71             : {
      72      145568 :   RankTwoTensor df_dsig;
      73      145568 :   df_dsig(2, 2) = _a;
      74      145568 :   return df_dsig;
      75             : }
      76             : 
      77             : RankFourTensor
      78       53872 : SolidMechanicsPlasticWeakPlaneTensile::dflowPotential_dstress(const RankTwoTensor & /*stress*/,
      79             :                                                               Real /*intnl*/) const
      80             : {
      81       53872 :   return RankFourTensor();
      82             : }
      83             : 
      84             : RankTwoTensor
      85       53872 : SolidMechanicsPlasticWeakPlaneTensile::dflowPotential_dintnl(const RankTwoTensor & /*stress*/,
      86             :                                                              Real /*intnl*/) const
      87             : {
      88       53872 :   return RankTwoTensor();
      89             : }
      90             : 
      91             : Real
      92      204240 : SolidMechanicsPlasticWeakPlaneTensile::tensile_strength(const Real internal_param) const
      93             : {
      94      204240 :   return _strength.value(internal_param);
      95             : }
      96             : 
      97             : Real
      98       54064 : SolidMechanicsPlasticWeakPlaneTensile::dtensile_strength(const Real internal_param) const
      99             : {
     100       54064 :   return _strength.derivative(internal_param);
     101             : }
     102             : 
     103             : void
     104       24464 : SolidMechanicsPlasticWeakPlaneTensile::activeConstraints(const std::vector<Real> & f,
     105             :                                                          const RankTwoTensor & stress,
     106             :                                                          Real intnl,
     107             :                                                          const RankFourTensor & Eijkl,
     108             :                                                          std::vector<bool> & act,
     109             :                                                          RankTwoTensor & returned_stress) const
     110             : {
     111             :   act.assign(1, false);
     112             : 
     113       24464 :   if (f[0] <= _f_tol)
     114             :   {
     115        7696 :     returned_stress = stress;
     116        7696 :     return;
     117             :   }
     118             : 
     119       16768 :   Real str = tensile_strength(intnl);
     120             : 
     121       16768 :   RankTwoTensor n; // flow direction
     122       67072 :   for (unsigned i = 0; i < 3; ++i)
     123      201216 :     for (unsigned j = 0; j < 3; ++j)
     124      150912 :       n(i, j) = _a * Eijkl(i, j, 2, 2);
     125             : 
     126             :   // returned_stress = _a * stress - alpha*n
     127             :   // where alpha = (_a * stress(2, 2) - str)/n(2, 2)
     128       16768 :   Real alpha = (_a * stress(2, 2) - str) / n(2, 2);
     129             : 
     130       67072 :   for (unsigned i = 0; i < 3; ++i)
     131      201216 :     for (unsigned j = 0; j < 3; ++j)
     132      150912 :       returned_stress(i, j) = _a * stress(i, j) - alpha * n(i, j);
     133             : 
     134             :   act[0] = true;
     135             : }
     136             : 
     137             : std::string
     138          12 : SolidMechanicsPlasticWeakPlaneTensile::modelName() const
     139             : {
     140          12 :   return "WeakPlaneTensile";
     141             : }

Generated by: LCOV version 1.14