www.mooseframework.org
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
KKSCHBulk Class Referenceabstract

CHBulk child class that takes all the necessary data from a KKSBaseMaterial. More...

#include <KKSCHBulk.h>

Inheritance diagram for KKSCHBulk:
[legend]

Public Member Functions

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

Static Public Member Functions

static InputParameters validParams ()
 

Protected Types

enum  PFFunctionType
 

Protected Member Functions

virtual RealGradient computeGradDFDCons (PFFunctionType type)
 Note that per product and chain rules: \( \frac{d}{du_j}\left(F(u)\nabla u\right) = \nabla u \frac {dF(u)}{du}\frac{du}{du_j} + F(u)\frac{d\nabla u}{du_j} \) which is: \( \nabla u \frac {dF(u)}{du} \phi_j + F(u) \nabla \phi_j \). More...
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 
virtual RealGradient precomputeQpResidual ()
 
virtual RealGradient precomputeQpJacobian ()
 
virtual RealGradient computeGradDFDCons (PFFunctionType type)=0
 

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...
 

Private Attributes

unsigned int _nvar
 Number of coupled variables. More...
 
std::vector< const MaterialProperty< Real > * > _second_derivatives
 Derivatives of \( dFa/dca \) with respect to all coupled variables. More...
 
std::vector< std::vector< const MaterialProperty< Real > * > > _third_derivatives
 Second derivatives of dFa/dca with respect to all coupled variables. More...
 
std::vector< const MaterialProperty< Real > * > _third_derivatives_ca
 Derivatives of \( d^2Fa/dca^2 \) with respect to all coupled variables. More...
 
std::vector< const VariableGradient * > _grad_args
 Gradients for all coupled variables. More...
 
const MaterialProperty< Real > & _prop_h
 h(eta) material property More...
 
const MaterialProperty< Real > & _second_derivative_Fa
 Second derivative \( d^2Fa/dca^2 \). More...
 
const MaterialProperty< Real > & _second_derivative_Fb
 Second derivative \( d^2Fb/dcb^2 \). More...
 
unsigned int _ca_var
 
const VariableName _ca_name
 
unsigned int _cb_var
 
const VariableName _cb_name
 

Detailed Description

CHBulk child class that takes all the necessary data from a KKSBaseMaterial.

We calculate \( \nabla\frac{\partial F_a}{\partial c_a} \). This takes advantage of the KKS identity

\( dF/dc = dF_a/dc_a (= dF_b/dc_b) \)

The non-linear variable for this Kernel is the concentration 'c'. The user picks one phase free energy \( F_a \) (f_base) and its corresponding phase concentration \( c_a \)

Definition at line 32 of file KKSCHBulk.h.

Member Enumeration Documentation

◆ PFFunctionType

enum CHBulk::PFFunctionType
protectedinherited

Definition at line 38 of file CHBulk.h.

39  {
40  Jacobian,
41  Residual
42  };

Constructor & Destructor Documentation

◆ KKSCHBulk()

KKSCHBulk::KKSCHBulk ( const InputParameters &  parameters)

Definition at line 40 of file KKSCHBulk.C.

41  : CHBulk<Real>(parameters),
42  // number of coupled variables (ca, args_a[])
43  _nvar(_coupled_moose_vars.size()),
44  _ca_var(coupled("ca")),
45  _ca_name(getVar("ca", 0)->name()),
46  _cb_var(coupled("cb")),
47  _cb_name(getVar("cb", 0)->name()),
48  _prop_h(getMaterialProperty<Real>("h_name")),
49  _second_derivative_Fa(getMaterialPropertyDerivative<Real>("fa_name", _ca_name, _ca_name)),
50  _second_derivative_Fb(getMaterialPropertyDerivative<Real>("fb_name", _cb_name, _cb_name))
51 {
52  // reserve space for derivatives
53  _second_derivatives.resize(_nvar);
54  _third_derivatives.resize(_nvar);
56  _grad_args.resize(_nvar);
57 
58  // Iterate over all coupled variables
59  for (unsigned int i = 0; i < _nvar; ++i)
60  {
61  MooseVariable * cvar = _coupled_standard_moose_vars[i];
62 
63  // get the second derivative material property (TODO:warn)
65  &getMaterialPropertyDerivative<Real>("fa_name", _ca_name, cvar->name());
66 
67  // get the third derivative material properties
68  _third_derivatives[i].resize(_nvar);
69  for (unsigned int j = 0; j < _nvar; ++j)
70  _third_derivatives[i][j] = &getMaterialPropertyDerivative<Real>(
71  "fa_name", _ca_name, cvar->name(), _coupled_moose_vars[j]->name());
72 
73  // third derivative for the on-diagonal jacobian
75  &getMaterialPropertyDerivative<Real>("fa_name", _ca_name, cvar->name(), _ca_name);
76 
77  // get the gradient
78  _grad_args[i] = &(cvar->gradSln());
79  }
80 }

Member Function Documentation

◆ computeGradDFDCons() [1/2]

