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

SplitCHWRes creates the residual of the Cahn-Hilliard equation with a scalar (isotropic) mobility. More...

#include <CahnHilliard.h>

Inheritance diagram for CahnHilliard:
[legend]

Public Member Functions

 CahnHilliard (const InputParameters &parameters)
 
virtual void initialSetup ()
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Types

typedef CHBulk< Real >::PFFunctionType PFFunctionType
 

Protected Member Functions

virtual RealGradient computeGradDFDCons (PFFunctionType type)
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 
virtual RealGradient precomputeQpResidual ()
 
virtual RealGradient precomputeQpJacobian ()
 

Protected Attributes

const MaterialProperty< Real > & _M
 Mobility. More...
 
const MaterialProperty< Real > & _dMdc
 Mobility derivative w.r.t. concentration. More...
 
std::vector< const MaterialProperty< Real > *> _dMdarg
 Mobility derivative w.r.t coupled variables. More...
 

Detailed Description

SplitCHWRes creates the residual of the Cahn-Hilliard equation with a scalar (isotropic) mobility.

Definition at line 19 of file CahnHilliard.h.

Member Typedef Documentation

◆ PFFunctionType

typedef CHBulk<Real >::PFFunctionType CahnHilliardBase< Real >::PFFunctionType
protectedinherited

Definition at line 30 of file CahnHilliardBase.h.

Constructor & Destructor Documentation

◆ CahnHilliard()

CahnHilliard::CahnHilliard ( const InputParameters &  parameters)

Definition at line 24 of file CahnHilliard.C.

24  : CahnHilliardBase<Real>(parameters)
25 {
26 }

Member Function Documentation

◆ computeGradDFDCons()

RealGradient CahnHilliardBase< Real >::computeGradDFDCons ( PFFunctionType  type)
protectedvirtualinherited

Implements CHBulk< Real >.

Definition at line 128 of file CahnHilliardBase.h.

129 {
130  RealGradient res = 0.0;
131 
132  switch (type)
133  {
134  case CHBulk<T>::Residual:
135  for (unsigned int i = 0; i <= _nvar; ++i)
136  res += (*_grad_vars[i])[_qp] * (*_second_derivatives[i])[_qp];
137  return res;
138 
139  case CHBulk<T>::Jacobian:
140  res = _grad_phi[_j][_qp] * (*_second_derivatives[0])[_qp];
141  for (unsigned int i = 0; i <= _nvar; ++i)
142  res += _phi[_j][_qp] * (*_grad_vars[i])[_qp] * (*_third_derivatives[i])[_qp];
143  return res;
144  }
145 
146  mooseError("Internal error");
147 }
This is the Cahn-Hilliard equation base class that implements the bulk or local energy term of the eq...
Definition: CHBulk.h:26
const unsigned int _nvar
std::vector< const MaterialProperty< Real > *> _second_derivatives
std::vector< const VariableGradient *> _grad_vars
std::vector< const MaterialProperty< Real > *> _third_derivatives

◆ computeQpOffDiagJacobian()

Real CahnHilliardBase< Real >::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtualinherited

Reimplemented from CHBulk< Real >.

Definition at line 151 of file CahnHilliardBase.h.

152 {
153  // get the coupled variable jvar is referring to
154  const unsigned int cvar = this->mapJvarToCvar(jvar);
155 
156  RealGradient J = _grad_u[_qp] * _phi[_j][_qp] * (*_third_derivatives[cvar + 1])[_qp] +
157  _grad_phi[_j][_qp] * (*_second_derivatives[cvar + 1])[_qp];
158 
159  for (unsigned int i = 0; i < _nvar; ++i)
160  J += _phi[_j][_qp] * (*_grad_vars[i + 1])[_qp] * (*_third_cross_derivatives[i][cvar])[_qp];
161 
162  return CHBulk<T>::computeQpOffDiagJacobian(jvar) + _M[_qp] * _grad_test[_i][_qp] * J;
163 }
const MaterialProperty< Real > & _M
Mobility.
Definition: CHBulk.h:48
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: CHBulk.h:111
const unsigned int _nvar
std::vector< const MaterialProperty< Real > *> _second_derivatives
std::vector< const VariableGradient *> _grad_vars
std::vector< const MaterialProperty< Real > *> _third_derivatives
std::vector< std::vector< const MaterialProperty< Real > *> > _third_cross_derivatives

◆ initialSetup()

void CahnHilliardBase< Real >::initialSetup ( )
virtualinherited

Check if both the non-linear as well as the auxiliary variables variables are coupled. Derivatives with respect to both types of variables contribute the residual.

Reimplemented from CHBulk< Real >.

Definition at line 115 of file CahnHilliardBase.h.

116 {
122  this->template validateCoupling<Real>("f_name", _var.name());
123  this->template validateDerivativeMaterialPropertyBase<Real>("f_name");
124 }

◆ precomputeQpJacobian()

RealGradient CHBulk< Real >::precomputeQpJacobian ( )
protectedvirtualinherited

Definition at line 101 of file CHBulk.h.

102 {
103  RealGradient grad_value = _M[_qp] * computeGradDFDCons(Jacobian) +
104  _dMdc[_qp] * _phi[_j][_qp] * computeGradDFDCons(Residual);
105 
106  return grad_value;
107 }
virtual RealGradient computeGradDFDCons(PFFunctionType type)=0
const MaterialProperty< Real > & _M
Mobility.
Definition: CHBulk.h:48
const MaterialProperty< Real > & _dMdc
Mobility derivative w.r.t. concentration.
Definition: CHBulk.h:51

◆ precomputeQpResidual()

RealGradient CHBulk< Real >::precomputeQpResidual ( )
protectedvirtualinherited

Definition at line 94 of file CHBulk.h.

95 {
96  return _M[_qp] * computeGradDFDCons(Residual);
97 }
virtual RealGradient computeGradDFDCons(PFFunctionType type)=0
const MaterialProperty< Real > & _M
Mobility.
Definition: CHBulk.h:48

◆ validParams()

InputParameters CahnHilliardBase< Real >::validParams ( )
staticinherited

Definition at line 59 of file CahnHilliardBase.h.

60 {
61  InputParameters params = CHBulk<Real>::validParams();
62  params.addClassDescription("Cahn-Hilliard Kernel that uses a DerivativeMaterial Free Energy");
63  params.addRequiredParam<MaterialPropertyName>(
64  "f_name", "Base name of the free energy function F defined in a DerivativeParsedMaterial");
65  params.addCoupledVar("displacement_gradients",
66  "Vector of displacement gradient variables (see "
67  "Modules/PhaseField/DisplacementGradients "
68  "action)");
69  return params;
70 }
static InputParameters validParams()
Definition: CHBulk.h:76

Member Data Documentation

◆ _dMdarg

std::vector<const MaterialProperty<Real > *> CHBulk< Real >::_dMdarg
protectedinherited

Mobility derivative w.r.t coupled variables.

Definition at line 54 of file CHBulk.h.

◆ _dMdc

const MaterialProperty<Real >& CHBulk< Real >::_dMdc
protectedinherited

Mobility derivative w.r.t. concentration.

Definition at line 51 of file CHBulk.h.

◆ _M

const MaterialProperty<Real >& CHBulk< Real >::_M
protectedinherited

Mobility.

Definition at line 48 of file CHBulk.h.


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