LCOV - code coverage report
Current view: top level - src/materials - ComputeDeformGradBasedStress.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 28 29 96.6 %
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 "ComputeDeformGradBasedStress.h"
      11             : 
      12             : registerMooseObject("TensorMechanicsApp", ComputeDeformGradBasedStress);
      13             : 
      14             : InputParameters
      15          48 : ComputeDeformGradBasedStress::validParams()
      16             : {
      17          48 :   InputParameters params = Material::validParams();
      18          48 :   params.addClassDescription("Computes stress based on Lagrangian strain");
      19          96 :   params.addRequiredParam<MaterialPropertyName>("deform_grad_name",
      20             :                                                 "Name of deformation gradient variable");
      21          96 :   params.addRequiredParam<MaterialPropertyName>("elasticity_tensor_name",
      22             :                                                 "Name of elasticity tensor variable");
      23          96 :   params.addRequiredParam<MaterialPropertyName>("stress_name", "Name of stress variable");
      24          96 :   params.addRequiredParam<MaterialPropertyName>("jacobian_name", "Name of Jacobian variable");
      25          48 :   return params;
      26           0 : }
      27             : 
      28          36 : ComputeDeformGradBasedStress::ComputeDeformGradBasedStress(const InputParameters & parameters)
      29             :   : DerivativeMaterialInterface<Material>(parameters),
      30          36 :     _deformation_gradient(getMaterialProperty<RankTwoTensor>("deform_grad_name")),
      31          72 :     _elasticity_tensor(getMaterialProperty<RankFourTensor>("elasticity_tensor_name")),
      32          72 :     _stress(declareProperty<RankTwoTensor>(getParam<MaterialPropertyName>("stress_name"))),
      33         108 :     _Jacobian_mult(declareProperty<RankFourTensor>(getParam<MaterialPropertyName>("jacobian_name")))
      34             : {
      35          36 : }
      36             : 
      37             : void
      38         128 : ComputeDeformGradBasedStress::initQpStatefulProperties()
      39             : {
      40         128 :   _stress[_qp].zero();
      41         128 : }
      42             : 
      43             : void
      44       16000 : ComputeDeformGradBasedStress::computeQpProperties()
      45             : {
      46       16000 :   computeQpStress();
      47       16000 : }
      48             : 
      49             : void
      50       16000 : ComputeDeformGradBasedStress::computeQpStress()
      51             : {
      52       16000 :   const RankTwoTensor iden(RankTwoTensor::initIdentity);
      53             :   RankTwoTensor ee =
      54       16000 :       0.5 * (_deformation_gradient[_qp].transpose() * _deformation_gradient[_qp] - iden);
      55       16000 :   RankTwoTensor pk2 = _elasticity_tensor[_qp] * ee;
      56             : 
      57       16000 :   _stress[_qp] = _deformation_gradient[_qp] * pk2 * _deformation_gradient[_qp].transpose() /
      58       16000 :                  _deformation_gradient[_qp].det();
      59       16000 :   _Jacobian_mult[_qp] = _elasticity_tensor[_qp];
      60       16000 : }

Generated by: LCOV version 1.14