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

Generated by: LCOV version 1.14