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

Member Enumeration Documentation

◆ PFFunctionType

enum CHBulk::PFFunctionType
protectedinherited

Definition at line 39 of file CHBulk.h.

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 }
std::vector< const MaterialProperty< Real > * > _third_derivatives_ca
Derivatives of with respect to all coupled variables.
Definition: KKSCHBulk.h:61
std::vector< const MaterialProperty< Real > * > _second_derivatives
Derivatives of with respect to all coupled variables.
Definition: KKSCHBulk.h:55
const VariableName _ca_name
Definition: KKSCHBulk.h:49
unsigned int _ca_var
Definition: KKSCHBulk.h:48
const MaterialProperty< Real > & _prop_h
h(eta) material property
Definition: KKSCHBulk.h:67
const MaterialProperty< Real > & _second_derivative_Fa
Second derivative .
Definition: KKSCHBulk.h:70
unsigned int _cb_var
Definition: KKSCHBulk.h:50
std::vector< const VariableGradient * > _grad_args
Gradients for all coupled variables.
Definition: KKSCHBulk.h:64
const MaterialProperty< Real > & _second_derivative_Fb
Second derivative .
Definition: KKSCHBulk.h:73
const VariableName _cb_name
Definition: KKSCHBulk.h:51
unsigned int _nvar
Number of coupled variables.
Definition: KKSCHBulk.h:44
std::vector< std::vector< const MaterialProperty< Real > * > > _third_derivatives
Second derivatives of dFa/dca with respect to all coupled variables.
Definition: KKSCHBulk.h:58

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 }
std::vector< const MaterialProperty< Real > * > _third_derivatives_ca
Derivatives of with respect to all coupled variables.
Definition: KKSCHBulk.h:61
std::vector< const MaterialProperty< Real > * > _second_derivatives
Derivatives of with respect to all coupled variables.
Definition: KKSCHBulk.h:55
const MaterialProperty< Real > & _second_derivative_Fa
Second derivative .
Definition: KKSCHBulk.h:70
std::vector< const VariableGradient * > _grad_args
Gradients for all coupled variables.
Definition: KKSCHBulk.h:64
unsigned int _nvar
Number of coupled variables.
Definition: KKSCHBulk.h:44

◆ 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 }
std::vector< const MaterialProperty< Real > * > _second_derivatives
Derivatives of with respect to all coupled variables.
Definition: KKSCHBulk.h:55
std::vector< const VariableGradient * > _grad_args
Gradients for all coupled variables.
Definition: KKSCHBulk.h:64
unsigned int _nvar
Number of coupled variables.
Definition: KKSCHBulk.h:44
std::vector< std::vector< const MaterialProperty< Real > * > > _third_derivatives
Second derivatives of dFa/dca with respect to all coupled variables.
Definition: KKSCHBulk.h:58

◆ initialSetup()

void CHBulk< Real >::initialSetup ( )
virtualinherited

Reimplemented in CahnHilliardBase< Real >.

Definition at line 87 of file CHBulk.h.

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

◆ precomputeQpJacobian()

RealGradient CHBulk< Real >::precomputeQpJacobian ( )
protectedvirtualinherited

Definition at line 101 of file CHBulk.h.

102 {
103  RealGradient grad_value = _M[_qp] * computeGradDFDCons(Jacobian) +
104  _dMdc[_qp] * _phi[_j][_qp] * computeGradDFDCons(Residual);
105 
106  return grad_value;
107 }
virtual RealGradient computeGradDFDCons(PFFunctionType type)=0
const MaterialProperty< Real > & _M
Mobility.
Definition: CHBulk.h:48
const MaterialProperty< Real > & _dMdc
Mobility derivative w.r.t. concentration.
Definition: CHBulk.h:51

◆ precomputeQpResidual()

RealGradient CHBulk< Real >::precomputeQpResidual ( )
protectedvirtualinherited

Definition at line 94 of file CHBulk.h.

95 {
96  return _M[_qp] * computeGradDFDCons(Residual);
97 }
virtual RealGradient computeGradDFDCons(PFFunctionType type)=0
const MaterialProperty< Real > & _M
Mobility.
Definition: CHBulk.h:48

◆ validParams()

InputParameters CHBulk< Real >::validParams ( )
staticinherited

Definition at line 76 of file CHBulk.h.

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

Member Data Documentation

◆ _ca_name

const VariableName KKSCHBulk::_ca_name
private

Definition at line 49 of file KKSCHBulk.h.

Referenced by KKSCHBulk().

◆ _ca_var

unsigned int KKSCHBulk::_ca_var
private

Phase concnetration variables

Definition at line 48 of file KKSCHBulk.h.

◆ _cb_name

const VariableName KKSCHBulk::_cb_name
private

Definition at line 51 of file KKSCHBulk.h.

◆ _cb_var

unsigned int KKSCHBulk::_cb_var
private

Definition at line 50 of file KKSCHBulk.h.

◆ _dMdarg

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

Mobility derivative w.r.t coupled variables.

Definition at line 54 of file CHBulk.h.

◆ _dMdc

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

Mobility derivative w.r.t. concentration.

Definition at line 51 of file CHBulk.h.

◆ _grad_args

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

Gradients for all coupled variables.

Definition at line 64 of file KKSCHBulk.h.

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

◆ _M

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

Mobility.

Definition at line 48 of file CHBulk.h.

◆ _nvar

unsigned int KKSCHBulk::_nvar
private

Number of coupled variables.

Definition at line 44 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 67 of file KKSCHBulk.h.

◆ _second_derivative_Fa

const MaterialProperty<Real>& KKSCHBulk::_second_derivative_Fa
private

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

Definition at line 70 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 73 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 55 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 58 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 61 of file KKSCHBulk.h.

Referenced by computeGradDFDCons(), and KKSCHBulk().


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