https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ComputeEigenstrainBase.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
11
12#include "RankTwoTensor.h"
13
14template <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
30template <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
40template <bool is_ad>
41void
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
49template <bool is_ad>
50void
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
63template <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 using std::log;
80 return log(volumetric_strain + 1.0) / 3.0;
81}
82
Moose::GenericType< Real, is_ad > GenericReal
ComputeEigenstrainBase is the base class for eigenstrain tensors.
virtual void initQpStatefulProperties() override
virtual void computeQpProperties() override
ComputeEigenstrainBaseTempl(const InputParameters &parameters)
GenericReal< is_ad > computeVolumetricStrainComponent(const GenericReal< is_ad > &volumetric_strain) const
Helper function for models that compute the eigenstrain based on a volumetric strain.
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()