www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
ComputeReducedOrderEigenstrain Class Reference

#include <ComputeReducedOrderEigenstrain.h>

Inheritance diagram for ComputeReducedOrderEigenstrain:
[legend]

Public Member Functions

 ComputeReducedOrderEigenstrain (const InputParameters &parameters)
 
void initQpStatefulProperties ()
 
void computeProperties ()
 
void computeQpEigenstrain ()
 Compute the eigenstrain and store in _eigenstrain. More...
 

Protected Member Functions

virtual void computeQpProperties ()
 
Real computeVolumetricStrainComponent (const Real volumetric_strain) const
 Helper function for models that compute the eigenstrain based on a volumetric strain. More...
 

Protected Attributes

std::string _base_name
 Base name prepended to material property name. More...
 
std::string _eigenstrain_name
 Material property name for the eigenstrain tensor. More...
 
bool _incremental_form
 Whether the eigenstrain model should compute the total or incremental eigenstrain. More...
 
MaterialProperty< RankTwoTensor > & _eigenstrain
 Stores the current total eigenstrain. More...
 
const MaterialProperty< RankTwoTensor > * _eigenstrain_old
 Stores the total eigenstrain in the previous step (only for incremental form) More...
 
bool & _step_zero
 Restartable data to check for the zeroth and first time steps for thermal calculations. More...
 

Private Member Functions

void applyEigenstrain (MaterialProperty< RankTwoTensor > &strain)
 Subtract adjusted eigenstrain from strain. More...
 
void sumEigenstrain ()
 Add contributions from every eigenstrain at each integration point. More...
 
void prepareEigenstrain ()
 Compute either the volume average or linear eigenstrain field in an element. More...
 

Private Attributes

std::vector< MaterialPropertyName > _input_eigenstrain_names
 
std::vector< const MaterialProperty< RankTwoTensor > * > _eigenstrains
 
std::vector< const MaterialProperty< RankTwoTensor > * > _eigenstrains_old
 
SubProblem & _subproblem
 
const unsigned _ncols
 Number of columns in A matrix (1 plus mesh dimension) More...
 
const bool _second_order
 Whether the mesh is made of second order elements. More...
 
std::vector< RankTwoTensor > _eigsum
 The sum of all eigenstrains at each integration point. More...
 
DenseMatrix< Real > _A
 The (num q points x ncols) array for the least squares. Holds 1, xcoor, ycoor, zcoor. More...
 
std::vector< DenseVector< Real > > _b
 The b array holding the unique eigenstrain components for each integration point. More...
 
DenseMatrix< Real > _AT
 Transpose of A. More...
 
DenseVector< Real > _ATb
 Transpose of A times b. More...
 
std::vector< DenseVector< Real > > _x
 The solution vector for each unique component of the adjusted eigenstrain. More...
 
std::vector< Real > _vals
 Vector to hold the adjusted strain as computed with _x. More...
 
RankTwoTensor _adjusted_eigenstrain
 Filled with _vals and subracted from strain. More...
 

Detailed Description

Definition at line 20 of file ComputeReducedOrderEigenstrain.h.

Constructor & Destructor Documentation

ComputeReducedOrderEigenstrain::ComputeReducedOrderEigenstrain ( const InputParameters &  parameters)

Definition at line 23 of file ComputeReducedOrderEigenstrain.C.

