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

Enforce the equality of the chemical potentials in the two phases. More...

#include <KKSPhaseChemicalPotential.h>

Inheritance diagram for KKSPhaseChemicalPotential:
[legend]

Public Member Functions

 KKSPhaseChemicalPotential (const InputParameters &parameters)
 

Protected Member Functions

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

Private Attributes

unsigned int _cb_var
 coupled variable for cb More...
 
VariableName _cb_name
 
const MaterialProperty< Real > & _dfadca
 material properties we need to access More...
 
const MaterialProperty< Real > & _dfbdcb
 
const MaterialProperty< Real > & _d2fadca2
 
const MaterialProperty< Real > & _d2fbdcbca
 
std::vector< const MaterialProperty< Real > * > _d2fadcadarg
 
std::vector< const MaterialProperty< Real > * > _d2fbdcbdarg
 

Detailed Description

Enforce the equality of the chemical potentials in the two phases.

Eq. (21) in the original KKS paper.

\( dF_a/dc_a = dF_b/dc_b \)

We need to supply two free energy functions (i.e. KKSBaseMaterial) by giving two "base names" ('Fa', 'Fb'). We supply concentration \( c_a \) as the non-linear variable and \( c_b \) as a coupled variable (compare this to KKSPhaseConcentration, where the non-linear variable is the other phase concentration \( c_b \)!)

See also
KKSPhaseConcentration

Definition at line 34 of file KKSPhaseChemicalPotential.h.

Constructor & Destructor Documentation

KKSPhaseChemicalPotential::KKSPhaseChemicalPotential ( const InputParameters &  parameters)

Definition at line 39 of file KKSPhaseChemicalPotential.C.

40  : DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>>(parameters),
41  _cb_var(coupled("cb")),
42  _cb_name(getVar("cb", 0)->name()),
43  // first derivatives
44  _dfadca(getMaterialPropertyDerivative<Real>("fa_name", _var.name())),
45  _dfbdcb(getMaterialPropertyDerivative<Real>("fb_name", _cb_name)),
46  // second derivatives d2F/dx*dca for jacobian diagonal elements
47  _d2fadca2(getMaterialPropertyDerivative<Real>("fa_name", _var.name(), _var.name())),
48  _d2fbdcbca(getMaterialPropertyDerivative<Real>("fb_name", _cb_name, _var.name()))
49 {
50  MooseVariable * arg;
51  unsigned int i;
52 
53 #ifdef DEBUG
54  _console << "KKSPhaseChemicalPotential(" << name() << ") " << _var.name() << ' ' << _cb_name
55  << '\n';
56 #endif
57 
58  unsigned int nvar = _coupled_moose_vars.size();
59  _d2fadcadarg.resize(nvar);
60  _d2fbdcbdarg.resize(nvar);
61 
62  for (i = 0; i < nvar; ++i)
63  {
64  // get the moose variable
65  arg = _coupled_moose_vars[i];
66 
67  // lookup table for the material properties representing the derivatives needed for the
68  // off-diagonal jacobian
69  _d2fadcadarg[i] = &getMaterialPropertyDerivative<Real>("fa_name", _var.name(), arg->name());
70  _d2fbdcbdarg[i] = &getMaterialPropertyDerivative<Real>("fb_name", _cb_name, arg->name());
71  }
72 }
unsigned int _cb_var
coupled variable for cb
const MaterialProperty< Real > & _dfadca
material properties we need to access
std::vector< const MaterialProperty< Real > * > _d2fbdcbdarg
const MaterialProperty< Real > & _d2fbdcbca
const MaterialProperty< Real > & _d2fadca2
std::vector< const MaterialProperty< Real > * > _d2fadcadarg
const MaterialProperty< Real > & _dfbdcb

Member Function Documentation

Real KKSPhaseChemicalPotential::computeQpJacobian ( )
protectedvirtual

Definition at line 89 of file KKSPhaseChemicalPotential.C.

90 {
91  // for on diagonal we return the d/dca derivative of the residual
92  return _test[_i][_qp] * _phi[_j][_qp] * (_d2fadca2[_qp] - _d2fbdcbca[_qp]);
93 }
const MaterialProperty< Real > & _d2fbdcbca
const MaterialProperty< Real > & _d2fadca2
Real KKSPhaseChemicalPotential::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 96 of file KKSPhaseChemicalPotential.C.

97 {
98  // get the coupled variable jvar is referring to
99  const unsigned int cvar = mapJvarToCvar(jvar);
100 
101  return _test[_i][_qp] * _phi[_j][_qp] * ((*_d2fadcadarg[cvar])[_qp] - (*_d2fbdcbdarg[cvar])[_qp]);
102 }
std::vector< const MaterialProperty< Real > * > _d2fbdcbdarg
std::vector< const MaterialProperty< Real > * > _d2fadcadarg
Real KKSPhaseChemicalPotential::computeQpResidual ( )
protectedvirtual

Definition at line 82 of file KKSPhaseChemicalPotential.C.

83 {
84  // enforce _dfadca==_dfbdcb
85  return _test[_i][_qp] * (_dfadca[_qp] - _dfbdcb[_qp]);
86 }
const MaterialProperty< Real > & _dfadca
material properties we need to access
const MaterialProperty< Real > & _dfbdcb
void KKSPhaseChemicalPotential::initialSetup ( )
protectedvirtual

Definition at line 75 of file KKSPhaseChemicalPotential.C.

76 {
77  validateNonlinearCoupling<Real>("fa_name");
78  validateNonlinearCoupling<Real>("fb_name");
79 }

Member Data Documentation

VariableName KKSPhaseChemicalPotential::_cb_name
private

Definition at line 48 of file KKSPhaseChemicalPotential.h.

Referenced by KKSPhaseChemicalPotential().

unsigned int KKSPhaseChemicalPotential::_cb_var
private

coupled variable for cb

Definition at line 47 of file KKSPhaseChemicalPotential.h.

const MaterialProperty<Real>& KKSPhaseChemicalPotential::_d2fadca2
private

Definition at line 53 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpJacobian().

std::vector<const MaterialProperty<Real> *> KKSPhaseChemicalPotential::_d2fadcadarg
private
const MaterialProperty<Real>& KKSPhaseChemicalPotential::_d2fbdcbca
private

Definition at line 54 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpJacobian().

std::vector<const MaterialProperty<Real> *> KKSPhaseChemicalPotential::_d2fbdcbdarg
private
const MaterialProperty<Real>& KKSPhaseChemicalPotential::_dfadca
private

material properties we need to access

Definition at line 51 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpResidual().

const MaterialProperty<Real>& KKSPhaseChemicalPotential::_dfbdcb
private

Definition at line 52 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpResidual().


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