LCOV - code coverage report
Current view: top level - src/userobjects - TensorMechanicsPlasticWeakPlaneTensileN.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 32 37 86.5 %
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 "TensorMechanicsPlasticWeakPlaneTensileN.h"
      11             : #include "RotationMatrix.h" // for rotVecToZ
      12             : #include "RankFourTensor.h"
      13             : 
      14             : registerMooseObject("TensorMechanicsApp", TensorMechanicsPlasticWeakPlaneTensileN);
      15             : 
      16             : InputParameters
      17           6 : TensorMechanicsPlasticWeakPlaneTensileN::validParams()
      18             : {
      19           6 :   InputParameters params = TensorMechanicsPlasticWeakPlaneTensile::validParams();
      20          12 :   params.addRequiredParam<RealVectorValue>("normal_vector", "The normal vector to the weak plane");
      21           6 :   params.addClassDescription("Associative weak-plane tensile plasticity with hardening/softening, "
      22             :                              "with specified, fixed normal vector.  (WeakPlaneTensile combined "
      23             :                              "with specifying N in the Material might be preferable to you.)");
      24             : 
      25           6 :   return params;
      26           0 : }
      27             : 
      28           3 : TensorMechanicsPlasticWeakPlaneTensileN::TensorMechanicsPlasticWeakPlaneTensileN(
      29           3 :     const InputParameters & parameters)
      30             :   : TensorMechanicsPlasticWeakPlaneTensile(parameters),
      31           3 :     _input_n(getParam<RealVectorValue>("normal_vector")),
      32           6 :     _df_dsig(RankTwoTensor())
      33             : {
      34             :   // cannot check the following for all values of strength, but this is a start
      35           3 :   if (_strength.value(0) < 0)
      36           0 :     mooseError("Weak plane tensile strength must not be negative");
      37           3 :   if (_input_n.norm() == 0)
      38           0 :     mooseError("Weak-plane normal vector must not have zero length");
      39             :   else
      40           3 :     _input_n /= _input_n.norm();
      41           3 :   _rot = RotationMatrix::rotVecToZ(_input_n);
      42             : 
      43          12 :   for (unsigned i = 0; i < 3; ++i)
      44          36 :     for (unsigned j = 0; j < 3; ++j)
      45          27 :       _df_dsig(i, j) = _rot(2, i) * _rot(2, j);
      46           3 : }
      47             : 
      48             : Real
      49         224 : TensorMechanicsPlasticWeakPlaneTensileN::yieldFunction(const RankTwoTensor & stress,
      50             :                                                        Real intnl) const
      51             : {
      52             :   Real s22 = 0;
      53         896 :   for (unsigned i = 0; i < 3; ++i)
      54        2688 :     for (unsigned j = 0; j < 3; ++j)
      55        2016 :       s22 += _rot(2, i) * _rot(2, j) * stress(i, j);
      56         224 :   return s22 - tensile_strength(intnl);
      57             : }
      58             : 
      59             : RankTwoTensor
      60          96 : TensorMechanicsPlasticWeakPlaneTensileN::dyieldFunction_dstress(const RankTwoTensor & /*stress*/,
      61             :                                                                 Real /*intnl*/) const
      62             : {
      63          96 :   return _df_dsig;
      64             : }
      65             : 
      66             : Real
      67          96 : TensorMechanicsPlasticWeakPlaneTensileN::dyieldFunction_dintnl(const RankTwoTensor & /*stress*/,
      68             :                                                                Real intnl) const
      69             : {
      70          96 :   return -dtensile_strength(intnl);
      71             : }
      72             : 
      73             : RankTwoTensor
      74         192 : TensorMechanicsPlasticWeakPlaneTensileN::flowPotential(const RankTwoTensor & /*stress*/,
      75             :                                                        Real /*intnl*/) const
      76             : {
      77         192 :   return _df_dsig;
      78             : }
      79             : 
      80             : RankFourTensor
      81          96 : TensorMechanicsPlasticWeakPlaneTensileN::dflowPotential_dstress(const RankTwoTensor & /*stress*/,
      82             :                                                                 Real /*intnl*/) const
      83             : {
      84          96 :   return RankFourTensor();
      85             : }
      86             : 
      87             : RankTwoTensor
      88          96 : TensorMechanicsPlasticWeakPlaneTensileN::dflowPotential_dintnl(const RankTwoTensor & /*stress*/,
      89             :                                                                Real /*intnl*/) const
      90             : {
      91          96 :   return RankTwoTensor();
      92             : }
      93             : 
      94             : std::string
      95           0 : TensorMechanicsPlasticWeakPlaneTensileN::modelName() const
      96             : {
      97           0 :   return "WeakPlaneTensileN";
      98             : }

Generated by: LCOV version 1.14