24  : ComputeEigenstrainBase(parameters),
26  getParam<std::vector<MaterialPropertyName>>("input_eigenstrain_names")),
29  _subproblem(*parameters.get<SubProblem *>("_subproblem")),
30  _ncols(1 + _subproblem.mesh().dimension()),
31  _second_order(_subproblem.mesh().hasSecondOrderElements()),
32  _eigsum(),
33  _A(),
34  _b(6),
35  _AT(),
36  _ATb(_ncols),
37  _x(6, DenseVector<Real>(_ncols)),
38  _vals(6),
40 {
41  for (unsigned int i = 0; i < _eigenstrains.size(); ++i)
42  {
44  _eigenstrains[i] = &getMaterialProperty<RankTwoTensor>(_input_eigenstrain_names[i]);
46  _eigenstrains_old[i] = &getMaterialPropertyOld<RankTwoTensor>(_input_eigenstrain_names[i]);
47  }
48 }
std::vector< RankTwoTensor > _eigsum
The sum of all eigenstrains at each integration point.
std::vector< const MaterialProperty< RankTwoTensor > * > _eigenstrains_old
RankTwoTensor _adjusted_eigenstrain
Filled with _vals and subracted from strain.
const unsigned _ncols
Number of columns in A matrix (1 plus mesh dimension)
std::vector< DenseVector< Real > > _b
The b array holding the unique eigenstrain components for each integration point. ...
DenseMatrix< Real > _A
The (num q points x ncols) array for the least squares. Holds 1, xcoor, ycoor, zcoor.
std::string _base_name
Base name prepended to material property name.
DenseVector< Real > _ATb
Transpose of A times b.
const bool _second_order
Whether the mesh is made of second order elements.
std::vector< const MaterialProperty< RankTwoTensor > * > _eigenstrains
std::vector< DenseVector< Real > > _x
The solution vector for each unique component of the adjusted eigenstrain.
ComputeEigenstrainBase(const InputParameters &parameters)
DenseMatrix< Real > _AT
Transpose of A.
bool _incremental_form
Whether the eigenstrain model should compute the total or incremental eigenstrain.
std::vector< Real > _vals
Vector to hold the adjusted strain as computed with _x.
std::vector< MaterialPropertyName > _input_eigenstrain_names

Member Function Documentation

void ComputeReducedOrderEigenstrain::applyEigenstrain ( MaterialProperty< RankTwoTensor > &  strain)
private

Subtract adjusted eigenstrain from strain.

void ComputeReducedOrderEigenstrain::computeProperties ( )

Definition at line 57 of file ComputeReducedOrderEigenstrain.C.

58 {
60 
62 
63  Material::computeProperties();
64 }
void prepareEigenstrain()
Compute either the volume average or linear eigenstrain field in an element.
void sumEigenstrain()
Add contributions from every eigenstrain at each integration point.
void ComputeReducedOrderEigenstrain::computeQpEigenstrain ( )
virtual

Compute the eigenstrain and store in _eigenstrain.

Implements ComputeEigenstrainBase.

Definition at line 67 of file ComputeReducedOrderEigenstrain.C.

68 {
69  if (_second_order)
70  {
71  for (unsigned i = 0; i < 6; ++i)
72  {
73  _vals[i] = _x[i](0);
74  for (unsigned j = 1; j < _ncols; ++j)
75  _vals[i] += _x[i](j) * _q_point[_qp](j - 1);
76  }
77  _adjusted_eigenstrain.fillFromInputVector(_vals);
78  }
80 }
RankTwoTensor _adjusted_eigenstrain
Filled with _vals and subracted from strain.
const unsigned _ncols
Number of columns in A matrix (1 plus mesh dimension)
MaterialProperty< RankTwoTensor > & _eigenstrain
Stores the current total eigenstrain.
const bool _second_order
Whether the mesh is made of second order elements.
std::vector< DenseVector< Real > > _x
The solution vector for each unique component of the adjusted eigenstrain.
std::vector< Real > _vals
Vector to hold the adjusted strain as computed with _x.
void ComputeEigenstrainBase::computeQpProperties ( )
protectedvirtualinherited

Definition at line 50 of file ComputeEigenstrainBase.C.

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 }
virtual void computeQpEigenstrain()=0
Compute the eigenstrain and store in _eigenstrain.
bool & _step_zero
Restartable data to check for the zeroth and first time steps for thermal calculations.
Real ComputeEigenstrainBase::computeVolumetricStrainComponent ( const Real  volumetric_strain) const
protectedinherited

Helper function for models that compute the eigenstrain based on a volumetric strain.

This function computes the diagonal components of the eigenstrain tensor. param volumetric_strain The current volumetric strain to be applied

Definition at line 63 of file ComputeEigenstrainBase.C.

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 }
void ComputeReducedOrderEigenstrain::initQpStatefulProperties ( )
virtual

Reimplemented from ComputeEigenstrainBase.

Definition at line 51 of file ComputeReducedOrderEigenstrain.C.

52 {
53  _eigenstrain[_qp].zero();
54 }
MaterialProperty< RankTwoTensor > & _eigenstrain
Stores the current total eigenstrain.
void ComputeReducedOrderEigenstrain::prepareEigenstrain ( )
private

