www.mooseframework.org
ComputeEigenstrainBase.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 "ComputeEigenstrainBase.h"
11 
12 #include "RankTwoTensor.h"
13 
14 template <bool is_ad>
17 {
19  params.addParam<std::string>("base_name",
20  "Optional parameter that allows the user to define "
21  "multiple mechanics material systems on the same "
22  "block, i.e. for multiple phases");
23  params.addRequiredParam<std::string>("eigenstrain_name",
24  "Material property name for the eigenstrain tensor computed "
25  "by this model. IMPORTANT: The name of this property must "
26  "also be provided to the strain calculator.");
27  return params;
28 }
29 
30 template <bool is_ad>
32  : Material(parameters),
33  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
34  _eigenstrain_name(_base_name + getParam<std::string>("eigenstrain_name")),
35  _eigenstrain(declareGenericProperty<RankTwoTensor, is_ad>(_eigenstrain_name)),
36  _step_zero(declareRestartableData<bool>("step_zero", true))
37 {
38 }
39 
40 template <bool is_ad>
41 void
43 {
44  // This property can be promoted to be stateful by other models that use it,
45  // so it needs to be initalized.
46  _eigenstrain[_qp].zero();
47 }
48 
49 template <bool is_ad>
50 void
52 {
53  if (_t_step >= 1)
54  _step_zero = false;
55 
56  // Skip the eigenstrain calculation in step zero because no solution is computed during
57  // the zeroth step, hence computing the eigenstrain in the zeroth step would result in
58  // an incorrect calculation of mechanical_strain, which is stateful.
59  if (!_step_zero)
60  computeQpEigenstrain();
61 }
62 
63 template <bool is_ad>
66  const GenericReal<is_ad> & volumetric_strain) const
67 {
68  // The engineering strain in a given direction is:
69  // epsilon_eng = cbrt(volumetric_strain + 1.0) - 1.0
70  //
71  // We need to provide this as a logarithmic strain to be consistent with the strain measure
72  // used for finite strain:
73  // epsilon_log = log(1.0 + epsilon_eng)
74  //
75  // This can be simplified down to a more direct form:
76  // epsilon_log = log(cbrt(volumetric_strain + 1.0))
77  // or:
78  // epsilon_log = (1/3) log(volumetric_strain + 1.0)
79 
80  return std::log(volumetric_strain + 1.0) / 3.0;
81 }
82 
ComputeEigenstrainBaseTempl(const InputParameters &parameters)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
static InputParameters validParams()
GenericReal< is_ad > computeVolumetricStrainComponent(const GenericReal< is_ad > &volumetric_strain) const
Helper function for models that compute the eigenstrain based on a volumetric strain.
ComputeEigenstrainBase is the base class for eigenstrain tensors.
virtual void computeQpProperties() override
typename Moose::GenericType< Real, is_ad > GenericReal
virtual void initQpStatefulProperties() override