www.mooseframework.org
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CHInterfaceBase< T > Class Template Reference

This is the Cahn-Hilliard equation base class that implements the interfacial or gradient energy term of the equation. More...

#include <CHInterfaceBase.h>

Inheritance diagram for CHInterfaceBase< T >:
[legend]

Public Member Functions

 CHInterfaceBase (const InputParameters &parameters)
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual Real computeQpResidual ()
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 

Protected Attributes

const MaterialProperty< Real > & _kappa
 
unsigned int _nvar
 Number of variables. More...
 
std::vector< const VariableGradient * > _coupled_grad_vars
 Coupled variables used in mobility. More...
 
const MaterialProperty< T > & _M
 
const MaterialProperty< T > & _dMdc
 
const MaterialProperty< T > & _d2Mdc2
 
const VariableSecond & _second_u
 
const VariableTestSecond & _second_test
 
const VariablePhiSecond & _second_phi
 
std::vector< const MaterialProperty< T > * > _dMdarg
 
std::vector< const MaterialProperty< T > * > _d2Mdcdarg
 
std::vector< std::vector< const MaterialProperty< T > * > > _d2Mdargdarg
 

Detailed Description

template<typename T>
class CHInterfaceBase< T >

This is the Cahn-Hilliard equation base class that implements the interfacial or gradient energy term of the equation.

See M.R. Tonks et al. / Computational Materials Science 51 (2012) 20-29 for more information.

Definition at line 21 of file CHInterfaceBase.h.

Constructor & Destructor Documentation

template<typename T >
CHInterfaceBase< T >::CHInterfaceBase ( const InputParameters &  parameters)

Definition at line 64 of file CHInterfaceBase.h.

65  : DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>>(parameters),
66  _kappa(getMaterialProperty<Real>("kappa_name")),
67  _M(getMaterialProperty<T>("mob_name")),
68  _dMdc(getMaterialPropertyDerivative<T>("mob_name", _var.name())),
69  _d2Mdc2(getMaterialPropertyDerivative<T>("mob_name", _var.name(), _var.name())),
70  _second_u(second()),
71  _second_test(secondTest()),
72  _second_phi(secondPhi()),
73  _nvar(_coupled_moose_vars.size()),
74  _dMdarg(_nvar),
78 {
79  // Iterate over all coupled variables
80  for (unsigned int i = 0; i < _nvar; ++i)
81  {
82  // Set material property values
83  _dMdarg[i] = &getMaterialPropertyDerivative<T>("mob_name", _coupled_moose_vars[i]->name());
84  _d2Mdcdarg[i] =
85  &getMaterialPropertyDerivative<T>("mob_name", _var.name(), _coupled_moose_vars[i]->name());
86  _d2Mdargdarg[i].resize(_nvar);
87  for (unsigned int j = 0; j < _nvar; ++j)
88  _d2Mdargdarg[i][j] = &getMaterialPropertyDerivative<T>(
89  "mob_name", _coupled_moose_vars[i]->name(), _coupled_moose_vars[j]->name());
90 
91  // Set coupled variable gradients
92  _coupled_grad_vars[i] = &coupledGradient("args", i);
93  }
94 }
const VariablePhiSecond & _second_phi
unsigned int _nvar
Number of variables.
std::vector< const VariableGradient * > _coupled_grad_vars
Coupled variables used in mobility.
const MaterialProperty< T > & _d2Mdc2
std::vector< const MaterialProperty< T > * > _dMdarg
const VariableTestSecond & _second_test
const MaterialProperty< T > & _M
const VariableSecond & _second_u
const MaterialProperty< Real > & _kappa
std::vector< const MaterialProperty< T > * > _d2Mdcdarg
std::vector< std::vector< const MaterialProperty< T > * > > _d2Mdargdarg
const MaterialProperty< T > & _dMdc

Member Function Documentation

template<typename T >
Real CHInterfaceBase< T >::computeQpJacobian ( )
protectedvirtual

Definition at line 122 of file CHInterfaceBase.h.

123 {
124  // Set the gradient and gradient derivative values
125  RealGradient grad_M = _dMdc[_qp] * _grad_u[_qp];
126 
127  RealGradient dgrad_Mdc =
128  _d2Mdc2[_qp] * _phi[_j][_qp] * _grad_u[_qp] + _dMdc[_qp] * _grad_phi[_j][_qp];
129 
130  for (unsigned int i = 0; i < _nvar; ++i)
131  {
132  grad_M += (*_dMdarg[i])[_qp] * (*_coupled_grad_vars[i])[_qp];
133  dgrad_Mdc += (*_d2Mdcdarg[i])[_qp] * _phi[_j][_qp] * (*_coupled_grad_vars[i])[_qp];
134  }
135 
136  // Jacobian value using product rule
137  Real value = _kappa[_qp] * _second_phi[_j][_qp].tr() *
138  ((_M[_qp] * _second_test[_i][_qp]).tr() + grad_M * _grad_test[_i][_qp]) +
139  _kappa[_qp] * _second_u[_qp].tr() *
140  ((_dMdc[_qp] * _second_test[_i][_qp]).tr() * _phi[_j][_qp] +
141  dgrad_Mdc * _grad_test[_i][_qp]);
142 
143  return value;
144 }
const VariablePhiSecond & _second_phi
unsigned int _nvar
Number of variables.
std::vector< const VariableGradient * > _coupled_grad_vars
Coupled variables used in mobility.
const MaterialProperty< T > & _d2Mdc2
std::vector< const MaterialProperty< T > * > _dMdarg
const VariableTestSecond & _second_test
const MaterialProperty< T > & _M
const VariableSecond & _second_u
const MaterialProperty< Real > & _kappa
std::vector< const MaterialProperty< T > * > _d2Mdcdarg
const MaterialProperty< T > & _dMdc
template<typename T >
Real CHInterfaceBase< T >::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 148 of file CHInterfaceBase.h.