Compute either the volume average or linear eigenstrain field in an element.

Definition at line 95 of file ComputeReducedOrderEigenstrain.C.

Referenced by computeProperties().

96 {
97  // The eigenstrains can either be constant in an element or linear in x, y, z
98  // If constant, do volume averaging.
99  if (!_second_order || _qrule->n_points() == 1)
100  {
101  // Volume average
102  _adjusted_eigenstrain.zero();
103  Real vol = 0.0;
104  for (unsigned qp = 0; qp < _qrule->n_points(); ++qp)
105  {
106  _adjusted_eigenstrain += _eigsum[qp] * _JxW[qp] * _coord[qp];
107  vol += _JxW[qp] * _coord[qp];
108  }
109  _adjusted_eigenstrain /= vol;
110  }
111  else
112  {
113  // 1 x y z
114 
115  // Six sets (one for each unique component of eigen) of qp data
116  _A.resize(_qrule->n_points(), _ncols);
117  for (auto && b : _b)
118  b.resize(_qrule->n_points());
119 
120  for (unsigned qp = 0; qp < _qrule->n_points(); ++qp)
121  {
122  _A(qp, 0) = 1.0;
123  for (unsigned j = 1; j < _ncols; ++j)
124  _A(qp, j) = _q_point[qp](j - 1);
125 
126  _b[0](qp) = _eigsum[qp](0, 0);
127  _b[1](qp) = _eigsum[qp](1, 1);
128  _b[2](qp) = _eigsum[qp](2, 2);
129  _b[3](qp) = _eigsum[qp](1, 2);
130  _b[4](qp) = _eigsum[qp](0, 2);
131  _b[5](qp) = _eigsum[qp](0, 1);
132  }
133 
134  _A.get_transpose(_AT);
135  _A.left_multiply(_AT);
136  for (unsigned i = 0; i < 6; ++i)
137  {
138  _AT.vector_mult(_ATb, _b[i]);
139 
140  _A.cholesky_solve(_ATb, _x[i]);
141  }
142  }
143 }
std::vector< RankTwoTensor > _eigsum
The sum of all eigenstrains at each integration point.
RankTwoTensor _adjusted_eigenstrain
Filled with _vals and subracted from strain.
const unsigned _ncols
Number of columns in A matrix (1 plus mesh dimension)
std::vector< DenseVector< Real > > _b
The b array holding the unique eigenstrain components for each integration point. ...
DenseMatrix< Real > _A
The (num q points x ncols) array for the least squares. Holds 1, xcoor, ycoor, zcoor.
DenseVector< Real > _ATb
Transpose of A times b.
const bool _second_order
Whether the mesh is made of second order elements.
std::vector< DenseVector< Real > > _x
The solution vector for each unique component of the adjusted eigenstrain.
DenseMatrix< Real > _AT
Transpose of A.
void ComputeReducedOrderEigenstrain::sumEigenstrain ( )
private

Add contributions from every eigenstrain at each integration point.

Definition at line 83 of file ComputeReducedOrderEigenstrain.C.

Referenced by computeProperties().

84 {
85  _eigsum.resize(_qrule->n_points());
86  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
87  {
88  _eigsum[_qp].zero();
89  for (auto es : _eigenstrains)
90  _eigsum[_qp] += (*es)[_qp];
91  }
92 }
std::vector< RankTwoTensor > _eigsum
The sum of all eigenstrains at each integration point.
std::vector< const MaterialProperty< RankTwoTensor > * > _eigenstrains

Member Data Documentation

DenseMatrix<Real> ComputeReducedOrderEigenstrain::_A
private

The (num q points x ncols) array for the least squares. Holds 1, xcoor, ycoor, zcoor.

Definition at line 51 of file ComputeReducedOrderEigenstrain.h.

Referenced by prepareEigenstrain().

RankTwoTensor ComputeReducedOrderEigenstrain::_adjusted_eigenstrain
private

Filled with _vals and subracted from strain.

Definition at line 63 of file ComputeReducedOrderEigenstrain.h.

Referenced by computeQpEigenstrain(), and prepareEigenstrain().

DenseMatrix<Real> ComputeReducedOrderEigenstrain::_AT
private

Transpose of A.