RealGradient KKSCHBulk::computeGradDFDCons ( PFFunctionType  type)
protectedvirtual

Note that per product and chain rules: \( \frac{d}{du_j}\left(F(u)\nabla u\right) = \nabla u \frac {dF(u)}{du}\frac{du}{du_j} + F(u)\frac{d\nabla u}{du_j} \) which is: \( \nabla u \frac {dF(u)}{du} \phi_j + F(u) \nabla \phi_j \).

Definition at line 90 of file KKSCHBulk.C.

91 {
92  RealGradient res = 0.0;
93 
94  switch (type)
95  {
96  case Residual:
97  for (unsigned int i = 0; i < _nvar; ++i)
98  res += (*_second_derivatives[i])[_qp] * (*_grad_args[i])[_qp];
99 
100  return res;
101 
102  case Jacobian:
103  // the non linear variable is c, but the free energy only contains the
104  // phase concentrations. Equation (23) in the KKS paper gives the chain-
105  // rule derivative dca/dc
106  /* Real dcadc = _second_derivative_Fb[_qp]
107  / ( (1.0 - _prop_h[_qp]) * _second_derivative_Fb[_qp]
108  + _prop_h[_qp] * _second_derivative_Fa[_qp]); */
109  // The (1-h)*X_b, h*X_a pairing is opposite to what the KKSPhaseConcentration kernel does!
110 
111  res = _second_derivative_Fa[_qp] * _grad_phi[_j][_qp];
112 
113  for (unsigned int i = 0; i < _nvar; ++i)
114  res += (*_third_derivatives_ca[i])[_qp] * (*_grad_args[i])[_qp] * _phi[_j][_qp];
115 
116  // convergence improves if we return 0.0 here
117  return 0.0; // res * dcadc;
118  }
119 
120  mooseError("Invalid type passed in");
121 }

◆ computeGradDFDCons() [2/2]

virtual RealGradient CHBulk< Real >::computeGradDFDCons ( PFFunctionType  type)
protectedpure virtualinherited

Implemented in CahnHilliardBase< Real >.

◆ computeQpOffDiagJacobian()

Real KKSCHBulk::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Reimplemented from CHBulk< Real >.

Definition at line 124 of file KKSCHBulk.C.

125 {
126  // get the coupled variable jvar is referring to
127  const unsigned int cvar = mapJvarToCvar(jvar);
128 
129  RealGradient res = (*_second_derivatives[cvar])[_qp] * _grad_phi[_j][_qp];
130 
131  for (unsigned int i = 0; i < _nvar; ++i)
132  res += (*_third_derivatives[i][cvar])[_qp] * (*_grad_args[i])[_qp] * _phi[_j][_qp];
133 
134  // keeping this term seems to improve the solution.
135  return res * _grad_test[_i][_qp];
136 }

◆ initialSetup()

void CHBulk< Real >::initialSetup ( )
virtualinherited

Reimplemented in CahnHilliardBase< Real >.

Definition at line 86 of file CHBulk.h.

87 {
88  validateNonlinearCoupling<Real>("mob_name");
89 }

◆ precomputeQpJacobian()

RealGradient CHBulk< Real >::precomputeQpJacobian ( )
protectedvirtualinherited

Definition at line 100 of file CHBulk.h.

101 {
102  RealGradient grad_value = _M[_qp] * computeGradDFDCons(Jacobian) +
103  _dMdc[_qp] * _phi[_j][_qp] * computeGradDFDCons(Residual);
104 
105  return grad_value;
106 }

◆ precomputeQpResidual()

RealGradient CHBulk< Real >::precomputeQpResidual ( )
protectedvirtualinherited

Definition at line 93 of file CHBulk.h.

94 {
95  return _M[_qp] * computeGradDFDCons(Residual);
96 }

◆ validParams()

InputParameters CHBulk< Real >::validParams ( )
staticinherited

Definition at line 75 of file CHBulk.h.

76 {
77  InputParameters params = ::validParams<KernelGrad>();
78  params.addClassDescription("Cahn-Hilliard base Kernel");
79  params.addParam<MaterialPropertyName>("mob_name", "M", "The mobility used with the kernel");
80  params.addCoupledVar("args", "Vector of arguments of the mobility");
81  return params;
82 }

Member Data Documentation

◆ _ca_name

const VariableName KKSCHBulk::_ca_name
private

Definition at line 48 of file KKSCHBulk.h.

Referenced by KKSCHBulk().

◆ _ca_var

unsigned int KKSCHBulk::_ca_var
private

Phase concnetration variables

Definition at line 47 of file KKSCHBulk.h.

◆ _cb_name

const VariableName KKSCHBulk::_cb_name
private

Definition at line 50 of file KKSCHBulk.h.

◆ _cb_var

unsigned int KKSCHBulk::_cb_var
private

Definition at line 49 of file KKSCHBulk.h.

◆ _dMdarg

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

Mobility derivative w.r.t coupled variables.

Definition at line 53 of file CHBulk.h.

◆ _dMdc

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

Mobility derivative w.r.t. concentration.

