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

Compute the free energy in the multi-phase KKS Model \( F = \sum_i h_i F_i + + wg_i + \frac{\kappa}{2}|\eta_i|^2 \). More...

#include <KKSMultiFreeEnergy.h>

Inheritance diagram for KKSMultiFreeEnergy:
[legend]

Public Member Functions

 KKSMultiFreeEnergy (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeValue ()
 

Protected Attributes

std::vector< MaterialPropertyName > _Fj_names
 Names of free energy functions for each phase \( F_j \). More...
 
const unsigned int _num_j
 
std::vector< const MaterialProperty< Real > * > _prop_Fj
 Values of the free energy functions for each phase \( F_j \). More...
 
std::vector< MaterialPropertyName > _hj_names
 Switching function names. More...
 
std::vector< const MaterialProperty< Real > * > _prop_hj
 Values of the switching functions for each phase \( h_j \). More...
 
std::vector< MaterialPropertyName > _gj_names
 Barrier function names. More...
 
std::vector< const MaterialProperty< Real > * > _prop_gj
 Values of the barrier functions for each phase \( g_j \). More...
 
const Real _w
 Barrier term height. More...
 
std::vector< const MaterialProperty< Real > * > _kappas
 Gradient interface free energy coefficients. More...
 
unsigned int _nvars
 Coupled interface variables. More...
 
std::vector< const VariableValue * > _vars
 
std::vector< const VariableGradient * > _grad_vars
 
std::vector< MaterialPropertyName > _kappa_names
 Gradient free energy prefactor kappa. More...
 
unsigned int _nkappas
 
const VariableValue & _additional_free_energy
 Additional free energy contribution. More...
 

Detailed Description

Compute the free energy in the multi-phase KKS Model \( F = \sum_i h_i F_i + + wg_i + \frac{\kappa}{2}|\eta_i|^2 \).

Definition at line 26 of file KKSMultiFreeEnergy.h.

Constructor & Destructor Documentation

◆ KKSMultiFreeEnergy()

KKSMultiFreeEnergy::KKSMultiFreeEnergy ( const InputParameters &  parameters)

Definition at line 39 of file KKSMultiFreeEnergy.C.

40  : TotalFreeEnergyBase(parameters),
41  _Fj_names(getParam<std::vector<MaterialPropertyName>>("Fj_names")),
42  _num_j(_Fj_names.size()),
44  _hj_names(getParam<std::vector<MaterialPropertyName>>("hj_names")),
46  _gj_names(getParam<std::vector<MaterialPropertyName>>("gj_names")),
48  _w(getParam<Real>("w")),
50 {
51  // Check that same number of Fj, hj, and gj are passed in
52  if (_hj_names.size() != _num_j)
53  mooseError("Size of hj_names is not equal to size of Fj_names in KKSMultiFreeEnergy AuxKernel ",
54  name());
55  if (_gj_names.size() != _num_j)
56  mooseError("Size of gj_names is not equal to size of Fj_names in KKSMultiFreeEnergy AuxKernel ",
57  name());
58 
59  // get bulk properties
60  for (unsigned int i = 0; i < _num_j; ++i)
61  {
62  _prop_Fj[i] = &getMaterialPropertyByName<Real>(_Fj_names[i]);
63  _prop_hj[i] = &getMaterialPropertyByName<Real>(_hj_names[i]);
64  _prop_gj[i] = &getMaterialPropertyByName<Real>(_gj_names[i]);
65  }
66 
67  // Check to ensure size of interfacial_vars is the same as kappa_names
68  if (_nvars != _nkappas)
69  mooseError("Size of interfacial_vars is not equal to the size of kappa_names in "
70  "KKSMultiFreeEnergy AuxKernel ",
71  name());
72 
73  // Assign kappa values
74  for (unsigned int i = 0; i < _nkappas; ++i)
75  _kappas[i] = &getMaterialPropertyByName<Real>(_kappa_names[i]);
76 }
const unsigned int _num_j
unsigned int _nvars
Coupled interface variables.
std::vector< const MaterialProperty< Real > * > _prop_hj
Values of the switching functions for each phase .
std::vector< MaterialPropertyName > _Fj_names
Names of free energy functions for each phase .
const Real _w
Barrier term height.
const std::string name
Definition: Setup.h:22
std::vector< const MaterialProperty< Real > * > _prop_gj
Values of the barrier functions for each phase .
std::vector< const MaterialProperty< Real > * > _prop_Fj
Values of the free energy functions for each phase .
std::vector< const MaterialProperty< Real > * > _kappas
Gradient interface free energy coefficients.
std::vector< MaterialPropertyName > _gj_names
Barrier function names.
TotalFreeEnergyBase(const InputParameters &parameters)
std::vector< MaterialPropertyName > _kappa_names
Gradient free energy prefactor kappa.
std::vector< MaterialPropertyName > _hj_names
Switching function names.

Member Function Documentation

◆ computeValue()

Real KKSMultiFreeEnergy::computeValue ( )
protectedvirtual

Implements TotalFreeEnergyBase.

Definition at line 79 of file KKSMultiFreeEnergy.C.

80 {
81  // Start with any additional energy contribution, which is 0 if not supplied
83  // Add bulk energy contributions
84  for (unsigned int i = 0; i < _num_j; ++i)
85  total_energy += (*_prop_hj[i])[_qp] * (*_prop_Fj[i])[_qp] + _w * (*_prop_gj[i])[_qp];
86 
87  // Add interfacial energy of each variable
88  for (unsigned int i = 0; i < _nvars; ++i)
89  total_energy += (*_kappas[i])[_qp] / 2.0 * (*_grad_vars[i])[_qp].norm_sq();
90 
91  return total_energy;
92 }
const unsigned int _num_j
unsigned int _nvars
Coupled interface variables.
const VariableValue & _additional_free_energy
Additional free energy contribution.
std::vector< const MaterialProperty< Real > * > _prop_hj
Values of the switching functions for each phase .
const Real _w
Barrier term height.
std::vector< const MaterialProperty< Real > * > _prop_gj
Values of the barrier functions for each phase .
std::vector< const MaterialProperty< Real > * > _prop_Fj
Values of the free energy functions for each phase .
std::vector< const MaterialProperty< Real > * > _kappas
Gradient interface free energy coefficients.
const std::string total_energy
Definition: NS.h:21
std::vector< const VariableGradient * > _grad_vars

Member Data Documentation

◆ _additional_free_energy

const VariableValue& TotalFreeEnergyBase::_additional_free_energy
protectedinherited

◆ _Fj_names

std::vector<MaterialPropertyName> KKSMultiFreeEnergy::_Fj_names
protected

Names of free energy functions for each phase \( F_j \).

Definition at line 35 of file KKSMultiFreeEnergy.h.

Referenced by KKSMultiFreeEnergy().

◆ _gj_names

std::vector<MaterialPropertyName> KKSMultiFreeEnergy::_gj_names
protected

Barrier function names.

Definition at line 48 of file KKSMultiFreeEnergy.h.

Referenced by KKSMultiFreeEnergy().

◆ _grad_vars

std::vector<const VariableGradient *> TotalFreeEnergyBase::_grad_vars
protectedinherited

◆ _hj_names

std::vector<MaterialPropertyName> KKSMultiFreeEnergy::_hj_names
protected

Switching function names.

Definition at line 42 of file KKSMultiFreeEnergy.h.

Referenced by KKSMultiFreeEnergy().

◆ _kappa_names

std::vector<MaterialPropertyName> TotalFreeEnergyBase::_kappa_names
protectedinherited

◆ _kappas

std::vector<const MaterialProperty<Real> *> KKSMultiFreeEnergy::_kappas
protected

Gradient interface free energy coefficients.

Definition at line 57 of file KKSMultiFreeEnergy.h.

Referenced by computeValue(), and KKSMultiFreeEnergy().

◆ _nkappas

unsigned int TotalFreeEnergyBase::_nkappas
protectedinherited

◆ _num_j

const unsigned int KKSMultiFreeEnergy::_num_j
protected

Definition at line 36 of file KKSMultiFreeEnergy.h.

Referenced by computeValue(), and KKSMultiFreeEnergy().

◆ _nvars

unsigned int TotalFreeEnergyBase::_nvars
protectedinherited

◆ _prop_Fj

std::vector<const MaterialProperty<Real> *> KKSMultiFreeEnergy::_prop_Fj
protected

Values of the free energy functions for each phase \( F_j \).

Definition at line 39 of file KKSMultiFreeEnergy.h.

Referenced by computeValue(), and KKSMultiFreeEnergy().

◆ _prop_gj

std::vector<const MaterialProperty<Real> *> KKSMultiFreeEnergy::_prop_gj
protected

Values of the barrier functions for each phase \( g_j \).

Definition at line 51 of file KKSMultiFreeEnergy.h.

Referenced by computeValue(), and KKSMultiFreeEnergy().

◆ _prop_hj

std::vector<const MaterialProperty<Real> *> KKSMultiFreeEnergy::_prop_hj
protected

Values of the switching functions for each phase \( h_j \).

Definition at line 45 of file KKSMultiFreeEnergy.h.

Referenced by computeValue(), and KKSMultiFreeEnergy().

◆ _vars

std::vector<const VariableValue *> TotalFreeEnergyBase::_vars
protectedinherited

◆ _w

const Real KKSMultiFreeEnergy::_w
protected

Barrier term height.

Definition at line 54 of file KKSMultiFreeEnergy.h.

Referenced by computeValue().


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