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...
 
MaterialProperty< RankTwoTensor > & _eigenstrain
 Stores the current total eigenstrain. 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
 
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 27 of file ComputeReducedOrderEigenstrain.h.

Constructor & Destructor Documentation

◆ ComputeReducedOrderEigenstrain()

ComputeReducedOrderEigenstrain::ComputeReducedOrderEigenstrain ( const InputParameters &  parameters)

Definition at line 29 of file ComputeReducedOrderEigenstrain.C.

30  : ComputeEigenstrainBase(parameters),
32  getParam<std::vector<MaterialPropertyName>>("input_eigenstrain_names")),
34  _subproblem(*parameters.get<SubProblem *>("_subproblem")),
35  _ncols(1 + _subproblem.mesh().dimension()),
36  _second_order(_subproblem.mesh().hasSecondOrderElements()),
37  _eigsum(),
38  _A(),
39  _b(6),
40  _AT(),
41  _ATb(_ncols),
42  _x(6, DenseVector<Real>(_ncols)),
43  _vals(6),
45 {
46  for (unsigned int i = 0; i < _eigenstrains.size(); ++i)
47  {
49  _eigenstrains[i] = &getMaterialProperty<RankTwoTensor>(_input_eigenstrain_names[i]);
50  }
51 }
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.
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.
std::vector< Real > _vals
Vector to hold the adjusted strain as computed with _x.
std::vector< MaterialPropertyName > _input_eigenstrain_names

Member Function Documentation

◆ applyEigenstrain()

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

Subtract adjusted eigenstrain from strain.

◆ computeProperties()

void ComputeReducedOrderEigenstrain::computeProperties ( )

Definition at line 60 of file ComputeReducedOrderEigenstrain.C.

61 {
63 
65 
66  Material::computeProperties();
67 }
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.

◆ computeQpEigenstrain()

void ComputeReducedOrderEigenstrain::computeQpEigenstrain ( )
virtual

Compute the eigenstrain and store in _eigenstrain.

Implements ComputeEigenstrainBase.

Definition at line 70 of file ComputeReducedOrderEigenstrain.C.

71 {
72  if (_second_order)
73  {
74  for (unsigned i = 0; i < 6; ++i)
75  {
76  _vals[i] = _x[i](0);
77  for (unsigned j = 1; j < _ncols; ++j)
78  _vals[i] += _x[i](j) * _q_point[_qp](j - 1);
79  }
80  _adjusted_eigenstrain.fillFromInputVector(_vals);
81  }
83 }
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.

◆ computeQpProperties()

void ComputeEigenstrainBase::computeQpProperties ( )
protectedvirtualinherited

Definition at line 53 of file ComputeEigenstrainBase.C.

54 {
55  if (_t_step >= 1)
56  _step_zero = false;
57 
58  // Skip the eigenstrain calculation in step zero because no solution is computed during
59  // the zeroth step, hence computing the eigenstrain in the zeroth step would result in
60  // an incorrect calculation of mechanical_strain, which is stateful.
61  if (!_step_zero)
63 }
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.

◆ computeVolumetricStrainComponent()

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 as logarithmic strains.

Parameters
volumetric_strainThe current volumetric strain to be applied
Returns
Current strain in one direction due to volumetric strain, expressed as a logarithmic strain

Definition at line 66 of file ComputeEigenstrainBase.C.

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 }

◆ initQpStatefulProperties()

void ComputeReducedOrderEigenstrain::initQpStatefulProperties ( )
virtual

Reimplemented from ComputeEigenstrainBase.

Definition at line 54 of file ComputeReducedOrderEigenstrain.C.

55 {
56  _eigenstrain[_qp].zero();
57 }
MaterialProperty< RankTwoTensor > & _eigenstrain
Stores the current total eigenstrain.

◆ prepareEigenstrain()

void ComputeReducedOrderEigenstrain::prepareEigenstrain ( )
private

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

Definition at line 98 of file ComputeReducedOrderEigenstrain.C.

Referenced by computeProperties().