Definition at line 55 of file ComputeReducedOrderEigenstrain.h.

Referenced by prepareEigenstrain().

DenseVector<Real> ComputeReducedOrderEigenstrain::_ATb
private

Transpose of A times b.

Definition at line 57 of file ComputeReducedOrderEigenstrain.h.

Referenced by prepareEigenstrain().

std::vector<DenseVector<Real> > ComputeReducedOrderEigenstrain::_b
private

The b array holding the unique eigenstrain components for each integration point.

Definition at line 53 of file ComputeReducedOrderEigenstrain.h.

Referenced by prepareEigenstrain().

std::string ComputeEigenstrainBase::_base_name
protectedinherited

Base name prepended to material property name.

Definition at line 30 of file ComputeEigenstrainBase.h.

Referenced by ComputeReducedOrderEigenstrain().

MaterialProperty<RankTwoTensor>& ComputeEigenstrainBase::_eigenstrain
protectedinherited
std::string ComputeEigenstrainBase::_eigenstrain_name
protectedinherited

Material property name for the eigenstrain tensor.

Definition at line 33 of file ComputeEigenstrainBase.h.

const MaterialProperty<RankTwoTensor>* ComputeEigenstrainBase::_eigenstrain_old
protectedinherited

Stores the total eigenstrain in the previous step (only for incremental form)

Definition at line 42 of file ComputeEigenstrainBase.h.

std::vector<const MaterialProperty<RankTwoTensor> *> ComputeReducedOrderEigenstrain::_eigenstrains
private
std::vector<const MaterialProperty<RankTwoTensor> *> ComputeReducedOrderEigenstrain::_eigenstrains_old
private

Definition at line 41 of file ComputeReducedOrderEigenstrain.h.

Referenced by ComputeReducedOrderEigenstrain().

std::vector<RankTwoTensor> ComputeReducedOrderEigenstrain::_eigsum
private

The sum of all eigenstrains at each integration point.

Definition at line 49 of file ComputeReducedOrderEigenstrain.h.

Referenced by prepareEigenstrain(), and sumEigenstrain().

bool ComputeEigenstrainBase::_incremental_form
protectedinherited

Whether the eigenstrain model should compute the total or incremental eigenstrain.

Definition at line 36 of file ComputeEigenstrainBase.h.

Referenced by ComputeEigenstrainFromInitialStress::ComputeEigenstrainFromInitialStress(), ComputeReducedOrderEigenstrain(), and ComputeEigenstrainBase::initQpStatefulProperties().

std::vector<MaterialPropertyName> ComputeReducedOrderEigenstrain::_input_eigenstrain_names
private

Definition at line 39 of file ComputeReducedOrderEigenstrain.h.

Referenced by ComputeReducedOrderEigenstrain().

const unsigned ComputeReducedOrderEigenstrain::_ncols
private

Number of columns in A matrix (1 plus mesh dimension)

Definition at line 45 of file ComputeReducedOrderEigenstrain.h.

Referenced by computeQpEigenstrain(), and prepareEigenstrain().

const bool ComputeReducedOrderEigenstrain::_second_order
private

Whether the mesh is made of second order elements.

Definition at line 47 of file ComputeReducedOrderEigenstrain.h.

Referenced by computeQpEigenstrain(), and prepareEigenstrain().

bool& ComputeEigenstrainBase::_step_zero
protectedinherited

Restartable data to check for the zeroth and first time steps for thermal calculations.

Definition at line 52 of file ComputeEigenstrainBase.h.

Referenced by ComputeEigenstrainBase::computeQpProperties().

SubProblem& ComputeReducedOrderEigenstrain::_subproblem
private

Definition at line 43 of file ComputeReducedOrderEigenstrain.h.

std::vector<Real> ComputeReducedOrderEigenstrain::_vals
private

Vector to hold the adjusted strain as computed with _x.

Definition at line 61 of file ComputeReducedOrderEigenstrain.h.

Referenced by computeQpEigenstrain().

std::vector<DenseVector<Real> > ComputeReducedOrderEigenstrain::_x
private

The solution vector for each unique component of the adjusted eigenstrain.

Definition at line 59 of file ComputeReducedOrderEigenstrain.h.

Referenced by computeQpEigenstrain(), and prepareEigenstrain().


The documentation for this class was generated from the following files: