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 24 of file CHInterfaceBase.h.

Constructor & Destructor Documentation

◆ CHInterfaceBase()

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

Definition at line 67 of file CHInterfaceBase.h.

68  : DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>>(parameters),
69  _kappa(getMaterialProperty<Real>("kappa_name")),
70  _M(getMaterialProperty<T>("mob_name")),
71  _dMdc(getMaterialPropertyDerivative<T>("mob_name", _var.name())),
72  _d2Mdc2(getMaterialPropertyDerivative<T>("mob_name", _var.name(), _var.name())),
73  _second_u(second()),
74  _second_test(secondTest()),
75  _second_phi(secondPhi()),
76  _nvar(_coupled_moose_vars.size()),
77  _dMdarg(_nvar),
81 {
82  // Iterate over all coupled variables
83  for (unsigned int i = 0; i < _nvar; ++i)
84  {
85  // Set material property values
86  _dMdarg[i] = &getMaterialPropertyDerivative<T>("mob_name", _coupled_moose_vars[i]->name());
87  _d2Mdcdarg[i] =
88  &getMaterialPropertyDerivative<T>("mob_name", _var.name(), _coupled_moose_vars[i]->name());
89  _d2Mdargdarg[i].resize(_nvar);
90  for (unsigned int j = 0; j < _nvar; ++j)
91  _d2Mdargdarg[i][j] = &getMaterialPropertyDerivative<T>(
92  "mob_name", _coupled_moose_vars[i]->name(), _coupled_moose_vars[j]->name());
93 
94  // Set coupled variable gradients
95  _coupled_grad_vars[i] = &coupledGradient("args", i);
96  }
97 }
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 std::string name
Definition: Setup.h:22
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

◆ computeQpJacobian()

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

Definition at line 125 of file CHInterfaceBase.h.

126 {
127  // Set the gradient and gradient derivative values
128  RealGradient grad_M = _dMdc[_qp] * _grad_u[_qp];
129 
130  RealGradient dgrad_Mdc =
131  _d2Mdc2[_qp] * _phi[_j][_qp] * _grad_u[_qp] + _dMdc[_qp] * _grad_phi[_j][_qp];
132 
133  for (unsigned int i = 0; i < _nvar; ++i)
134  {
135  grad_M += (*_dMdarg[i])[_qp] * (*_coupled_grad_vars[i])[_qp];
136  dgrad_Mdc += (*_d2Mdcdarg[i])[_qp] * _phi[_j][_qp] * (*_coupled_grad_vars[i])[_qp];
137  }
138 
139  // Jacobian value using product rule
140  Real value = _kappa[_qp] * _second_phi[_j][_qp].tr() *
141  ((_M[_qp] * _second_test[_i][_qp]).tr() + grad_M * _grad_test[_i][_qp]) +
142  _kappa[_qp] * _second_u[_qp].tr() *
143  ((_dMdc[_qp] * _second_test[_i][_qp]).tr() * _phi[_j][_qp] +
144  dgrad_Mdc * _grad_test[_i][_qp]);
145 
146  return value;
147 }
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

◆ computeQpOffDiagJacobian()

template<typename T >
Real CHInterfaceBase< T >::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 151 of file CHInterfaceBase.h.

152 {
153  // get the coupled variable jvar is referring to
154  const unsigned int cvar = mapJvarToCvar(jvar);
155 
156  // Set the gradient derivative
157  RealGradient dgrad_Mdarg = (*_d2Mdcdarg[cvar])[_qp] * _phi[_j][_qp] * _grad_u[_qp] +
158  (*_dMdarg[cvar])[_qp] * _grad_phi[_j][_qp];
159 
160  for (unsigned int i = 0; i < _nvar; ++i)
161  dgrad_Mdarg += (*_d2Mdargdarg[cvar][i])[_qp] * _phi[_j][_qp] * (*_coupled_grad_vars[cvar])[_qp];
162 
163  // Jacobian value using product rule
164  Real value = _kappa[_qp] * _second_u[_qp].tr() *
165  (((*_dMdarg[cvar])[_qp] * _second_test[_i][_qp]).tr() * _phi[_j][_qp] +
166  dgrad_Mdarg * _grad_test[_i][_qp]);
167 
168  return value;
169 }
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

◆ computeQpResidual()

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

Definition at line 113 of file CHInterfaceBase.h.

114 {
115  RealGradient grad_M = _dMdc[_qp] * _grad_u[_qp];
116  for (unsigned int i = 0; i < _nvar; ++i)
117  grad_M += (*_dMdarg[i])[_qp] * (*_coupled_grad_vars[i])[_qp];
118 
119  return _kappa[_qp] * _second_u[_qp].tr() *
120  ((_M[_qp] * _second_test[_i][_qp]).tr() + grad_M * _grad_test[_i][_qp]);
121 }
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

◆ validParams()

template<typename T >
InputParameters CHInterfaceBase< T >::validParams ( )
static

Definition at line 101 of file CHInterfaceBase.h.

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

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

Member Data Documentation

◆ _coupled_grad_vars

template<typename T>
std::vector<const VariableGradient *> CHInterfaceBase< T >::_coupled_grad_vars
protected

Coupled variables used in mobility.

Definition at line 63 of file CHInterfaceBase.h.

Referenced by CHInterfaceBase< Real >::CHInterfaceBase().

◆ _d2Mdargdarg

template<typename T>
std::vector<std::vector<const MaterialProperty<T> *> > CHInterfaceBase< T >::_d2Mdargdarg
protected

Definition at line 59 of file CHInterfaceBase.h.

Referenced by CHInterfaceBase< Real >::CHInterfaceBase().

◆ _d2Mdc2

template<typename T>
const MaterialProperty<T>& CHInterfaceBase< T >::_d2Mdc2
protected

Definition at line 42 of file CHInterfaceBase.h.

◆ _d2Mdcdarg

template<typename T>
std::vector<const MaterialProperty<T> *> CHInterfaceBase< T >::_d2Mdcdarg
protected

Definition at line 58 of file CHInterfaceBase.h.

Referenced by CHInterfaceBase< Real >::CHInterfaceBase().

◆ _dMdarg

template<typename T>
std::vector<const MaterialProperty<T> *> CHInterfaceBase< T >::_dMdarg
protected

Mobility derivatives w.r.t. its dependent variables

Definition at line 57 of file CHInterfaceBase.h.

Referenced by CHInterfaceBase< Real >::CHInterfaceBase().

◆ _dMdc

template<typename T>
const MaterialProperty<T>& CHInterfaceBase< T >::_dMdc
protected

Definition at line 41 of file CHInterfaceBase.h.

◆ _kappa

template<typename T>
const MaterialProperty<Real>& CHInterfaceBase< T >::_kappa
protected

Definition at line 36 of file CHInterfaceBase.h.

◆ _M

template<typename T>
const MaterialProperty<T>& CHInterfaceBase< T >::_M
protected

Mobility material property value and concentration derivatives

Definition at line 40 of file CHInterfaceBase.h.

◆ _nvar

template<typename T>
unsigned int CHInterfaceBase< T >::_nvar
protected

Number of variables.

Definition at line 53 of file CHInterfaceBase.h.

Referenced by CHInterfaceBase< Real >::CHInterfaceBase().

◆ _second_phi

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

Definition at line 49 of file CHInterfaceBase.h.

◆ _second_test

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

Definition at line 48 of file CHInterfaceBase.h.

◆ _second_u

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

Variables for second order derivatives

Definition at line 47 of file CHInterfaceBase.h.


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