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

Generated by: LCOV version 1.14