LCOV - code coverage report
Current view: top level - src/materials - GeneralizedKelvinVoigtBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 63 67 94.0 %
Date: 2024-02-27 11:53:14 Functions: 5 5 100.0 %
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 "GeneralizedKelvinVoigtBase.h"
      11             : 
      12             : InputParameters
      13          72 : GeneralizedKelvinVoigtBase::validParams()
      14             : {
      15          72 :   InputParameters params = LinearViscoelasticityBase::validParams();
      16          72 :   params.set<bool>("need_viscoelastic_properties_inverse") = true;
      17          72 :   params.suppressParameter<bool>("need_viscoelastic_properties_inverse");
      18          72 :   return params;
      19           0 : }
      20             : 
      21          54 : GeneralizedKelvinVoigtBase::GeneralizedKelvinVoigtBase(const InputParameters & parameters)
      22             :   : LinearViscoelasticityBase(parameters),
      23          54 :     _first_elasticity_tensor_old(
      24         108 :         getMaterialPropertyOld<RankFourTensor>(_base_name + "spring_elasticity_tensor_0")),
      25          54 :     _first_elasticity_tensor_inv_old(
      26         108 :         getMaterialPropertyOld<RankFourTensor>(_base_name + "spring_elasticity_tensor_0_inv"))
      27             : {
      28          54 : }
      29             : 
      30             : void
      31        2656 : GeneralizedKelvinVoigtBase::updateQpViscousStrains()
      32             : {
      33        2656 :   if (_t_step <= 1)
      34          96 :     return;
      35             : 
      36        2560 :   RankTwoTensor effective_stress = _first_elasticity_tensor_old[_qp] * _elastic_strain_old[_qp];
      37             : 
      38        2560 :   if (_has_driving_eigenstrain)
      39         480 :     effective_stress += _first_elasticity_tensor_old[_qp] * (*_driving_eigenstrain_old)[_qp];
      40             : 
      41        6240 :   for (unsigned int i = 0; i < _springs_elasticity_tensors.size(); ++i)
      42             :   {
      43        3680 :     Real theta_i = computeTheta(_dt_old, (*_dashpot_viscosities_old[i])[_qp]);
      44        3680 :     Real gamma = (*_dashpot_viscosities_old[i])[_qp] / (_dt_old * theta_i);
      45        3680 :     (*_viscous_strains[i])[_qp] =
      46        3680 :         ((*_springs_elasticity_tensors_inv_old[i])[_qp] * effective_stress) /
      47        3680 :         (theta_i * (1. + gamma));
      48        3680 :     (*_viscous_strains[i])[_qp] += (*_viscous_strains_old[i])[_qp] *
      49        3680 :                                    (gamma / (theta_i * (1. + gamma)) - (1. - theta_i) / theta_i);
      50             :   }
      51             : 
      52        2560 :   if (_has_longterm_dashpot)
      53             :   {
      54         960 :     (*_viscous_strains.back())[_qp] = (_first_elasticity_tensor_inv_old[_qp] * effective_stress) *
      55         960 :                                       (_dt_old / (*_dashpot_viscosities_old.back())[_qp]);
      56         960 :     (*_viscous_strains.back())[_qp] += (*_viscous_strains_old.back())[_qp];
      57             :   }
      58             : }
      59             : 
      60             : void
      61        2656 : GeneralizedKelvinVoigtBase::computeQpApparentElasticityTensors()
      62             : {
      63        2656 :   _elasticity_tensor[_qp] = _first_elasticity_tensor[_qp];
      64        2656 :   _elasticity_tensor_inv[_qp] = (*_first_elasticity_tensor_inv)[_qp];
      65        2656 :   _apparent_elasticity_tensor_inv[_qp] = (*_first_elasticity_tensor_inv)[_qp];
      66             : 
      67        6480 :   for (unsigned int i = 0; i < _springs_elasticity_tensors.size(); ++i)
      68             :   {
      69        3824 :     Real theta_i = computeTheta(_dt, (*_dashpot_viscosities[i])[_qp]);
      70        3824 :     Real gamma = (*_dashpot_viscosities[i])[_qp] / (_dt * theta_i);
      71        3824 :     _apparent_elasticity_tensor_inv[_qp] +=
      72        7648 :         (*_springs_elasticity_tensors_inv[i])[_qp] / (1. + gamma);
      73             :   }
      74             : 
      75        2656 :   if (_has_longterm_dashpot)
      76             :   {
      77         992 :     Real theta_i = computeTheta(_dt, (*_dashpot_viscosities.back())[_qp]);
      78         992 :     Real gamma = (*_dashpot_viscosities.back())[_qp] / (_dt * theta_i);
      79        1984 :     _apparent_elasticity_tensor_inv[_qp] += (*_first_elasticity_tensor_inv)[_qp] / gamma;
      80             :   }
      81             : 
      82        2656 :   _apparent_elasticity_tensor[_qp] = _apparent_elasticity_tensor_inv[_qp].invSymm();
      83        2656 : }
      84             : 
      85             : void
      86        2656 : GeneralizedKelvinVoigtBase::computeQpApparentCreepStrain()
      87             : {
      88        2656 :   _apparent_creep_strain[_qp].zero();
      89             : 
      90        6480 :   for (unsigned int i = 0; i < _springs_elasticity_tensors.size(); ++i)
      91             :   {
      92        3824 :     Real theta_i = computeTheta(_dt, (*_dashpot_viscosities[i])[_qp]);
      93        3824 :     Real gamma = (*_dashpot_viscosities[i])[_qp] / (_dt * theta_i);
      94        3824 :     _apparent_creep_strain[_qp] += (*_viscous_strains[i])[_qp] * (gamma / (1. + gamma));
      95             :   }
      96             : 
      97        2656 :   if (_has_longterm_dashpot)
      98         992 :     _apparent_creep_strain[_qp] += (*_viscous_strains.back())[_qp];
      99             : 
     100        2656 :   if (_has_driving_eigenstrain)
     101             :   {
     102         496 :     RankFourTensor cumulated_driving_tensor;
     103         496 :     cumulated_driving_tensor.zero();
     104         496 :     for (unsigned int i = 0; i < _springs_elasticity_tensors.size(); ++i)
     105             :     {
     106           0 :       double theta_i = computeTheta(_dt, (*_dashpot_viscosities[i])[_qp]);
     107           0 :       double gamma = (*_dashpot_viscosities[i])[_qp] / (_dt * theta_i);
     108           0 :       cumulated_driving_tensor += (*_springs_elasticity_tensors_inv[i])[_qp] / (1. + gamma);
     109             :     }
     110             : 
     111         496 :     _apparent_creep_strain[_qp] +=
     112         496 :         (_elasticity_tensor[_qp] * cumulated_driving_tensor) * (*_driving_eigenstrain)[_qp];
     113             : 
     114         496 :     if (_has_longterm_dashpot)
     115             :     {
     116         496 :       double theta_i = computeTheta(_dt, (*_dashpot_viscosities.back())[_qp]);
     117         496 :       double gamma = (*_dashpot_viscosities.back())[_qp] / (_dt * theta_i);
     118         496 :       _apparent_creep_strain[_qp] += (*_driving_eigenstrain)[_qp] / gamma;
     119             :     }
     120             :   }
     121        2656 : }

Generated by: LCOV version 1.14