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

Constructor & Destructor Documentation

◆ KKSPhaseChemicalPotential()

KKSPhaseChemicalPotential::KKSPhaseChemicalPotential ( const InputParameters &  parameters)

Definition at line 44 of file KKSPhaseChemicalPotential.C.

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

◆ computeQpJacobian()

Real KKSPhaseChemicalPotential::computeQpJacobian ( )
protectedvirtual

Definition at line 94 of file KKSPhaseChemicalPotential.C.

95 {
96  // for on diagonal we return the d/dca derivative of the residual
97  return _test[_i][_qp] * _phi[_j][_qp] * (_d2fadca2[_qp] - _d2fbdcbca[_qp]);
98 }
const MaterialProperty< Real > & _d2fbdcbca
const MaterialProperty< Real > & _d2fadca2

◆ computeQpOffDiagJacobian()

Real KKSPhaseChemicalPotential::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 101 of file KKSPhaseChemicalPotential.C.

102 {
103  // get the coupled variable jvar is referring to
104  const unsigned int cvar = mapJvarToCvar(jvar);
105 
106  return _test[_i][_qp] * _phi[_j][_qp] * ((*_d2fadcadarg[cvar])[_qp] - (*_d2fbdcbdarg[cvar])[_qp]);
107 }
std::vector< const MaterialProperty< Real > * > _d2fbdcbdarg
std::vector< const MaterialProperty< Real > * > _d2fadcadarg

◆ computeQpResidual()

Real KKSPhaseChemicalPotential::computeQpResidual ( )
protectedvirtual

Definition at line 87 of file KKSPhaseChemicalPotential.C.

88 {
89  // enforce _dfadca==_dfbdcb
90  return _test[_i][_qp] * (_dfadca[_qp] - _dfbdcb[_qp]);
91 }
const MaterialProperty< Real > & _dfadca
material properties we need to access
const MaterialProperty< Real > & _dfbdcb

◆ initialSetup()

void KKSPhaseChemicalPotential::initialSetup ( )
protectedvirtual

Definition at line 80 of file KKSPhaseChemicalPotential.C.

81 {
82  validateNonlinearCoupling<Real>("fa_name");
83  validateNonlinearCoupling<Real>("fb_name");
84 }

Member Data Documentation

◆ _cb_name

VariableName KKSPhaseChemicalPotential::_cb_name
private

Definition at line 51 of file KKSPhaseChemicalPotential.h.

Referenced by KKSPhaseChemicalPotential().

◆ _cb_var

unsigned int KKSPhaseChemicalPotential::_cb_var
private

coupled variable for cb

Definition at line 50 of file KKSPhaseChemicalPotential.h.

◆ _d2fadca2

const MaterialProperty<Real>& KKSPhaseChemicalPotential::_d2fadca2
private

Definition at line 56 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 57 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 54 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpResidual().

◆ _dfbdcb

const MaterialProperty<Real>& KKSPhaseChemicalPotential::_dfbdcb
private

Definition at line 55 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpResidual().


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