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

Generated by: LCOV version 1.14