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

SwitchingFunctionMultiPhaseMaterial is a switching function for a multi-phase, multi-order parameter system. More...

#include <SwitchingFunctionMultiPhaseMaterial.h>

Inheritance diagram for SwitchingFunctionMultiPhaseMaterial:
[legend]

Public Member Functions

 SwitchingFunctionMultiPhaseMaterial (const InputParameters &parameters)
 

Protected Member Functions

virtual void computeQpProperties ()
 

Protected Attributes

MaterialPropertyName _h_name
 Name of the function. More...
 
unsigned int _num_eta_p
 Order parameters for phase alpha. More...
 
std::vector< const VariableValue * > _eta_p
 
std::vector< VariableName > _eta_p_names
 
unsigned int _num_eta
 Order parameters for all phases (including alpha) More...
 
std::vector< const VariableValue * > _eta
 
std::vector< VariableName > _eta_names
 
std::vector< bool > _is_p
 List of which order parameters in the full list of all etas belong to phase p. More...
 
MaterialProperty< Real > & _prop_h
 Switching function and derivatives. More...
 
std::vector< MaterialProperty< Real > * > _prop_dh
 
std::vector< std::vector< MaterialProperty< Real > * > > _prop_d2h
 

Detailed Description

SwitchingFunctionMultiPhaseMaterial is a switching function for a multi-phase, multi-order parameter system.

Defined by Moelans, Acta Mat., v 59, p.1077-1086 (2011). For phase alpha, the switching function is \( h_\alpha = (sum_i \eta_{\alpha i}^2) / (sum_\rho sum_i \eta_{\rho i}^2) \) for phase alpha, where \( i \) indexes grains of a phase and \( rho \) indexes phases

Definition at line 29 of file SwitchingFunctionMultiPhaseMaterial.h.

Constructor & Destructor Documentation

◆ SwitchingFunctionMultiPhaseMaterial()

SwitchingFunctionMultiPhaseMaterial::SwitchingFunctionMultiPhaseMaterial ( const InputParameters &  parameters)

Definition at line 28 of file SwitchingFunctionMultiPhaseMaterial.C.

30  : DerivativeMaterialInterface<Material>(parameters),
31  _h_name(getParam<MaterialPropertyName>("h_name")),
32  _num_eta_p(coupledComponents("phase_etas")),
35  _num_eta(coupledComponents("all_etas")),
36  _eta(_num_eta),
38  _is_p(_num_eta),
39  _prop_h(declareProperty<Real>(_h_name)),
42 {
43  // Fetch eta values and names for phase etas
44  for (unsigned int i = 0; i < _num_eta_p; ++i)
45  {
46  _eta_p[i] = &coupledValue("phase_etas", i);
47  _eta_p_names[i] = getVar("phase_etas", i)->name();
48  }
49 
50  // Declare h derivative properties, fetch eta values for all eta
51  for (unsigned int i = 0; i < _num_eta; ++i)
52  {
53  _prop_d2h[i].resize(_num_eta);
54  _eta_names[i] = getVar("all_etas", i)->name();
55  }
56 
57  for (unsigned int i = 0; i < _num_eta; ++i)
58  {
59  _prop_dh[i] = &declarePropertyDerivative<Real>(_h_name, _eta_names[i]);
60  _eta[i] = &coupledValue("all_etas", i);
61  for (unsigned int j = i; j < _num_eta; ++j)
62  {
63  _prop_d2h[i][j] = _prop_d2h[j][i] =
64  &declarePropertyDerivative<Real>(_h_name, _eta_names[i], _eta_names[j]);
65  }
66  }
67 
68  // Determine which order parameters in the list of all etas belong to phase p
69  for (unsigned int i = 0; i < _num_eta; ++i)
70  {
71  _is_p[i] = false;
72  for (unsigned int j = 0; j < _num_eta_p; ++j)
73  {
74  if (_eta_names[i] == _eta_p_names[j])
75  _is_p[i] = true;
76  }
77  }
78 }
unsigned int _num_eta
Order parameters for all phases (including alpha)
MaterialPropertyName _h_name
Name of the function.
std::vector< bool > _is_p
List of which order parameters in the full list of all etas belong to phase p.
MaterialProperty< Real > & _prop_h
Switching function and derivatives.
std::vector< MaterialProperty< Real > * > _prop_dh
unsigned int _num_eta_p
Order parameters for phase alpha.
std::vector< std::vector< MaterialProperty< Real > * > > _prop_d2h

Member Function Documentation

◆ computeQpProperties()

void SwitchingFunctionMultiPhaseMaterial::computeQpProperties ( )
protectedvirtual

Definition at line 81 of file SwitchingFunctionMultiPhaseMaterial.C.

