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

DerivativeMaterial child class to evaluate a parsed function for the free energy and automatically provide all derivatives. More...

#include <DerivativeTwoPhaseMaterial.h>

Inheritance diagram for DerivativeTwoPhaseMaterial:
[legend]

Public Member Functions

 DerivativeTwoPhaseMaterial (const InputParameters &parameters)
 
virtual void initialSetup () override
 

Protected Member Functions

virtual Real computeF () override
 
virtual Real computeDF (unsigned int i_var) override
 
virtual Real computeD2F (unsigned int i_var, unsigned int j_var) override
 
virtual Real computeD3F (unsigned int i_var, unsigned int j_var, unsigned int k_var) override
 

Protected Attributes

const VariableValue & _eta
 Phase parameter (0=A-phase, 1=B-phase) More...
 
VariableName _eta_name
 name of the order parameter variable More...
 
unsigned int _eta_var
 libMesh variable number for eta More...
 
Real _W
 Phase transformatuion energy barrier. More...
 
const MaterialProperty< Real > & _prop_Fa
 Function value of the A and B phase. More...
 
const MaterialProperty< Real > & _prop_Fb
 
std::vector< const MaterialProperty< Real > * > _prop_dFa
 Derivatives of Fa and Fb with respect to arg[i]. More...
 
std::vector< const MaterialProperty< Real > * > _prop_dFb
 
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2Fa
 Second derivatives of Fa and Fb. More...
 
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2Fb
 
std::vector< std::vector< std::vector< const MaterialProperty< Real > * > > > _prop_d3Fa
 Third derivatives of Fa and Fb. More...
 
std::vector< std::vector< std::vector< const MaterialProperty< Real > * > > > _prop_d3Fb
 
const MaterialProperty< Real > & _h
 
const MaterialProperty< Real > & _dh
 
const MaterialProperty< Real > & _d2h
 
const MaterialProperty< Real > & _d3h
 
const MaterialProperty< Real > & _g
 
const MaterialProperty< Real > & _dg
 
const MaterialProperty< Real > & _d2g
 
const MaterialProperty< Real > & _d3g
 

Detailed Description

DerivativeMaterial child class to evaluate a parsed function for the free energy and automatically provide all derivatives.

