LCOV - code coverage report
Current view: top level - src/materials - LinearViscoelasticStressUpdate.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 26 30 86.7 %
Date: 2025-07-25 05:00:39 Functions: 4 5 80.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 "LinearViscoelasticStressUpdate.h"
      11             : 
      12             : registerMooseObject("SolidMechanicsApp", LinearViscoelasticStressUpdate);
      13             : 
      14             : InputParameters
      15         168 : LinearViscoelasticStressUpdate::validParams()
      16             : {
      17         168 :   InputParameters params = StressUpdateBase::validParams();
      18         336 :   params.addParam<std::string>(
      19             :       "apparent_creep_strain",
      20             :       "apparent_creep_strain",
      21             :       "name of the apparent creep strain (defined by a LinearViscoelasticityBase material)");
      22         336 :   params.addParam<std::string>(
      23             :       "apparent_elasticity_tensor",
      24             :       "apparent_elasticity_tensor",
      25             :       "name of the apparent elasticity tensor (defined by a LinearViscoelasticityBase material)");
      26         336 :   params.addParam<std::string>(
      27             :       "elasticity_tensor_inv",
      28             :       "elasticity_tensor_inv",
      29             :       "name of the real compliance tensor (defined by a LinearViscoelasticityBase material)");
      30         168 :   return params;
      31           0 : }
      32             : 
      33         126 : LinearViscoelasticStressUpdate::LinearViscoelasticStressUpdate(const InputParameters & parameters)
      34             :   : StressUpdateBase(parameters),
      35         126 :     _creep_strain(declareProperty<RankTwoTensor>(_base_name + "creep_strain")),
      36         252 :     _creep_strain_old(getMaterialPropertyOld<RankTwoTensor>(_base_name + "creep_strain")),
      37         252 :     _apparent_creep_strain(getMaterialProperty<RankTwoTensor>("apparent_creep_strain")),
      38         252 :     _apparent_elasticity_tensor(getMaterialProperty<RankFourTensor>("apparent_elasticity_tensor")),
      39         378 :     _elasticity_tensor_inv(getMaterialProperty<RankFourTensor>("elasticity_tensor_inv"))
      40             : {
      41         126 : }
      42             : 
      43             : void
      44         544 : LinearViscoelasticStressUpdate::initQpStatefulProperties()
      45             : {
      46         544 :   _creep_strain[_qp].zero();
      47         544 : }
      48             : 
      49             : void
      50           0 : LinearViscoelasticStressUpdate::propagateQpStatefulProperties()
      51             : {
      52           0 :   _creep_strain[_qp] = _creep_strain_old[_qp];
      53           0 : }
      54             : 
      55             : void
      56       93200 : LinearViscoelasticStressUpdate::updateState(RankTwoTensor & strain_increment,
      57             :                                             RankTwoTensor & inelastic_strain_increment,
      58             :                                             const RankTwoTensor & /*rotation_increment*/,
      59             :                                             RankTwoTensor & stress_new,
      60             :                                             const RankTwoTensor & /*stress_old*/,
      61             :                                             const RankFourTensor & elasticity_tensor,
      62             :                                             const RankTwoTensor & elastic_strain_old,
      63             :                                             bool /*compute_full_tangent_operator*/,
      64             :                                             RankFourTensor & /*tangent_operator*/)
      65             : {
      66             :   RankTwoTensor current_mechanical_strain =
      67       93200 :       elastic_strain_old + _creep_strain_old[_qp] + strain_increment;
      68             : 
      69       93200 :   _creep_strain[_qp] =
      70       93200 :       current_mechanical_strain - (_apparent_elasticity_tensor[_qp] * _elasticity_tensor_inv[_qp]) *
      71       93200 :                                       (current_mechanical_strain - _apparent_creep_strain[_qp]);
      72             : 
      73       93200 :   RankTwoTensor creep_strain_increment = _creep_strain[_qp] - _creep_strain_old[_qp];
      74             : 
      75       93200 :   strain_increment -= creep_strain_increment;
      76       93200 :   inelastic_strain_increment += creep_strain_increment;
      77       93200 :   stress_new -= elasticity_tensor * creep_strain_increment;
      78       93200 : }

Generated by: LCOV version 1.14