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

Generated by: LCOV version 1.14