This requires the autodiff patch (https://github.com/libMesh/libmesh/pull/238) to Function Parser in libmesh.

Definition at line 27 of file DerivativeTwoPhaseMaterial.h.

Constructor & Destructor Documentation

◆ DerivativeTwoPhaseMaterial()

DerivativeTwoPhaseMaterial::DerivativeTwoPhaseMaterial ( const InputParameters &  parameters)

Definition at line 45 of file DerivativeTwoPhaseMaterial.C.

46  : DerivativeFunctionMaterialBase(parameters),
47  _eta(coupledValue("eta")),
48  _eta_name(getVar("eta", 0)->name()),
49  _eta_var(coupled("eta")),
50  _h(getMaterialProperty<Real>("h")),
51  _dh(getMaterialPropertyDerivative<Real>("h", _eta_name)),
52  _d2h(getMaterialPropertyDerivative<Real>("h", _eta_name, _eta_name)),
53  _d3h(getMaterialPropertyDerivative<Real>("h", _eta_name, _eta_name, _eta_name)),
54  _g(getMaterialProperty<Real>("g")),
55  _dg(getMaterialPropertyDerivative<Real>("g", _eta_name)),
56  _d2g(getMaterialPropertyDerivative<Real>("g", _eta_name, _eta_name)),
57  _d3g(getMaterialPropertyDerivative<Real>("g", _eta_name, _eta_name, _eta_name)),
58  _W(getParam<Real>("W")),
59  _prop_Fa(getMaterialProperty<Real>("fa_name")),
60  _prop_Fb(getMaterialProperty<Real>("fb_name"))
61 {
62  // reserve space for phase A and B material properties
63  _prop_dFa.resize(_nargs);
64  _prop_d2Fa.resize(_nargs);
65  _prop_d3Fa.resize(_nargs);
66  _prop_dFb.resize(_nargs);
67  _prop_d2Fb.resize(_nargs);
68  _prop_d3Fb.resize(_nargs);
69  for (unsigned int i = 0; i < _nargs; ++i)
70  {
71  _prop_dFa[i] = &getMaterialPropertyDerivative<Real>("fa_name", _arg_names[i]);
72  _prop_dFb[i] = &getMaterialPropertyDerivative<Real>("fb_name", _arg_names[i]);
73 
74  _prop_d2Fa[i].resize(_nargs);
75  _prop_d2Fb[i].resize(_nargs);
76 
77  // TODO: maybe we should reserve and initialize to NULL...
78  if (_third_derivatives)
79  {
80  _prop_d3Fa[i].resize(_nargs);
81  _prop_d3Fb[i].resize(_nargs);
82  }
83 
84  for (unsigned int j = 0; j < _nargs; ++j)
85  {
86  _prop_d2Fa[i][j] =
87  &getMaterialPropertyDerivative<Real>("fa_name", _arg_names[i], _arg_names[j]);
88  _prop_d2Fb[i][j] =
89  &getMaterialPropertyDerivative<Real>("fb_name", _arg_names[i], _arg_names[j]);
90 
91  if (_third_derivatives)
92  {
93  _prop_d3Fa[i][j].resize(_nargs);
94  _prop_d3Fb[i][j].resize(_nargs);
95 
96  for (unsigned int k = 0; k < _nargs; ++k)
97  {
98  _prop_d3Fa[i][j][k] = &getMaterialPropertyDerivative<Real>(
99  "fa_name", _arg_names[i], _arg_names[j], _arg_names[k]);
100  _prop_d3Fb[i][j][k] = &getMaterialPropertyDerivative<Real>(
101  "fb_name", _arg_names[i], _arg_names[j], _arg_names[k]);
102  }
103  }
104  }
105  }
106 }
const MaterialProperty< Real > & _dh
const VariableValue & _eta
Phase parameter (0=A-phase, 1=B-phase)
const MaterialProperty< Real > & _d3g
const MaterialProperty< Real > & _prop_Fa
Function value of the A and B phase.
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2Fa
Second derivatives of Fa and Fb.
const MaterialProperty< Real > & _g
std::vector< const MaterialProperty< Real > * > _prop_dFb
std::vector< std::vector< std::vector< const MaterialProperty< Real > * > > > _prop_d3Fb
const MaterialProperty< Real > & _d2h
std::vector< std::vector< std::vector< const MaterialProperty< Real > * > > > _prop_d3Fa
Third derivatives of Fa and Fb.
Real _W
Phase transformatuion energy barrier.
const std::string name
Definition: Setup.h:22
const MaterialProperty< Real > & _d3h
const MaterialProperty< Real > & _h
const MaterialProperty< Real > & _d2g
const MaterialProperty< Real > & _dg
std::vector< const MaterialProperty< Real > * > _prop_dFa
Derivatives of Fa and Fb with respect to arg[i].
VariableName _eta_name
name of the order parameter variable
const MaterialProperty< Real > & _prop_Fb
unsigned int _eta_var
libMesh variable number for eta
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2Fb

Member Function Documentation

◆ computeD2F()

Real DerivativeTwoPhaseMaterial::computeD2F ( unsigned int  i_var,
unsigned int  j_var 
)
overrideprotectedvirtual

Definition at line 134 of file DerivativeTwoPhaseMaterial.C.

135 {
136  if (i_var == _eta_var && j_var == _eta_var)
137  return _d2h[_qp] * (_prop_Fb[_qp] - _prop_Fa[_qp]) + _W * _d2g[_qp];
138 
139  unsigned int i = argIndex(i_var);
140  unsigned int j = argIndex(j_var);
141 
142  if (i_var == _eta_var)
143  return _dh[_qp] * ((*_prop_dFb[j])[_qp] - (*_prop_dFa[j])[_qp]);
144  if (j_var == _eta_var)
145  return _dh[_qp] * ((*_prop_dFb[i])[_qp] - (*_prop_dFa[i])[_qp]);
146 
147  return _h[_qp] * (*_prop_d2Fb[i][j])[_qp] + (1.0 - _h[_qp]) * (*_prop_d2Fa[i][j])[_qp];
148 }
const MaterialProperty< Real > & _dh
const MaterialProperty< Real > & _prop_Fa
Function value of the A and B phase.
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2Fa
Second derivatives of Fa and Fb.
std::vector< const MaterialProperty< Real > * > _prop_dFb
const MaterialProperty< Real > & _d2h
Real _W
Phase transformatuion energy barrier.
const MaterialProperty< Real > & _h
const MaterialProperty< Real > & _d2g
std::vector< const MaterialProperty< Real > * > _prop_dFa
Derivatives of Fa and Fb with respect to arg[i].
const MaterialProperty< Real > & _prop_Fb
unsigned int _eta_var
libMesh variable number for eta
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2Fb

◆ computeD3F()

Real DerivativeTwoPhaseMaterial::computeD3F ( unsigned int  i_var,
unsigned int  j_var,
unsigned int  k_var 
)
overrideprotectedvirtual

Definition at line 151 of file DerivativeTwoPhaseMaterial.C.

152 {
153  if (i_var == _eta_var && j_var == _eta_var && k_var == _eta_var)
154  return _d3h[_qp] * (_prop_Fb[_qp] - _prop_Fa[_qp]) + _W * _d3g[_qp];
155 
156  unsigned int i = argIndex(i_var);
157  unsigned int j = argIndex(j_var);
158  unsigned int k = argIndex(k_var);
159 
160  if (j_var == _eta_var && k_var == _eta_var)
161  return _d2h[_qp] * ((*_prop_dFb[i])[_qp] - (*_prop_dFa[i])[_qp]);
162  if (i_var == _eta_var && k_var == _eta_var)
163  return _d2h[_qp] * ((*_prop_dFb[j])[_qp] - (*_prop_dFa[j])[_qp]);
164  if (i_var == _eta_var && j_var == _eta_var)
165  return _d2h[_qp] * ((*_prop_dFb[k])[_qp] - (*_prop_dFa[k])[_qp]);
166 
167  if (i_var == _eta_var)
168  return _dh[_qp] * (*_prop_d2Fb[j][k])[_qp] + (1.0 - _dh[_qp]) * (*_prop_d2Fa[j][k])[_qp];
169  if (j_var == _eta_var)
170  return _dh[_qp] * (*_prop_d2Fb[i][k])[_qp] + (1.0 - _dh[_qp]) * (*_prop_d2Fa[i][k])[_qp];
171  if (k_var == _eta_var)
172  return _dh[_qp] * (*_prop_d2Fb[i][j])[_qp] + (1.0 - _dh[_qp]) * (*_prop_d2Fa[i][j])[_qp];
173 
174  return _h[_qp] * (*_prop_d3Fb[i][j][k])[_qp] + (1.0 - _h[_qp]) * (*_prop_d3Fa[i][j][k])[_qp];
175 }
const MaterialProperty< Real > & _dh
const MaterialProperty< Real > & _d3g
const MaterialProperty< Real > & _prop_Fa
Function value of the A and B phase.
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2Fa
Second derivatives of Fa and Fb.
std::vector< const MaterialProperty< Real > * > _prop_dFb
std::vector< std::vector< std::vector< const MaterialProperty< Real > * > > > _prop_d3Fb
const MaterialProperty< Real > & _d2h
std::vector< std::vector< std::vector< const MaterialProperty< Real > * > > > _prop_d3Fa
Third derivatives of Fa and Fb.
Real _W
Phase transformatuion energy barrier.
const MaterialProperty< Real > & _d3h
const MaterialProperty< Real > & _h
std::vector< const MaterialProperty< Real > * > _prop_dFa
Derivatives of Fa and Fb with respect to arg[i].
const MaterialProperty< Real > & _prop_Fb
unsigned int _eta_var
libMesh variable number for eta
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2Fb

◆ computeDF()

Real DerivativeTwoPhaseMaterial::computeDF ( unsigned int  i_var)
overrideprotectedvirtual

Definition at line 122 of file DerivativeTwoPhaseMaterial.C.

123 {
124  if (i_var == _eta_var)
125  return _dh[_qp] * (_prop_Fb[_qp] - _prop_Fa[_qp]) + _W * _dg[_qp];
126  else
127  {
128  unsigned int i = argIndex(i_var);
129  return _h[_qp] * (*_prop_dFb[i])[_qp] + (1.0 - _h[_qp]) * (*_prop_dFa[i])[_qp];
130  }
131 }
const MaterialProperty< Real > & _dh
const MaterialProperty< Real > & _prop_Fa
Function value of the A and B phase.
std::vector< const MaterialProperty< Real > * > _prop_dFb
Real _W
Phase transformatuion energy barrier.
const MaterialProperty< Real > & _h
const MaterialProperty< Real > & _dg
std::vector< const MaterialProperty< Real > * > _prop_dFa
Derivatives of Fa and Fb with respect to arg[i].
const MaterialProperty< Real > & _prop_Fb
unsigned int _eta_var
libMesh variable number for eta

◆ computeF()

Real DerivativeTwoPhaseMaterial::computeF ( )
overrideprotectedvirtual

Definition at line 116 of file DerivativeTwoPhaseMaterial.C.

117 {
118  return _h[_qp] * _prop_Fb[_qp] + (1.0 - _h[_qp]) * _prop_Fa[_qp] + _W * _g[_qp];
119 }
const MaterialProperty< Real > & _prop_Fa
Function value of the A and B phase.
const MaterialProperty< Real > & _g
Real _W
Phase transformatuion energy barrier.
const MaterialProperty< Real > & _h
const MaterialProperty< Real > & _prop_Fb

◆ initialSetup()

void DerivativeTwoPhaseMaterial::initialSetup ( )
overridevirtual

Definition at line 109 of file DerivativeTwoPhaseMaterial.C.

110 {
111  validateCoupling<Real>("fa_name");
112  validateCoupling<Real>("fb_name");
113 }

Member Data Documentation

◆ _d2g

const MaterialProperty<Real>& DerivativeTwoPhaseMaterial::_d2g
protected

Definition at line 61 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD2F().

◆ _d2h

const MaterialProperty<Real>& DerivativeTwoPhaseMaterial::_d2h
protected

Definition at line 53 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD2F(), and computeD3F().

◆ _d3g

const MaterialProperty<Real>& DerivativeTwoPhaseMaterial::_d3g
protected

Definition at line 62 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD3F().

◆ _d3h

const MaterialProperty<Real>& DerivativeTwoPhaseMaterial::_d3h
protected

Definition at line 54 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD3F().

◆ _dg

const MaterialProperty<Real>& DerivativeTwoPhaseMaterial::_dg
protected

Definition at line 60 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeDF().

◆ _dh

const MaterialProperty<Real>& DerivativeTwoPhaseMaterial::_dh
protected

Definition at line 52 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD2F(), computeD3F(), and computeDF().

◆ _eta

const VariableValue& DerivativeTwoPhaseMaterial::_eta
protected

Phase parameter (0=A-phase, 1=B-phase)

Definition at line 41 of file DerivativeTwoPhaseMaterial.h.

◆ _eta_name

VariableName DerivativeTwoPhaseMaterial::_eta_name
protected

name of the order parameter variable

Definition at line 44 of file DerivativeTwoPhaseMaterial.h.

◆ _eta_var

unsigned int DerivativeTwoPhaseMaterial::_eta_var
protected

libMesh variable number for eta

Definition at line 47 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD2F(), computeD3F(), and computeDF().

◆ _g

const MaterialProperty<Real>& DerivativeTwoPhaseMaterial::_g
protected

g(eta) switching function

Definition at line 59 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeF().

◆ _h

const MaterialProperty<Real>& DerivativeTwoPhaseMaterial::_h
protected

h(eta) switching function

Definition at line 51 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD2F(), computeD3F(), computeDF(), and computeF().

◆ _prop_d2Fa

std::vector<std::vector<const MaterialProperty<Real> *> > DerivativeTwoPhaseMaterial::_prop_d2Fa
protected

Second derivatives of Fa and Fb.

Definition at line 75 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD2F(), computeD3F(), and DerivativeTwoPhaseMaterial().

◆ _prop_d2Fb

std::vector<std::vector<const MaterialProperty<Real> *> > DerivativeTwoPhaseMaterial::_prop_d2Fb
protected

Definition at line 75 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD2F(), computeD3F(), and DerivativeTwoPhaseMaterial().

◆ _prop_d3Fa

std::vector<std::vector<std::vector<const MaterialProperty<Real> *> > > DerivativeTwoPhaseMaterial::_prop_d3Fa
protected

Third derivatives of Fa and Fb.

Definition at line 78 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD3F(), and DerivativeTwoPhaseMaterial().

◆ _prop_d3Fb

std::vector<std::vector<std::vector<const MaterialProperty<Real> *> > > DerivativeTwoPhaseMaterial::_prop_d3Fb
protected

Definition at line 78 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD3F(), and DerivativeTwoPhaseMaterial().

◆ _prop_dFa

std::vector<const MaterialProperty<Real> *> DerivativeTwoPhaseMaterial::_prop_dFa
protected

Derivatives of Fa and Fb with respect to arg[i].

Definition at line 72 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD2F(), computeD3F(), computeDF(), and DerivativeTwoPhaseMaterial().

◆ _prop_dFb

std::vector<const MaterialProperty<Real> *> DerivativeTwoPhaseMaterial::_prop_dFb
protected

◆ _prop_Fa

const MaterialProperty<Real>& DerivativeTwoPhaseMaterial::_prop_Fa
protected

Function value of the A and B phase.

Definition at line 69 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD2F(), computeD3F(), computeDF(), and computeF().

◆ _prop_Fb

const MaterialProperty<Real> & DerivativeTwoPhaseMaterial::_prop_Fb
protected

Definition at line 69 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD2F(), computeD3F(), computeDF(), and computeF().

◆ _W

Real DerivativeTwoPhaseMaterial::_W
protected

Phase transformatuion energy barrier.

Definition at line 66 of file DerivativeTwoPhaseMaterial.h.

Referenced by computeD2F(), computeD3F(), computeDF(), and computeF().


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