149 {
150  // get the coupled variable jvar is referring to
151  const unsigned int cvar = mapJvarToCvar(jvar);
152 
153  // Set the gradient derivative
154  RealGradient dgrad_Mdarg = (*_d2Mdcdarg[cvar])[_qp] * _phi[_j][_qp] * _grad_u[_qp] +
155  (*_dMdarg[cvar])[_qp] * _grad_phi[_j][_qp];
156 
157  for (unsigned int i = 0; i < _nvar; ++i)
158  dgrad_Mdarg += (*_d2Mdargdarg[cvar][i])[_qp] * _phi[_j][_qp] * (*_coupled_grad_vars[cvar])[_qp];
159 
160  // Jacobian value using product rule
161  Real value = _kappa[_qp] * _second_u[_qp].tr() *
162  (((*_dMdarg[cvar])[_qp] * _second_test[_i][_qp]).tr() * _phi[_j][_qp] +
163  dgrad_Mdarg * _grad_test[_i][_qp]);
164 
165  return value;
166 }
unsigned int _nvar
Number of variables.
std::vector< const VariableGradient * > _coupled_grad_vars
Coupled variables used in mobility.
std::vector< const MaterialProperty< T > * > _dMdarg
const VariableTestSecond & _second_test
const VariableSecond & _second_u
const MaterialProperty< Real > & _kappa
std::vector< const MaterialProperty< T > * > _d2Mdcdarg
std::vector< std::vector< const MaterialProperty< T > * > > _d2Mdargdarg
template<typename T >
Real CHInterfaceBase< T >::computeQpResidual ( )
protectedvirtual

Definition at line 110 of file CHInterfaceBase.h.

111 {
112  RealGradient grad_M = _dMdc[_qp] * _grad_u[_qp];
113  for (unsigned int i = 0; i < _nvar; ++i)
114  grad_M += (*_dMdarg[i])[_qp] * (*_coupled_grad_vars[i])[_qp];
115 
116  return _kappa[_qp] * _second_u[_qp].tr() *
117  ((_M[_qp] * _second_test[_i][_qp]).tr() + grad_M * _grad_test[_i][_qp]);
118 }
unsigned int _nvar
Number of variables.
std::vector< const VariableGradient * > _coupled_grad_vars
Coupled variables used in mobility.
std::vector< const MaterialProperty< T > * > _dMdarg
const VariableTestSecond & _second_test
const MaterialProperty< T > & _M
const VariableSecond & _second_u
const MaterialProperty< Real > & _kappa
const MaterialProperty< T > & _dMdc
template<typename T >
InputParameters CHInterfaceBase< T >::validParams ( )
static

Definition at line 98 of file CHInterfaceBase.h.

Referenced by validParams< CHInterface >(), and validParams< CHInterfaceAniso >().

99 {
100  InputParameters params = ::validParams<Kernel>();
101  params.addClassDescription("Gradient energy Cahn-Hilliard base Kernel");
102  params.addRequiredParam<MaterialPropertyName>("kappa_name", "The kappa used with the kernel");
103  params.addRequiredParam<MaterialPropertyName>("mob_name", "The mobility used with the kernel");
104  params.addCoupledVar("args", "Vector of arguments of the mobility");
105  return params;
106 }

Member Data Documentation

template<typename T>
std::vector<const VariableGradient *> CHInterfaceBase< T >::_coupled_grad_vars
protected
template<typename T>
std::vector<std::vector<const MaterialProperty<T> *> > CHInterfaceBase< T >::_d2Mdargdarg
protected
template<typename T>
const MaterialProperty<T>& CHInterfaceBase< T >::_d2Mdc2
protected

Definition at line 39 of file CHInterfaceBase.h.

Referenced by CHInterfaceBase< T >::computeQpJacobian().

template<typename T>
std::vector<const MaterialProperty<T> *> CHInterfaceBase< T >::_d2Mdcdarg
protected
template<typename T>
std::vector<const MaterialProperty<T> *> CHInterfaceBase< T >::_dMdarg
protected
template<typename T>
const MaterialProperty<T>& CHInterfaceBase< T >::_dMdc
protected
template<typename T>
const MaterialProperty<Real>& CHInterfaceBase< T >::_kappa
protected
template<typename T>
const MaterialProperty<T>& CHInterfaceBase< T >::_M
protected

Mobility material property value and concentration derivatives

Definition at line 37 of file CHInterfaceBase.h.

Referenced by CHInterfaceBase< T >::computeQpJacobian(), and CHInterfaceBase< T >::computeQpResidual().

template<typename T>
unsigned int CHInterfaceBase< T >::_nvar
protected
template<typename T>
const VariablePhiSecond& CHInterfaceBase< T >::_second_phi
protected

Definition at line 46 of file CHInterfaceBase.h.

Referenced by CHInterfaceBase< T >::computeQpJacobian().

template<typename T>
const VariableTestSecond& CHInterfaceBase< T >::_second_test
protected
template<typename T>
const VariableSecond& CHInterfaceBase< T >::_second_u
protected

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