Definition at line 50 of file CHBulk.h.

◆ _grad_args

std::vector<const VariableGradient *> KKSCHBulk::_grad_args
private

Gradients for all coupled variables.

Definition at line 63 of file KKSCHBulk.h.

Referenced by computeGradDFDCons(), computeQpOffDiagJacobian(), and KKSCHBulk().

◆ _M

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

Mobility.

Definition at line 47 of file CHBulk.h.

◆ _nvar

unsigned int KKSCHBulk::_nvar
private

Number of coupled variables.

Definition at line 43 of file KKSCHBulk.h.

Referenced by computeGradDFDCons(), computeQpOffDiagJacobian(), and KKSCHBulk().

◆ _prop_h

const MaterialProperty<Real>& KKSCHBulk::_prop_h
private

h(eta) material property

Definition at line 66 of file KKSCHBulk.h.

◆ _second_derivative_Fa

const MaterialProperty<Real>& KKSCHBulk::_second_derivative_Fa
private

Second derivative \( d^2Fa/dca^2 \).

Definition at line 69 of file KKSCHBulk.h.

Referenced by computeGradDFDCons().

◆ _second_derivative_Fb

const MaterialProperty<Real>& KKSCHBulk::_second_derivative_Fb
private

Second derivative \( d^2Fb/dcb^2 \).

Definition at line 72 of file KKSCHBulk.h.

◆ _second_derivatives

std::vector<const MaterialProperty<Real> *> KKSCHBulk::_second_derivatives
private

Derivatives of \( dFa/dca \) with respect to all coupled variables.

Definition at line 54 of file KKSCHBulk.h.

Referenced by computeGradDFDCons(), computeQpOffDiagJacobian(), and KKSCHBulk().

◆ _third_derivatives

std::vector<std::vector<const MaterialProperty<Real> *> > KKSCHBulk::_third_derivatives
private

Second derivatives of dFa/dca with respect to all coupled variables.

Definition at line 57 of file KKSCHBulk.h.

Referenced by computeQpOffDiagJacobian(), and KKSCHBulk().

◆ _third_derivatives_ca

std::vector<const MaterialProperty<Real> *> KKSCHBulk::_third_derivatives_ca
private

Derivatives of \( d^2Fa/dca^2 \) with respect to all coupled variables.

Definition at line 60 of file KKSCHBulk.h.

Referenced by computeGradDFDCons(), and KKSCHBulk().


The documentation for this class was generated from the following files:
KKSCHBulk::_second_derivative_Fb
const MaterialProperty< Real > & _second_derivative_Fb
Second derivative .
Definition: KKSCHBulk.h:72
KKSCHBulk::_second_derivative_Fa
const MaterialProperty< Real > & _second_derivative_Fa
Second derivative .
Definition: KKSCHBulk.h:69
CHBulk< Real >::computeGradDFDCons
virtual RealGradient computeGradDFDCons(PFFunctionType type)=0
KKSCHBulk::_ca_var
unsigned int _ca_var
Definition: KKSCHBulk.h:47
libMesh::RealGradient
VectorValue< Real > RealGradient
Definition: GrainForceAndTorqueInterface.h:17
KKSCHBulk::_second_derivatives
std::vector< const MaterialProperty< Real > * > _second_derivatives
Derivatives of with respect to all coupled variables.
Definition: KKSCHBulk.h:54
KKSCHBulk::_cb_name
const VariableName _cb_name
Definition: KKSCHBulk.h:50
KKSCHBulk::_prop_h
const MaterialProperty< Real > & _prop_h
h(eta) material property
Definition: KKSCHBulk.h:66
KKSCHBulk::_nvar
unsigned int _nvar
Number of coupled variables.
Definition: KKSCHBulk.h:43
CHBulk< Real >::Jacobian
Definition: CHBulk.h:40
KKSCHBulk::_third_derivatives
std::vector< std::vector< const MaterialProperty< Real > * > > _third_derivatives
Second derivatives of dFa/dca with respect to all coupled variables.
Definition: KKSCHBulk.h:57
KKSCHBulk::_ca_name
const VariableName _ca_name
Definition: KKSCHBulk.h:48
CHBulk< Real >::Residual
Definition: CHBulk.h:41
KKSCHBulk::_grad_args
std::vector< const VariableGradient * > _grad_args
Gradients for all coupled variables.
Definition: KKSCHBulk.h:63
CHBulk< Real >::_dMdc
const MaterialProperty< Real > & _dMdc
Mobility derivative w.r.t. concentration.
Definition: CHBulk.h:50
KKSCHBulk::_third_derivatives_ca
std::vector< const MaterialProperty< Real > * > _third_derivatives_ca
Derivatives of with respect to all coupled variables.
Definition: KKSCHBulk.h:60
CHBulk< Real >::_M
const MaterialProperty< Real > & _M
Mobility.
Definition: CHBulk.h:47
KKSCHBulk::_cb_var
unsigned int _cb_var
Definition: KKSCHBulk.h:49
CHBulk< Real >