LCOV - code coverage report
Current view: top level - src/materials - LinearViscoelasticStressUpdate.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #31405 (292dce) with base fef103 Lines: 26 30 86.7 %
Date: 2025-09-04 07:57:23 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         196 : LinearViscoelasticStressUpdate::validParams()
      16             : {
      17         196 :   InputParameters params = StressUpdateBase::validParams();
      18         392 :   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         392 :   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         392 :   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         196 :   return params;
      31           0 : }
      32             : 
      33         147 : LinearViscoelasticStressUpdate::LinearViscoelasticStressUpdate(const InputParameters & parameters)
      34             :   : StressUpdateBase(parameters),
      35         147 :     _creep_strain(declareProperty<RankTwoTensor>(_base_name + "creep_strain")),
      36         294 :     _creep_strain_old(getMaterialPropertyOld<RankTwoTensor>(_base_name + "creep_strain")),
      37         294 :     _apparent_creep_strain(getMaterialProperty<RankTwoTensor>("apparent_creep_strain")),
      38         294 :     _apparent_elasticity_tensor(getMaterialProperty<RankFourTensor>("apparent_elasticity_tensor")),
      39         441 :     _elasticity_tensor_inv(getMaterialProperty<RankFourTensor>("elasticity_tensor_inv"))
      40             : {
      41         147 : }
      42             : 
      43             : void
      44         680 : LinearViscoelasticStressUpdate::initQpStatefulProperties()
      45             : {
      46         680 :   _creep_strain[_qp].zero();
      47         680 : }
      48             : 
      49             : void
      50           0 : LinearViscoelasticStressUpdate::propagateQpStatefulProperties()
      51             : {
      52           0 :   _creep_strain[_qp] = _creep_strain_old[_qp];
      53           0 : }
      54             : 
      55             : void
      56      117308 : 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      117308 :       elastic_strain_old + _creep_strain_old[_qp] + strain_increment;
      68             : 
      69      117308 :   _creep_strain[_qp] =
      70      117308 :       current_mechanical_strain - (_apparent_elasticity_tensor[_qp] * _elasticity_tensor_inv[_qp]) *
      71      117308 :                                       (current_mechanical_strain - _apparent_creep_strain[_qp]);
      72             : 
      73      117308 :   RankTwoTensor creep_strain_increment = _creep_strain[_qp] - _creep_strain_old[_qp];
      74             : 
      75      117308 :   strain_increment -= creep_strain_increment;
      76      117308 :   inelastic_strain_increment += creep_strain_increment;
      77      117308 :   stress_new -= elasticity_tensor * creep_strain_increment;
      78      117308 : }

Generated by: LCOV version 1.14