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 Reference

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 ()
 

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 30 of file KKSCHBulk.h.

Member Enumeration Documentation

enum CHBulk::PFFunctionType
protectedinherited

Definition at line 36 of file CHBulk.h.

Constructor & Destructor Documentation

KKSCHBulk::KKSCHBulk ( const InputParameters &  parameters)

Definition at line 35 of file KKSCHBulk.C.

36  : CHBulk<Real>(parameters),
37  // number of coupled variables (ca, args_a[])
38  _nvar(_coupled_moose_vars.size()),
39  _ca_var(coupled("ca")),
40  _ca_name(getVar("ca", 0)->name()),
41  _cb_var(coupled("cb")),
42  _cb_name(getVar("cb", 0)->name()),
43  _prop_h(getMaterialProperty<Real>("h_name")),
44  _second_derivative_Fa(getMaterialPropertyDerivative<Real>("fa_name", _ca_name, _ca_name)),
45  _second_derivative_Fb(getMaterialPropertyDerivative<Real>("fb_name", _cb_name, _cb_name))
46 {
47  // reserve space for derivatives
48  _second_derivatives.resize(_nvar);
49  _third_derivatives.resize(_nvar);
51  _grad_args.resize(_nvar);
52 
53  // Iterate over all coupled variables
54  for (unsigned int i = 0; i < _nvar; ++i)
55  {
56  MooseVariable * cvar = _coupled_moose_vars[i];
57 
58  // get the second derivative material property (TODO:warn)
60  &getMaterialPropertyDerivative<Real>("fa_name", _ca_name, cvar->name());
61 
62  // get the third derivative material properties
63  _third_derivatives[i].resize(_nvar);
64  for (unsigned int j = 0; j < _nvar; ++j)
65  _third_derivatives[i][j] = &getMaterialPropertyDerivative<Real>(
66  "fa_name", _ca_name, cvar->name(), _coupled_moose_vars[j]->name());
67 
68  // third derivative for the on-diagonal jacobian
70  &getMaterialPropertyDerivative<Real>("fa_name", _ca_name, cvar->name(), _ca_name);
71 
72  // get the gradient
73  _grad_args[i] = &(cvar->gradSln());
74  }
75 }
std::vector< const MaterialProperty< Real > * > _third_derivatives_ca
Derivatives of with respect to all coupled variables.
Definition: KKSCHBulk.h:58
std::vector< const MaterialProperty< Real > * > _second_derivatives
Derivatives of with respect to all coupled variables.
Definition: KKSCHBulk.h:52
const VariableName _ca_name
Definition: KKSCHBulk.h:46
unsigned int _ca_var
Definition: KKSCHBulk.h:45
const MaterialProperty< Real > & _prop_h
h(eta) material property
Definition: KKSCHBulk.h:64
const MaterialProperty< Real > & _second_derivative_Fa
Second derivative .
Definition: KKSCHBulk.h:67
unsigned int _cb_var
Definition: KKSCHBulk.h:47
std::vector< const VariableGradient * > _grad_args
Gradients for all coupled variables.
Definition: KKSCHBulk.h:61
const MaterialProperty< Real > & _second_derivative_Fb
Second derivative .
Definition: KKSCHBulk.h:70
const VariableName _cb_name
Definition: KKSCHBulk.h:48
unsigned int _nvar
Number of coupled variables.
Definition: KKSCHBulk.h:41
std::vector< std::vector< const MaterialProperty< Real > * > > _third_derivatives
Second derivatives of dFa/dca with respect to all coupled variables.
Definition: KKSCHBulk.h:55

Member Function Documentation

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

Implements CHBulk< Real >.

Definition at line 85 of file KKSCHBulk.C.

