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

Generated by: LCOV version 1.14