Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13099 from tophmatthews/ad_eigenstrain_13091
ADComputeEigenstrain implementation
- Loading branch information
Showing
20 changed files
with
1,331 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,11 +27,6 @@ | |
type = RandomIC | ||
[../] | ||
[../] | ||
|
||
[./disp_x] | ||
[../] | ||
[./disp_y] | ||
[../] | ||
[] | ||
|
||
[AuxVariables] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
modules/tensor_mechanics/doc/content/source/materials/ADComputeEigenstrain.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# ADComputeEigenstrain | ||
|
||
!syntax description /Materials/ADComputeEigenstrain<RESIDUAL> | ||
|
||
## Description | ||
|
||
The class `ADComputeEigenstrain` allows the user to specify a constant value of an eigenstrain for a simulation. | ||
The eigenstrain is added to the mechanical strain, which can be elastic or inelastic, before computing the corresponding stress measure: | ||
\begin{equation} | ||
\epsilon_{ij}^{total} = \epsilon_{ij}^{mechanical} + \epsilon_{ij}^{eigenstrain} | ||
\end{equation} | ||
|
||
Eigenstrain is the term given to a strain which does not result directly from an applied force. | ||
Chapter 3 of [cite!qu2006fundamentals] describes the relationship between total, elastic, and eigen- strains and provides examples using thermal expansion and dislocations. | ||
Eigenstrains are also referred to as residual strains, stress-free strains, or intrinsic strains; translated from German, [Eigen](http://dict.tu-chemnitz.de/deutsch-englisch/Eigen....html) means own or intrinsic in English. | ||
The term eigenstrain was introduced by [cite!mura1982general]. | ||
|
||
Based on the number and values of constants provided as the argument to the `eigen_base` parameter, `ADComputeEigenstrain` will build an isotropic, symmetric, or skew-symmetric Rank-2 eigenstrain tensor. | ||
|
||
## Example Input File Syntax | ||
|
||
!listing modules/tensor_mechanics/test/tests/visco/gen_kv_driving.i block=Materials/eigen | ||
|
||
!syntax parameters /Materials/ADComputeEigenstrain<RESIDUAL> | ||
|
||
!syntax inputs /Materials/ADComputeEigenstrain<RESIDUAL> | ||
|
||
!syntax children /Materials/ADComputeEigenstrain<RESIDUAL> | ||
|
||
!bibtex bibliography |
42 changes: 42 additions & 0 deletions
42
modules/tensor_mechanics/include/materials/ADComputeEigenstrain.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#ifndef ADADCOMPUTEEIGENSTRAIN_H | ||
#define ADADCOMPUTEEIGENSTRAIN_H | ||
|
||
#include "ADComputeEigenstrainBase.h" | ||
|
||
#define usingADComputeEigenstrainMembers usingADComputeEigenstrainBaseMembers | ||
|
||
template <ComputeStage> | ||
class ADComputeEigenstrain; | ||
|
||
declareADValidParams(ADComputeEigenstrain); | ||
|
||
/** | ||
* ComputeEigenstrain computes an Eigenstrain that is a function of a single variable defined by a | ||
* base tensor and a scalar function defined in a Derivative Material. | ||
*/ | ||
template <ComputeStage compute_stage> | ||
class ADComputeEigenstrain : public ADComputeEigenstrainBase<compute_stage> | ||
{ | ||
public: | ||
ADComputeEigenstrain(const InputParameters & parameters); | ||
|
||
protected: | ||
virtual void computeQpEigenstrain() override; | ||
|
||
const ADMaterialProperty(Real) & _prefactor; | ||
|
||
RankTwoTensor _eigen_base_tensor; | ||
|
||
usingADComputeEigenstrainBaseMembers; | ||
}; | ||
|
||
#endif // ADADCOMPUTEEIGENSTRAIN_H |
72 changes: 72 additions & 0 deletions
72
modules/tensor_mechanics/include/materials/ADComputeEigenstrainBase.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#ifndef ADADCOMPUTEEIGENSTRAINBASE_H | ||
#define ADADCOMPUTEEIGENSTRAINBASE_H | ||
|
||
#include "ADMaterial.h" | ||
|
||
#define usingADComputeEigenstrainBaseMembers \ | ||
usingMaterialMembers; \ | ||
using ADComputeEigenstrainBase<compute_stage>::_eigenstrain | ||
|
||
// Forward Declarations | ||
template <ComputeStage> | ||
class ADComputeEigenstrainBase; | ||
|
||
template <typename> | ||
class RankTwoTensorTempl; | ||
|
||
typedef RankTwoTensorTempl<Real> RankTwoTensor; | ||
typedef RankTwoTensorTempl<DualReal> DualRankTwoTensor; | ||
|
||
declareADValidParams(ADComputeEigenstrainBase); | ||
|
||
/** | ||
* ADComputeEigenstrainBase is the base class for eigenstrain tensors | ||
*/ | ||
template <ComputeStage compute_stage> | ||
class ADComputeEigenstrainBase : public ADMaterial<compute_stage> | ||
{ | ||
public: | ||
ADComputeEigenstrainBase(const InputParameters & parameters); | ||
|
||
protected: | ||
virtual void initQpStatefulProperties() override; | ||
virtual void computeQpProperties() override; | ||
|
||
///Compute the eigenstrain and store in _eigenstrain | ||
virtual void computeQpEigenstrain() = 0; | ||
|
||
///Base name prepended to material property name | ||
std::string _base_name; | ||
|
||
///Material property name for the eigenstrain tensor | ||
std::string _eigenstrain_name; | ||
|
||
///Stores the current total eigenstrain | ||
ADMaterialProperty(RankTwoTensor) & _eigenstrain; | ||
|
||
/** | ||
* Helper function for models that compute the eigenstrain based on a volumetric | ||
* strain. This function computes the diagonal components of the eigenstrain tensor | ||
* as logarithmic strains. | ||
* @param volumetric_strain The current volumetric strain to be applied | ||
* @return Current strain in one direction due to volumetric strain, expressed as a logarithmic | ||
* strain | ||
*/ | ||
ADReal computeVolumetricStrainComponent(const ADReal volumetric_strain) const; | ||
|
||
/// Restartable data to check for the zeroth and first time steps for thermal calculations | ||
bool & _step_zero; | ||
|
||
usingMaterialMembers; | ||
}; | ||
|
||
#endif // ADADCOMPUTEEIGENSTRAINBASE_H |
39 changes: 39 additions & 0 deletions
39
modules/tensor_mechanics/src/materials/ADComputeEigenstrain.C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#include "ADComputeEigenstrain.h" | ||
|
||
#include "RankTwoTensor.h" | ||
|
||
registerADMooseObject("TensorMechanicsApp", ADComputeEigenstrain); | ||
|
||
defineADValidParams(ADComputeEigenstrain, | ||
ADComputeEigenstrainBase, | ||
params.addClassDescription("Computes a constant Eigenstrain"); | ||
params.addRequiredParam<std::vector<Real>>( | ||
"eigen_base", | ||
"Vector of values defining the constant base tensor for the Eigenstrain"); | ||
params.addParam<MaterialPropertyName>( | ||
"prefactor", 1.0, "Name of material defining the variable dependence");); | ||
|
||
template <ComputeStage compute_stage> | ||
ADComputeEigenstrain<compute_stage>::ADComputeEigenstrain(const InputParameters & parameters) | ||
: ADComputeEigenstrainBase<compute_stage>(parameters), | ||
_prefactor(adGetADMaterialProperty<Real>("prefactor")) | ||
{ | ||
_eigen_base_tensor.fillFromInputVector(adGetParam<std::vector<Real>>("eigen_base")); | ||
} | ||
|
||
template <ComputeStage compute_stage> | ||
void | ||
ADComputeEigenstrain<compute_stage>::computeQpEigenstrain() | ||
{ | ||
// Define Eigenstrain | ||
_eigenstrain[_qp] = _eigen_base_tensor * _prefactor[_qp]; | ||
} |
86 changes: 86 additions & 0 deletions
86
modules/tensor_mechanics/src/materials/ADComputeEigenstrainBase.C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#include "ADComputeEigenstrainBase.h" | ||
|
||
#include "RankTwoTensor.h" | ||
|
||
defineADValidParams( | ||
ADComputeEigenstrainBase, | ||
ADMaterial, | ||
params.addParam<std::string>("base_name", | ||
"Optional parameter that allows the user to define " | ||
"multiple mechanics material systems on the same " | ||
"block, i.e. for multiple phases"); | ||
params.addRequiredParam<std::string>( | ||
"eigenstrain_name", | ||
"Material property name for the eigenstrain tensor computed " | ||
"by this model. IMPORTANT: The name of this property must " | ||
"also be provided to the strain calculator."); | ||
params.addDeprecatedParam<bool>( | ||
"incremental_form", | ||
false, | ||
"Should the eigenstrain be in incremental form (for incremental models)?", | ||
"This parameter no longer has any effect. Simply remove it.");); | ||
|
||
template <ComputeStage compute_stage> | ||
ADComputeEigenstrainBase<compute_stage>::ADComputeEigenstrainBase( | ||
const InputParameters & parameters) | ||
: ADMaterial<compute_stage>(parameters), | ||
_base_name(isParamValid("base_name") ? adGetParam<std::string>("base_name") + "_" : ""), | ||
_eigenstrain_name(_base_name + adGetParam<std::string>("eigenstrain_name")), | ||
_eigenstrain(adDeclareADProperty<RankTwoTensor>(_eigenstrain_name)), | ||
_step_zero(adDeclareRestartableData<bool>("step_zero", true)) | ||
{ | ||
} | ||
|
||
template <ComputeStage compute_stage> | ||
void | ||
ADComputeEigenstrainBase<compute_stage>::initQpStatefulProperties() | ||
{ | ||
// This property can be promoted to be stateful by other models that use it, | ||
// so it needs to be initalized. | ||
_eigenstrain[_qp].zero(); | ||
} | ||
|
||
template <ComputeStage compute_stage> | ||
void | ||
ADComputeEigenstrainBase<compute_stage>::computeQpProperties() | ||
{ | ||
if (_t_step >= 1) | ||
_step_zero = false; | ||
|
||
// Skip the eigenstrain calculation in step zero because no solution is computed during | ||
// the zeroth step, hence computing the eigenstrain in the zeroth step would result in | ||
// an incorrect calculation of mechanical_strain, which is stateful. | ||
if (!_step_zero) | ||
computeQpEigenstrain(); | ||
} | ||
|
||
template <ComputeStage compute_stage> | ||
ADReal | ||
ADComputeEigenstrainBase<compute_stage>::computeVolumetricStrainComponent( | ||
const ADReal volumetric_strain) const | ||
{ | ||
// The engineering strain in a given direction is: | ||
// epsilon_eng = cbrt(volumetric_strain + 1.0) - 1.0 | ||
// | ||
// We need to provide this as a logarithmic strain to be consistent with the strain measure | ||
// used for finite strain: | ||
// epsilon_log = log(1.0 + epsilon_eng) | ||
// | ||
// This can be simplified down to a more direct form: | ||
// epsilon_log = log(cbrt(volumetric_strain + 1.0)) | ||
// or: | ||
// epsilon_log = (1/3) log(volumetric_strain + 1.0) | ||
|
||
return std::log(volumetric_strain + 1.0) / 3.0; | ||
} | ||
|
||
adBaseClass(ADComputeEigenstrainBase); |
Oops, something went wrong.