www.mooseframework.org
ComputeEigenstrainBase.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 
9 #include "RankTwoTensor.h"
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<Material>();
16  params.addParam<std::string>("base_name",
17  "Optional parameter that allows the user to define "
18  "multiple mechanics material systems on the same "
19  "block, i.e. for multiple phases");
20  params.addRequiredParam<std::string>("eigenstrain_name",
21  "Material property name for the eigenstrain tensor computed "
22  "by this model. IMPORTANT: The name of this property must "
23  "also be provided to the strain calculator.");
24  params.addParam<bool>("incremental_form",
25  false,
26  "Should the eigenstrain be in incremental form (for incremental models)?");
27  return params;
28 }
29 
30 ComputeEigenstrainBase::ComputeEigenstrainBase(const InputParameters & parameters)
31  : Material(parameters),
32  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
33  _eigenstrain_name(_base_name + getParam<std::string>("eigenstrain_name")),
34  _incremental_form(getParam<bool>("incremental_form")),
35  _eigenstrain(declareProperty<RankTwoTensor>(_eigenstrain_name)),
36  _eigenstrain_old(_incremental_form ? &getMaterialPropertyOld<RankTwoTensor>(_eigenstrain_name)
37  : NULL),
38  _step_zero(declareRestartableData<bool>("step_zero", true))
39 {
40 }
41 
42 void
44 {
46  _eigenstrain[_qp].zero();
47 }
48 
49 void
51 {
52  if (_t_step >= 1)
53  _step_zero = false;
54 
55  // Skip the eigenstrain calculation in step zero because no solution is computed during
56  // the zeroth step, hence computing the eigenstrain in the zeroth step would result in
57  // an incorrect calculation of mechanical_strain, which is stateful.
58  if (!_step_zero)
60 }
61 
62 Real
64 {
65 
66  Real volumetric_strain_comp = std::cbrt(volumetric_strain + 1.0) - 1.0;
67 
68  // Convert to logarithmic strain to compute strains to exactly recover
69  // volumetric strain in finite strain models
70  volumetric_strain_comp = std::log(1.0 + volumetric_strain_comp);
71 
72  return volumetric_strain_comp;
73 }
virtual void computeQpEigenstrain()=0
Compute the eigenstrain and store in _eigenstrain.
InputParameters validParams< ComputeEigenstrainBase >()
virtual void initQpStatefulProperties()
MaterialProperty< RankTwoTensor > & _eigenstrain
Stores the current total eigenstrain.
Real computeVolumetricStrainComponent(const Real volumetric_strain) const
Helper function for models that compute the eigenstrain based on a volumetric strain.
ComputeEigenstrainBase(const InputParameters &parameters)
bool _incremental_form
Whether the eigenstrain model should compute the total or incremental eigenstrain.
bool & _step_zero
Restartable data to check for the zeroth and first time steps for thermal calculations.