LCOV - code coverage report
Current view: top level - src/materials - ComputeLinearElasticStress.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 18 19 94.7 %
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 "ComputeLinearElasticStress.h"
      11             : 
      12             : registerMooseObject("TensorMechanicsApp", ComputeLinearElasticStress);
      13             : 
      14             : InputParameters
      15        1904 : ComputeLinearElasticStress::validParams()
      16             : {
      17        1904 :   InputParameters params = ComputeStressBase::validParams();
      18        1904 :   params.addClassDescription("Compute stress using elasticity for small strains");
      19        1904 :   return params;
      20           0 : }
      21             : 
      22        1422 : ComputeLinearElasticStress::ComputeLinearElasticStress(const InputParameters & parameters)
      23             :   : ComputeStressBase(parameters),
      24        1422 :     _elasticity_tensor_name(_base_name + "elasticity_tensor"),
      25        1422 :     _elasticity_tensor(getMaterialPropertyByName<RankFourTensor>(_elasticity_tensor_name))
      26             : {
      27        1422 : }
      28             : 
      29             : void
      30        1358 : ComputeLinearElasticStress::initialSetup()
      31             : {
      32             :   // _base_name + "unstabilized_deformation_gradient" is only declared if we're
      33             :   // using the Lagrangian kernels.  It's okay to invoke this small strain
      34             :   // material if you are using that kernel system and the
      35             :   // ComputeLagrangianWrappedStress wrapper
      36        2735 :   if (hasBlockMaterialProperty<RankTwoTensor>(_base_name + "strain_increment") &&
      37        1377 :       !hasBlockMaterialProperty<RankTwoTensor>(_base_name + "unstabilized_deformation_gradient"))
      38           1 :     mooseError("This linear elastic stress calculation only works for small strains; use "
      39             :                "ComputeFiniteStrainElasticStress for simulations using incremental and finite "
      40             :                "strains.");
      41        1357 : }
      42             : 
      43             : void
      44    12180906 : ComputeLinearElasticStress::computeQpStress()
      45             : {
      46             :   // stress = C * e
      47    12180906 :   _stress[_qp] = _elasticity_tensor[_qp] * _mechanical_strain[_qp];
      48             : 
      49             :   // Assign value for elastic strain, which is equal to the mechanical strain
      50    12180906 :   _elastic_strain[_qp] = _mechanical_strain[_qp];
      51             : 
      52             :   // Compute dstress_dstrain
      53    12180906 :   _Jacobian_mult[_qp] = _elasticity_tensor[_qp];
      54    12180906 : }

Generated by: LCOV version 1.14