LCOV - code coverage report
Current view: top level - src/materials - ComputeLinearViscoelasticStress.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 27 28 96.4 %
Date: 2025-07-25 05:00:39 Functions: 4 4 100.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 "ComputeLinearViscoelasticStress.h"
      11             : 
      12             : registerMooseObject("SolidMechanicsApp", ComputeLinearViscoelasticStress);
      13             : 
      14             : InputParameters
      15          24 : ComputeLinearViscoelasticStress::validParams()
      16             : {
      17          24 :   InputParameters params = ComputeLinearElasticStress::validParams();
      18          24 :   params.addClassDescription("Divides total strain into elastic + creep + eigenstrains");
      19          48 :   params.addParam<std::string>(
      20             :       "apparent_creep_strain",
      21             :       "apparent_creep_strain",
      22             :       "name of the apparent creep strain (defined by a LinearViscoelasticityBase material)");
      23          48 :   params.addParam<std::string>(
      24             :       "apparent_elasticity_tensor",
      25             :       "apparent_elasticity_tensor",
      26             :       "name of the apparent elasticity tensor (defined by a LinearViscoelasticityBase material)");
      27          48 :   params.addParam<std::string>(
      28             :       "elasticity_tensor_inv",
      29             :       "elasticity_tensor_inv",
      30             :       "name of the real compliance tensor (defined by a LinearViscoelasticityBase material)");
      31          24 :   return params;
      32           0 : }
      33             : 
      34          18 : ComputeLinearViscoelasticStress::ComputeLinearViscoelasticStress(const InputParameters & parameters)
      35             :   : ComputeLinearElasticStress(parameters),
      36          18 :     _creep_strain(declareProperty<RankTwoTensor>(
      37          36 :         isParamValid("base_name") ? _base_name + "_creep_strain" : "creep_strain")),
      38          18 :     _creep_strain_old(getMaterialPropertyOld<RankTwoTensor>(
      39          54 :         isParamValid("base_name") ? _base_name + "_creep_strain" : "creep_strain")),
      40          36 :     _apparent_creep_strain(getMaterialProperty<RankTwoTensor>("apparent_creep_strain")),
      41          36 :     _apparent_elasticity_tensor(getMaterialProperty<RankFourTensor>("apparent_elasticity_tensor")),
      42          54 :     _elasticity_tensor_inv(getMaterialProperty<RankFourTensor>("elasticity_tensor_inv"))
      43             : {
      44          18 : }
      45             : 
      46             : void
      47          96 : ComputeLinearViscoelasticStress::initQpStatefulProperties()
      48             : {
      49          96 :   _creep_strain[_qp].zero();
      50          96 : }
      51             : 
      52             : void
      53       19296 : ComputeLinearViscoelasticStress::computeQpStress()
      54             : {
      55       19296 :   _creep_strain[_qp] =
      56       19296 :       _mechanical_strain[_qp] - (_apparent_elasticity_tensor[_qp] * _elasticity_tensor_inv[_qp]) *
      57       19296 :                                     (_mechanical_strain[_qp] - _apparent_creep_strain[_qp]);
      58             : 
      59       19296 :   _elastic_strain[_qp] = _mechanical_strain[_qp] - _creep_strain[_qp];
      60             : 
      61       19296 :   _stress[_qp] = _elasticity_tensor[_qp] * _elastic_strain[_qp];
      62             : 
      63       19296 :   _Jacobian_mult[_qp] = _elasticity_tensor[_qp];
      64       19296 : }

Generated by: LCOV version 1.14