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
 
const Real _ka
 site fractions More...
 
const Real _kb
 

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 36 of file KKSPhaseChemicalPotential.h.

Constructor & Destructor Documentation

◆ KKSPhaseChemicalPotential()

KKSPhaseChemicalPotential::KKSPhaseChemicalPotential ( const InputParameters &  parameters)

Definition at line 52 of file KKSPhaseChemicalPotential.C.

53  : DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>>(parameters),
54  _cb_var(coupled("cb")),
55  _cb_name(getVar("cb", 0)->name()),
56  // first derivatives
57  _dfadca(getMaterialPropertyDerivative<Real>("fa_name", _var.name())),
58  _dfbdcb(getMaterialPropertyDerivative<Real>("fb_name", _cb_name)),
59  // second derivatives d2F/dx*dca for jacobian diagonal elements
60  _d2fadca2(getMaterialPropertyDerivative<Real>("fa_name", _var.name(), _var.name())),
61  _d2fbdcbca(getMaterialPropertyDerivative<Real>("fb_name", _cb_name, _var.name())),
62  // site fractions
63  _ka(getParam<Real>("ka")),
64  _kb(getParam<Real>("kb"))
65 {
66  MooseVariableFEBase * arg;
67  unsigned int i;
68 
69 #ifdef DEBUG
70  _console << "KKSPhaseChemicalPotential(" << name() << ") " << _var.name() << ' ' << _cb_name
71  << '\n';
72 #endif
73 
74  unsigned int nvar = _coupled_moose_vars.size();
75  _d2fadcadarg.resize(nvar);
76  _d2fbdcbdarg.resize(nvar);
77 
78  for (i = 0; i < nvar; ++i)
79  {
80  // get the moose variable
81  arg = _coupled_moose_vars[i];
82 
83  // lookup table for the material properties representing the derivatives needed for the
84  // off-diagonal jacobian
85  _d2fadcadarg[i] = &getMaterialPropertyDerivative<Real>("fa_name", _var.name(), arg->name());
86  _d2fbdcbdarg[i] = &getMaterialPropertyDerivative<Real>("fb_name", _cb_name, arg->name());
87  }
88 }

Member Function Documentation

◆ computeQpJacobian()

Real KKSPhaseChemicalPotential::computeQpJacobian ( )
protectedvirtual

Definition at line 105 of file KKSPhaseChemicalPotential.C.

106 {
107  // for on diagonal we return the d/dca derivative of the residual
108  return _test[_i][_qp] * _phi[_j][_qp] * (_d2fadca2[_qp] / _ka - _d2fbdcbca[_qp] / _kb);
109 }

◆ computeQpOffDiagJacobian()

Real KKSPhaseChemicalPotential::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 112 of file KKSPhaseChemicalPotential.C.

113 {
114  // get the coupled variable jvar is referring to
115  const unsigned int cvar = mapJvarToCvar(jvar);
116 
117  return _test[_i][_qp] * _phi[_j][_qp] *
118  ((*_d2fadcadarg[cvar])[_qp] / _ka - (*_d2fbdcbdarg[cvar])[_qp] / _kb);
119 }

◆ computeQpResidual()

Real KKSPhaseChemicalPotential::computeQpResidual ( )
protectedvirtual

Definition at line 98 of file KKSPhaseChemicalPotential.C.

99 {
100  // enforce _dfadca==_dfbdcb
101  return _test[_i][_qp] * (_dfadca[_qp] / _ka - _dfbdcb[_qp] / _kb);
102 }

◆ initialSetup()

void KKSPhaseChemicalPotential::initialSetup ( )
protectedvirtual

Definition at line 91 of file KKSPhaseChemicalPotential.C.

92 {
93  validateNonlinearCoupling<Real>("fa_name");
94  validateNonlinearCoupling<Real>("fb_name");
95 }

Member Data Documentation

◆ _cb_name

VariableName KKSPhaseChemicalPotential::_cb_name
private

Definition at line 50 of file KKSPhaseChemicalPotential.h.

Referenced by KKSPhaseChemicalPotential().

◆ _cb_var

unsigned int KKSPhaseChemicalPotential::_cb_var
private

coupled variable for cb

Definition at line 49 of file KKSPhaseChemicalPotential.h.

◆ _d2fadca2

const MaterialProperty<Real>& KKSPhaseChemicalPotential::_d2fadca2
private

Definition at line 55 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpJacobian().

◆ _d2fadcadarg

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

◆ _d2fbdcbca

const MaterialProperty<Real>& KKSPhaseChemicalPotential::_d2fbdcbca
private

Definition at line 56 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpJacobian().

◆ _d2fbdcbdarg

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

◆ _dfadca

const MaterialProperty<Real>& KKSPhaseChemicalPotential::_dfadca
private

material properties we need to access

Definition at line 53 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpResidual().

◆ _dfbdcb

const MaterialProperty<Real>& KKSPhaseChemicalPotential::_dfbdcb
private

Definition at line 54 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpResidual().

◆ _ka

const Real KKSPhaseChemicalPotential::_ka
private

site fractions

Definition at line 62 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

◆ _kb

const Real KKSPhaseChemicalPotential::_kb
private

The documentation for this class was generated from the following files:
KKSPhaseChemicalPotential::_d2fbdcbca
const MaterialProperty< Real > & _d2fbdcbca
Definition: KKSPhaseChemicalPotential.h:56
KKSPhaseChemicalPotential::_dfadca
const MaterialProperty< Real > & _dfadca
material properties we need to access
Definition: KKSPhaseChemicalPotential.h:53
KKSPhaseChemicalPotential::_kb
const Real _kb
Definition: KKSPhaseChemicalPotential.h:63
KKSPhaseChemicalPotential::_cb_name
VariableName _cb_name
Definition: KKSPhaseChemicalPotential.h:50
KKSPhaseChemicalPotential::_dfbdcb
const MaterialProperty< Real > & _dfbdcb
Definition: KKSPhaseChemicalPotential.h:54
KKSPhaseChemicalPotential::_ka
const Real _ka
site fractions
Definition: KKSPhaseChemicalPotential.h:62
name
const std::string name
Definition: Setup.h:21
KKSPhaseChemicalPotential::_d2fadca2
const MaterialProperty< Real > & _d2fadca2
Definition: KKSPhaseChemicalPotential.h:55
KKSPhaseChemicalPotential::_cb_var
unsigned int _cb_var
coupled variable for cb
Definition: KKSPhaseChemicalPotential.h:49
KKSPhaseChemicalPotential::_d2fadcadarg
std::vector< const MaterialProperty< Real > * > _d2fadcadarg
Definition: KKSPhaseChemicalPotential.h:58
KKSPhaseChemicalPotential::_d2fbdcbdarg
std::vector< const MaterialProperty< Real > * > _d2fbdcbdarg
Definition: KKSPhaseChemicalPotential.h:59