86 {
87  RealGradient res = 0.0;
88 
89  switch (type)
90  {
91  case Residual:
92  for (unsigned int i = 0; i < _nvar; ++i)
93  res += (*_second_derivatives[i])[_qp] * (*_grad_args[i])[_qp];
94 
95  return res;
96 
97  case Jacobian:
98  // the non linear variable is c, but the free energy only contains the
99  // phase concentrations. Equation (23) in the KKS paper gives the chain-
100  // rule derivative dca/dc
101  /* Real dcadc = _second_derivative_Fb[_qp]
102  / ( (1.0 - _prop_h[_qp]) * _second_derivative_Fb[_qp]
103  + _prop_h[_qp] * _second_derivative_Fa[_qp]); */
104  // The (1-h)*X_b, h*X_a pairing is opposite to what the KKSPhaseConcentration kernel does!
105 
106  res = _second_derivative_Fa[_qp] * _grad_phi[_j][_qp];
107 
108  for (unsigned int i = 0; i < _nvar; ++i)
109  res += (*_third_derivatives_ca[i])[_qp] * (*_grad_args[i])[_qp] * _phi[_j][_qp];
110 
111  // convergence improves if we return 0.0 here
112  return 0.0; // res * dcadc;
113  }
114 
115  mooseError("Invalid type passed in");
116 }
std::vector< const MaterialProperty< Real > * > _third_derivatives_ca
Derivatives of with respect to all coupled variables.
Definition: KKSCHBulk.h:58
std::vector< const MaterialProperty< Real > * > _second_derivatives
Derivatives of with respect to all coupled variables.
Definition: KKSCHBulk.h:52
const MaterialProperty< Real > & _second_derivative_Fa
Second derivative .
Definition: KKSCHBulk.h:67
std::vector< const VariableGradient * > _grad_args
Gradients for all coupled variables.
Definition: KKSCHBulk.h:61
unsigned int _nvar
Number of coupled variables.
Definition: KKSCHBulk.h:41
Real KKSCHBulk::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Reimplemented from CHBulk< Real >.

Definition at line 119 of file KKSCHBulk.C.

120 {
121  // get the coupled variable jvar is referring to
122  const unsigned int cvar = mapJvarToCvar(jvar);
123 
124  RealGradient res = (*_second_derivatives[cvar])[_qp] * _grad_phi[_j][_qp];
125 
126  for (unsigned int i = 0; i < _nvar; ++i)
127  res += (*_third_derivatives[i][cvar])[_qp] * (*_grad_args[i])[_qp] * _phi[_j][_qp];
128 
129  // keeping this term seems to improve the solution.
130  return res * _grad_test[_i][_qp];
131 }
std::vector< const MaterialProperty< Real > * > _second_derivatives
Derivatives of with respect to all coupled variables.
Definition: KKSCHBulk.h:52
std::vector< const VariableGradient * > _grad_args
Gradients for all coupled variables.
Definition: KKSCHBulk.h:61
unsigned int _nvar
Number of coupled variables.
Definition: KKSCHBulk.h:41
std::vector< std::vector< const MaterialProperty< Real > * > > _third_derivatives
Second derivatives of dFa/dca with respect to all coupled variables.
Definition: KKSCHBulk.h:55
virtual void CHBulk< Real >::initialSetup ( )
virtualinherited

Reimplemented in CahnHilliardBase< Real >.

virtual RealGradient CHBulk< Real >::precomputeQpJacobian ( )
protectedvirtualinherited
virtual RealGradient CHBulk< Real >::precomputeQpResidual ( )
protectedvirtualinherited
static InputParameters CHBulk< Real >::validParams ( )
staticinherited

Member Data Documentation

const VariableName KKSCHBulk::_ca_name
private

Definition at line 46 of file KKSCHBulk.h.

Referenced by KKSCHBulk().

unsigned int KKSCHBulk::_ca_var
private

Phase concnetration variables

Definition at line 45 of file KKSCHBulk.h.

const VariableName KKSCHBulk::_cb_name
private

Definition at line 48 of file KKSCHBulk.h.

unsigned int KKSCHBulk::_cb_var
private

Definition at line 47 of file KKSCHBulk.h.

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

Mobility derivative w.r.t coupled variables.

Definition at line 51 of file CHBulk.h.

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

Mobility derivative w.r.t. concentration.

Definition at line 48 of file CHBulk.h.

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

Gradients for all coupled variables.

Definition at line 61 of file KKSCHBulk.h.

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

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

Mobility.

Definition at line 45 of file CHBulk.h.

unsigned int KKSCHBulk::_nvar
private

Number of coupled variables.

Definition at line 41 of file KKSCHBulk.h.

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

const MaterialProperty<Real>& KKSCHBulk::_prop_h
private

h(eta) material property

Definition at line 64 of file KKSCHBulk.h.

const MaterialProperty<Real>& KKSCHBulk::_second_derivative_Fa
private

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

Definition at line 67 of file KKSCHBulk.h.

Referenced by computeGradDFDCons().

const MaterialProperty<Real>& KKSCHBulk::_second_derivative_Fb
private

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

Definition at line 70 of file KKSCHBulk.h.

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

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

Definition at line 52 of file KKSCHBulk.h.

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

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 55 of file KKSCHBulk.h.

Referenced by computeQpOffDiagJacobian(), and KKSCHBulk().

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 58 of file KKSCHBulk.h.

Referenced by computeGradDFDCons(), and KKSCHBulk().


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