99 {
100  // The eigenstrains can either be constant in an element or linear in x, y, z
101  // If constant, do volume averaging.
102  if (!_second_order || _qrule->n_points() == 1)
103  {
104  // Volume average
105  _adjusted_eigenstrain.zero();
106  Real vol = 0.0;
107  for (unsigned qp = 0; qp < _qrule->n_points(); ++qp)
108  {
109  _adjusted_eigenstrain += _eigsum[qp] * _JxW[qp] * _coord[qp];
110  vol += _JxW[qp] * _coord[qp];
111  }
112  _adjusted_eigenstrain /= vol;
113  }
114  else
115  {
116  // 1 x y z
117 
118  // Six sets (one for each unique component of eigen) of qp data
119  _A.resize(_qrule->n_points(), _ncols);
120  for (auto && b : _b)
121  b.resize(_qrule->n_points());
122 
123  for (unsigned qp = 0; qp < _qrule->n_points(); ++qp)
124  {
125  _A(qp, 0) = 1.0;
126  for (unsigned j = 1; j < _ncols; ++j)
127  _A(qp, j) = _q_point[qp](j - 1);
128 
129  _b[0](qp) = _eigsum[qp](0, 0);
130  _b[1](qp) = _eigsum[qp](1, 1);
131  _b[2](qp) = _eigsum[qp](2, 2);
132  _b[3](qp) = _eigsum[qp](1, 2);
133  _b[4](qp) = _eigsum[qp](0, 2);
134  _b[5](qp) = _eigsum[qp](0, 1);
135  }
136 
137  _A.get_transpose(_AT);
138  _A.left_multiply(_AT);
139  for (unsigned i = 0; i < 6; ++i)
140  {
141  _AT.vector_mult(_ATb, _b[i]);
142 
143  _A.cholesky_solve(_ATb, _x[i]);
144  }
145  }
146 }
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.

◆ sumEigenstrain()

void ComputeReducedOrderEigenstrain::sumEigenstrain ( )
private

Add contributions from every eigenstrain at each integration point.

Definition at line 86 of file ComputeReducedOrderEigenstrain.C.

Referenced by computeProperties().

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

Member Data Documentation

◆ _A

DenseMatrix<Real> ComputeReducedOrderEigenstrain::_A
private

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

Definition at line 57 of file ComputeReducedOrderEigenstrain.h.

Referenced by prepareEigenstrain().

◆ _adjusted_eigenstrain

RankTwoTensor ComputeReducedOrderEigenstrain::_adjusted_eigenstrain
private

Filled with _vals and subracted from strain.

Definition at line 69 of file ComputeReducedOrderEigenstrain.h.

Referenced by computeQpEigenstrain(), and prepareEigenstrain().

◆ _AT

DenseMatrix<Real> ComputeReducedOrderEigenstrain::_AT
private

Transpose of A.

Definition at line 61 of file ComputeReducedOrderEigenstrain.h.

Referenced by prepareEigenstrain().

◆ _ATb

DenseVector<Real> ComputeReducedOrderEigenstrain::_ATb
private

Transpose of A times b.

Definition at line 63 of file ComputeReducedOrderEigenstrain.h.

Referenced by prepareEigenstrain().

◆ _b

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

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

Definition at line 59 of file ComputeReducedOrderEigenstrain.h.

Referenced by prepareEigenstrain().

◆ _base_name

std::string ComputeEigenstrainBase::_base_name
protectedinherited

Base name prepended to material property name.

Definition at line 38 of file ComputeEigenstrainBase.h.

Referenced by ComputeReducedOrderEigenstrain().

◆ _eigenstrain

MaterialProperty<RankTwoTensor>& ComputeEigenstrainBase::_eigenstrain
protectedinherited

◆ _eigenstrain_name

std::string ComputeEigenstrainBase::_eigenstrain_name
protectedinherited

Material property name for the eigenstrain tensor.

Definition at line 41 of file ComputeEigenstrainBase.h.

◆ _eigenstrains

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

◆ _eigsum

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

The sum of all eigenstrains at each integration point.

Definition at line 55 of file ComputeReducedOrderEigenstrain.h.

Referenced by prepareEigenstrain(), and sumEigenstrain().

◆ _input_eigenstrain_names

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

Definition at line 46 of file ComputeReducedOrderEigenstrain.h.

Referenced by ComputeReducedOrderEigenstrain().

◆ _ncols

const unsigned ComputeReducedOrderEigenstrain::_ncols
private

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

Definition at line 51 of file ComputeReducedOrderEigenstrain.h.

Referenced by computeQpEigenstrain(), and prepareEigenstrain().

◆ _second_order

const bool ComputeReducedOrderEigenstrain::_second_order
private

Whether the mesh is made of second order elements.

Definition at line 53 of file ComputeReducedOrderEigenstrain.h.

Referenced by computeQpEigenstrain(), and prepareEigenstrain().

◆ _step_zero

bool& ComputeEigenstrainBase::_step_zero
protectedinherited

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

Definition at line 57 of file ComputeEigenstrainBase.h.

Referenced by ComputeEigenstrainBase::computeQpProperties().

◆ _subproblem

SubProblem& ComputeReducedOrderEigenstrain::_subproblem
private

Definition at line 49 of file ComputeReducedOrderEigenstrain.h.

◆ _vals

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

Vector to hold the adjusted strain as computed with _x.

Definition at line 67 of file ComputeReducedOrderEigenstrain.h.

Referenced by computeQpEigenstrain().

◆ _x

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

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

Definition at line 65 of file ComputeReducedOrderEigenstrain.h.

Referenced by computeQpEigenstrain(), and prepareEigenstrain().


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