LCOV - code coverage report
Current view: top level - src/materials/lagrangian - ComputeStVenantKirchhoffStress.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #33390 (250e9c) with base 846a5c Lines: 21 22 95.5 %
Date: 2026-07-31 18:20:40 Functions: 4 4 100.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 "ComputeStVenantKirchhoffStress.h"
      11             : 
      12             : registerMooseObject("SolidMechanicsApp", ComputeStVenantKirchhoffStress);
      13             : 
      14             : InputParameters
      15          60 : ComputeStVenantKirchhoffStress::validParams()
      16             : {
      17          60 :   InputParameters params = ComputeLagrangianStressPK2::validParams();
      18             : 
      19         120 :   params.addParam<MaterialPropertyName>(
      20             :       "elasticity_tensor", "elasticity_tensor", "The name of the elasticity tensor.");
      21             : 
      22          60 :   return params;
      23           0 : }
      24             : 
      25          45 : ComputeStVenantKirchhoffStress::ComputeStVenantKirchhoffStress(const InputParameters & parameters)
      26             :   : ComputeLagrangianStressPK2(parameters),
      27          90 :     _elasticity_tensor_name(getParam<MaterialPropertyName>("elasticity_tensor")),
      28          90 :     _elasticity_tensor(getMaterialProperty<RankFourTensor>(_elasticity_tensor_name))
      29             : {
      30          45 : }
      31             : 
      32             : void
      33          43 : ComputeStVenantKirchhoffStress::initialSetup()
      34             : {
      35          43 :   ComputeLagrangianStressBase::initialSetup();
      36             : 
      37             :   // Enforce isotropic elastic tensor
      38          43 :   if (!hasGuaranteedMaterialProperty(_elasticity_tensor_name, Guarantee::ISOTROPIC))
      39           1 :     mooseError("ComputeStVenantKirchhoffStress requires an isotropic elasticity "
      40             :                "tensor");
      41          42 : }
      42             : 
      43             : void
      44     1559216 : ComputeStVenantKirchhoffStress::computeQpPK2Stress()
      45             : {
      46             :   // Hyperelasticity is weird, we need to branch on the type of update if we
      47             :   // want a truly linear model
      48             :   //
      49             :   // This is because we need to drop quadratic terms for the linear update to
      50             :   // use a linear strain measure
      51             : 
      52             :   // Jacobian is the same for both the small and Green-Lagrange strains
      53     1559216 :   _C[_qp] = _elasticity_tensor[_qp];
      54             : 
      55             :   // Get the right strain
      56     1559216 :   RankTwoTensor strain;
      57     1559216 :   if (_large_kinematics) // Large deformations = Green-Lagrange strain
      58      779704 :     strain = _E[_qp];
      59             :   else // Small deformations = linear strain
      60      779512 :     strain = 0.5 * (_F[_qp] + _F[_qp].transpose()) - RankTwoTensor::Identity();
      61             : 
      62             :   // The stress update is linear with the correct strains/frame
      63     1559216 :   _S[_qp] = _C[_qp] * strain;
      64     1559216 : }

Generated by: LCOV version 1.14