82 {
83  Real sum_p = 0.0;
84  Real sum_all = 0.0;
85 
86  for (unsigned int i = 0; i < _num_eta_p; ++i)
87  sum_p += (*_eta_p[i])[_qp] * (*_eta_p[i])[_qp];
88 
89  for (unsigned int i = 0; i < _num_eta; ++i)
90  sum_all += (*_eta[i])[_qp] * (*_eta[i])[_qp];
91 
92  Real sum_notp = sum_all - sum_p;
93 
94  _prop_h[_qp] = sum_p / sum_all;
95 
96  for (unsigned int i = 0; i < _num_eta; ++i)
97  {
98  // First derivatives
99  if (_is_p[i])
100  (*_prop_dh[i])[_qp] = 2.0 * (*_eta[i])[_qp] * sum_notp / (sum_all * sum_all);
101  else
102  (*_prop_dh[i])[_qp] = -2.0 * (*_eta[i])[_qp] * sum_p / (sum_all * sum_all);
103 
104  // Second derivatives
105  for (unsigned int j = 0; j < _num_eta; ++j)
106  {
107  if (i == j)
108  {
109  if (_is_p[i])
110  (*_prop_d2h[i][j])[_qp] =
111  (2.0 * sum_all * sum_notp - 8.0 * (*_eta[i])[_qp] * (*_eta[i])[_qp] * sum_notp) /
112  (sum_all * sum_all * sum_all);
113  else
114  (*_prop_d2h[i][j])[_qp] =
115  (-2.0 * sum_p * sum_all + 8.0 * (*_eta[i])[_qp] * (*_eta[i])[_qp] * sum_p) /
116  (sum_all * sum_all * sum_all);
117  }
118  else if (_is_p[i] && _is_p[j])
119  (*_prop_d2h[i][j])[_qp] =
120  -8.0 * (*_eta[i])[_qp] * (*_eta[j])[_qp] * sum_notp / (sum_all * sum_all * sum_all);
121  else if (!_is_p[i] && !_is_p[j])
122  (*_prop_d2h[i][j])[_qp] =
123  8.0 * (*_eta[i])[_qp] * (*_eta[j])[_qp] * sum_p / (sum_all * sum_all * sum_all);
124  else
125  (*_prop_d2h[i][j])[_qp] = (4.0 * sum_all - 8.0 * sum_notp) * (*_eta[i])[_qp] *
126  (*_eta[j])[_qp] / (sum_all * sum_all * sum_all);
127  }
128  }
129 }
unsigned int _num_eta
Order parameters for all phases (including alpha)
std::vector< bool > _is_p
List of which order parameters in the full list of all etas belong to phase p.
MaterialProperty< Real > & _prop_h
Switching function and derivatives.
std::vector< MaterialProperty< Real > * > _prop_dh
unsigned int _num_eta_p
Order parameters for phase alpha.
std::vector< std::vector< MaterialProperty< Real > * > > _prop_d2h

Member Data Documentation

◆ _eta

std::vector<const VariableValue *> SwitchingFunctionMultiPhaseMaterial::_eta
protected

◆ _eta_names

std::vector<VariableName> SwitchingFunctionMultiPhaseMaterial::_eta_names
protected

◆ _eta_p

std::vector<const VariableValue *> SwitchingFunctionMultiPhaseMaterial::_eta_p
protected

◆ _eta_p_names

std::vector<VariableName> SwitchingFunctionMultiPhaseMaterial::_eta_p_names
protected

◆ _h_name

MaterialPropertyName SwitchingFunctionMultiPhaseMaterial::_h_name
protected

Name of the function.

Definition at line 38 of file SwitchingFunctionMultiPhaseMaterial.h.

Referenced by SwitchingFunctionMultiPhaseMaterial().

◆ _is_p

std::vector<bool> SwitchingFunctionMultiPhaseMaterial::_is_p
protected

List of which order parameters in the full list of all etas belong to phase p.

Definition at line 51 of file SwitchingFunctionMultiPhaseMaterial.h.

Referenced by computeQpProperties(), and SwitchingFunctionMultiPhaseMaterial().

◆ _num_eta

unsigned int SwitchingFunctionMultiPhaseMaterial::_num_eta
protected

Order parameters for all phases (including alpha)

Definition at line 46 of file SwitchingFunctionMultiPhaseMaterial.h.

Referenced by computeQpProperties(), and SwitchingFunctionMultiPhaseMaterial().

◆ _num_eta_p

unsigned int SwitchingFunctionMultiPhaseMaterial::_num_eta_p
protected

Order parameters for phase alpha.

Definition at line 41 of file SwitchingFunctionMultiPhaseMaterial.h.

Referenced by computeQpProperties(), and SwitchingFunctionMultiPhaseMaterial().

◆ _prop_d2h

std::vector<std::vector<MaterialProperty<Real> *> > SwitchingFunctionMultiPhaseMaterial::_prop_d2h
protected

◆ _prop_dh

std::vector<MaterialProperty<Real> *> SwitchingFunctionMultiPhaseMaterial::_prop_dh
protected

◆ _prop_h

MaterialProperty<Real>& SwitchingFunctionMultiPhaseMaterial::_prop_h
protected

Switching function and derivatives.

Definition at line 54 of file SwitchingFunctionMultiPhaseMaterial.h.

Referenced by computeQpProperties().


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