LCOV - code coverage report
Current view: top level - src/materials/lagrangian - ComputeStVenantKirchhoffStress.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 20 21 95.2 %
Date: 2024-02-27 11:53:14 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://www.mooseframework.org
       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("TensorMechanicsApp", ComputeStVenantKirchhoffStress);
      13             : 
      14             : InputParameters
      15          52 : ComputeStVenantKirchhoffStress::validParams()
      16             : {
      17          52 :   InputParameters params = ComputeLagrangianStressPK2::validParams();
      18             : 
      19         104 :   params.addParam<MaterialPropertyName>(
      20             :       "elasticity_tensor", "elasticity_tensor", "The name of the elasticity tensor.");
      21             : 
      22          52 :   return params;
      23           0 : }
      24             : 
      25          39 : ComputeStVenantKirchhoffStress::ComputeStVenantKirchhoffStress(const InputParameters & parameters)
      26             :   : ComputeLagrangianStressPK2(parameters),
      27             :     GuaranteeConsumer(this),
      28          78 :     _elasticity_tensor_name(getParam<MaterialPropertyName>("elasticity_tensor")),
      29          78 :     _elasticity_tensor(getMaterialProperty<RankFourTensor>(_elasticity_tensor_name))
      30             : {
      31          39 : }
      32             : 
      33             : void
      34          37 : ComputeStVenantKirchhoffStress::initialSetup()
      35             : {
      36             :   // Enforce isotropic elastic tensor
      37          37 :   if (!hasGuaranteedMaterialProperty(_elasticity_tensor_name, Guarantee::ISOTROPIC))
      38           1 :     mooseError("ComputeStVenantKirchhoffStress requires an isotropic elasticity "
      39             :                "tensor");
      40          36 : }
      41             : 
      42             : void
      43     1953184 : 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     1953184 :   _C[_qp] = _elasticity_tensor[_qp];
      53             : 
      54             :   // Get the right strain
      55     1953184 :   RankTwoTensor strain;
      56     1953184 :   if (_large_kinematics) // Large deformations = Green-Lagrange strain
      57      976640 :     strain = _E[_qp];
      58             :   else // Small deformations = linear strain
      59      976544 :     strain = 0.5 * (_F[_qp] + _F[_qp].transpose()) - RankTwoTensor::Identity();
      60             : 
      61             :   // The stress update is linear with the correct strains/frame
      62     1953184 :   _S[_qp] = _C[_qp] * strain;
      63     1953184 : }

Generated by: LCOV version 1.14