LCOV - code coverage report
Current view: top level - src/materials - VolumeDeformGradCorrectedStress.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #31405 (292dce) with base fef103 Lines: 29 33 87.9 %
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 "VolumeDeformGradCorrectedStress.h"
      11             : 
      12             : registerMooseObject("SolidMechanicsApp", VolumeDeformGradCorrectedStress);
      13             : 
      14             : InputParameters
      15          56 : VolumeDeformGradCorrectedStress::validParams()
      16             : {
      17          56 :   InputParameters params = Material::validParams();
      18          56 :   params.addClassDescription(
      19             :       "Transforms stress with volumetric term from previous configuration to this configuration");
      20         112 :   params.addRequiredParam<MaterialPropertyName>("pre_stress_name",
      21             :                                                 "Name of stress variable from previous config.");
      22         112 :   params.addRequiredParam<MaterialPropertyName>("deform_grad_name",
      23             :                                                 "Name of deformation gradient variable");
      24         112 :   params.addParam<MaterialPropertyName>("pre_jacobian_name",
      25             :                                         "Name of Jacobian variable from previous config.");
      26         112 :   params.addRequiredParam<MaterialPropertyName>("stress_name", "Name of stress variable");
      27         112 :   params.addParam<MaterialPropertyName>("jacobian_name", "Name of Jacobian variable");
      28          56 :   return params;
      29           0 : }
      30             : 
      31          42 : VolumeDeformGradCorrectedStress::VolumeDeformGradCorrectedStress(const InputParameters & parameters)
      32             :   : DerivativeMaterialInterface<Material>(parameters),
      33          42 :     _pre_stress(getMaterialProperty<RankTwoTensor>("pre_stress_name")),
      34          84 :     _deformation_gradient(getMaterialProperty<RankTwoTensor>("deform_grad_name")),
      35          42 :     _pre_Jacobian_mult(isParamValid("pre_jacobian_name")
      36         126 :                            ? &getMaterialProperty<RankFourTensor>("pre_jacobian_name")
      37             :                            : nullptr),
      38          84 :     _stress(declareProperty<RankTwoTensor>(getParam<MaterialPropertyName>("stress_name"))),
      39          42 :     _Jacobian_mult(
      40          42 :         isParamValid("jacobian_name")
      41         126 :             ? &declareProperty<RankFourTensor>(getParam<MaterialPropertyName>("jacobian_name"))
      42          42 :             : nullptr)
      43             : {
      44          42 : }
      45             : 
      46             : void
      47           0 : VolumeDeformGradCorrectedStress::initQpStatefulProperties()
      48             : {
      49           0 :   _stress[_qp] = _pre_stress[_qp];
      50           0 : }
      51             : 
      52             : void
      53       19584 : VolumeDeformGradCorrectedStress::computeQpProperties()
      54             : {
      55       19584 :   computeQpStress();
      56       19584 : }
      57             : 
      58             : void
      59       19584 : VolumeDeformGradCorrectedStress::computeQpStress()
      60             : {
      61       19584 :   _stress[_qp] = _deformation_gradient[_qp] * _pre_stress[_qp] *
      62       19584 :                  _deformation_gradient[_qp].transpose() / _deformation_gradient[_qp].det();
      63             : 
      64       19584 :   if (_Jacobian_mult && _pre_Jacobian_mult)
      65       19584 :     (*_Jacobian_mult)[_qp] = (*_pre_Jacobian_mult)[_qp];
      66       19584 : }

Generated by: LCOV version 1.14