www.mooseframework.org
ComputeSmallStrain.C
Go to the documentation of this file.
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 "ComputeSmallStrain.h"
11 #include "Assembly.h"
12 #include "libmesh/quadrature.h"
13 
14 registerMooseObject("SolidMechanicsApp", ComputeSmallStrain);
15 
18 {
20  params.addClassDescription("Compute a small strain.");
21  return params;
22 }
23 
25  : ComputeStrainBase(parameters)
26 {
27 }
28 
29 void
31 {
32  Real volumetric_strain = 0.0;
33  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
34  {
35  // strain = (grad_disp + grad_disp^T)/2
36  const auto grad_tensor = RankTwoTensor ::initializeFromRows(
37  (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]);
38 
39  _total_strain[_qp] = (grad_tensor + grad_tensor.transpose()) / 2.0;
40 
42  volumetric_strain += _total_strain[_qp].trace() * _JxW[_qp] * _coord[_qp];
43  }
44 
46  volumetric_strain /= _current_elem_volume;
47 
48  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
49  {
51  {
52  Real trace = _total_strain[_qp].trace();
53  _total_strain[_qp](0, 0) += (volumetric_strain - trace) / 3.0;
54  _total_strain[_qp](1, 1) += (volumetric_strain - trace) / 3.0;
55  _total_strain[_qp](2, 2) += (volumetric_strain - trace) / 3.0;
56  }
57 
58  if (_global_strain)
59  _total_strain[_qp] += (*_global_strain)[_qp];
60 
62 
63  // Remove the Eigen strain
64  for (auto es : _eigenstrains)
65  _mechanical_strain[_qp] -= (*es)[_qp];
66  }
67 }
const Real & _current_elem_volume
const MooseArray< Real > & _JxW
registerMooseObject("SolidMechanicsApp", ComputeSmallStrain)
static InputParameters validParams()
ComputeSmallStrain(const InputParameters &parameters)
static RankTwoTensorTempl initializeFromRows(const libMesh::TypeVector< Real > &row0, const libMesh::TypeVector< Real > &row1, const libMesh::TypeVector< Real > &row2)
MaterialProperty< RankTwoTensor > & _mechanical_strain
virtual void computeProperties() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
ComputeStrainBase is the base class for strain tensors.
const bool _volumetric_locking_correction
const MooseArray< Real > & _coord
const MaterialProperty< RankTwoTensor > *const _global_strain
MaterialProperty< RankTwoTensor > & _total_strain
std::vector< const MaterialProperty< RankTwoTensor > * > _eigenstrains
ComputeSmallStrain defines a strain tensor, assuming small strains.
std::vector< const VariableGradient * > _grad_disp
Gradient of displacements.