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

Several kernels use a material property called mu. More...

#include <ACBarrierFunction.h>

Inheritance diagram for ACBarrierFunction:
[legend]

Public Member Functions

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

Static Public Member Functions

static InputParameters validParams ()
 

Protected Types

enum  PFFunctionType
 

Protected Member Functions

virtual Real computeDFDOP (PFFunctionType type)
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 
virtual Real precomputeQpResidual ()
 
virtual Real precomputeQpJacobian ()
 
virtual Real computeDFDOP (PFFunctionType type)=0
 

Protected Attributes

unsigned int _n_eta
 
const NonlinearVariableName _uname
 
const MaterialPropertyName _gamma_name
 
const MaterialProperty< Real > & _gamma
 
const MaterialProperty< Real > & _dmudvar
 
const MaterialProperty< Real > & _d2mudvar2
 
const std::vector< VariableName > _vname
 
std::vector< const MaterialProperty< Real > * > _d2mudvardeta
 
const unsigned int _op_num
 
std::vector< const VariableValue * > _vals
 
std::vector< unsigned int > _vals_var
 
const MaterialProperty< Real > & _mu
 
const MaterialProperty< Real > & _L
 Mobility. More...
 
const MaterialProperty< Real > & _dLdop
 Mobility derivative w.r.t. order parameter. More...
 
std::vector< const MaterialProperty< Real > *> _dLdarg
 Mobility derivative w.r.t coupled variables. More...
 

Private Member Functions

Real calculateF0 ()
 

Detailed Description

Several kernels use a material property called mu.

If mu is not a constant, then this kernel will calculate the bulk AC term where mu is the derivative term. It currently only takes a single value for gamma.

Definition at line 25 of file ACBarrierFunction.h.

Member Enumeration Documentation

◆ PFFunctionType

enum ACBulk::PFFunctionType
protectedinherited

Definition at line 38 of file ACBulk.h.

Constructor & Destructor Documentation

◆ ACBarrierFunction()

ACBarrierFunction::ACBarrierFunction ( const InputParameters &  parameters)

Definition at line 26 of file ACBarrierFunction.C.

27  : ACGrGrBase(parameters),
28  _n_eta(_vals.size()),
29  _uname(getParam<NonlinearVariableName>("variable")),
30  _gamma_name(getParam<MaterialPropertyName>("gamma")),
31  _gamma(getMaterialPropertyByName<Real>(_gamma_name)),
32  _dmudvar(getMaterialPropertyDerivative<Real>("mu", _uname)),
33  _d2mudvar2(getMaterialPropertyDerivative<Real>("mu", _uname, _uname)),
34  _vname(getParam<std::vector<VariableName>>("v")),
36 {
37  for (unsigned int i = 0; i < _n_eta; ++i)
38  _d2mudvardeta[i] = &getMaterialPropertyDerivative<Real>("mu", _uname, _vname[i]);
39 }
ACGrGrBase(const InputParameters &parameters)
Definition: ACGrGrBase.C:22
const std::vector< VariableName > _vname
const NonlinearVariableName _uname
const MaterialPropertyName _gamma_name
const MaterialProperty< Real > & _gamma
std::vector< const MaterialProperty< Real > * > _d2mudvardeta
const MaterialProperty< Real > & _dmudvar
std::vector< const VariableValue * > _vals
Definition: ACGrGrBase.h:34
const MaterialProperty< Real > & _d2mudvar2

Member Function Documentation

◆ calculateF0()

Real ACBarrierFunction::calculateF0 ( )
private

Definition at line 87 of file ACBarrierFunction.C.

Referenced by computeDFDOP(), and computeQpOffDiagJacobian().

88 {
89  Real var_phase = 0.25 * _u[_qp] * _u[_qp] * _u[_qp] * _u[_qp] - 0.5 * _u[_qp] * _u[_qp];
90  Real eta_phase = 0.0;
91  Real eta_interface = 0.0;
92  Real sum_eta_j2;
93 
94  for (unsigned int i = 0; i < _n_eta; ++i)
95  {
96  sum_eta_j2 = 0.0;
97  for (unsigned int j = i + 1; j < _n_eta; ++j)
98  sum_eta_j2 += (*_vals[j])[_qp] * (*_vals[j])[_qp];
99  // eta_phase += 0.25 * (*_vals[i])[_qp] * (*_vals[i])[_qp] * (*_vals[i])[_qp] * (*_vals[i])[_qp]
100  // -
101  // 0.5 * (*_vals[i])[_qp] * (*_vals[i])[_qp];
102  eta_phase += 0.25 * Utility::pow<4>((*_vals[i])[_qp]) - 0.5 * Utility::pow<2>((*_vals[i])[_qp]);
103  eta_interface +=
104  (_u[_qp] * _u[_qp] + sum_eta_j2) * (*_vals[i])[_qp] * (*_vals[i])[_qp] * _gamma[_qp];
105  }
106  return 0.25 + var_phase + eta_phase + eta_interface;
107 }
const MaterialProperty< Real > & _gamma
std::vector< const VariableValue * > _vals
Definition: ACGrGrBase.h:34

◆ computeDFDOP() [1/2]

Real ACBarrierFunction::computeDFDOP ( PFFunctionType  type)
protectedvirtual

Definition at line 42 of file ACBarrierFunction.C.

43 {
44  switch (type)
45  {
46  case Residual:
47  return _dmudvar[_qp] * calculateF0();
48 
49  case Jacobian:
50  {
51  Real df0dvar = 0.0;
52  for (unsigned int i = 0; i < _n_eta; ++i)
53  df0dvar += (*_vals[i])[_qp] * (*_vals[i])[_qp];
54 
55  df0dvar *= 2.0 * _gamma[_qp] * _u[_qp];
56  df0dvar += _u[_qp] * _u[_qp] * _u[_qp] - _u[_qp];
57 
58  return (_d2mudvar2[_qp] * calculateF0() + _dmudvar[_qp] * df0dvar) * _phi[_j][_qp];
59  }
60 
61  default:
62  mooseError("Invalid type passed in");
63  }
64 }
const MaterialProperty< Real > & _gamma
const MaterialProperty< Real > & _dmudvar
std::vector< const VariableValue * > _vals
Definition: ACGrGrBase.h:34
const MaterialProperty< Real > & _d2mudvar2

◆ computeDFDOP() [2/2]

virtual Real ACBulk< Real >::computeDFDOP ( PFFunctionType  type)
protectedpure virtualinherited

◆ computeQpOffDiagJacobian()

Real ACBarrierFunction::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Reimplemented from ACBulk< Real >.

Definition at line 67 of file ACBarrierFunction.C.

68 {
69  const unsigned int j = mapJvarToCvar(jvar);
70  Real sum_etai2 = 0.0;
71  Real df0deta_base = 0.0;
72  Real df0deta = 0.0;
73 
74  for (unsigned int i = 0; i < _n_eta; ++i)
75  if (i != j)
76  sum_etai2 += (*_vals[i])[_qp] * (*_vals[i])[_qp];
77 
78  df0deta_base = (*_vals[j])[_qp] * (*_vals[j])[_qp] - 1.0 +
79  2.0 * _gamma[_qp] * (_u[_qp] * _u[_qp] + sum_etai2);
80  df0deta = (*_vals[j])[_qp] * df0deta_base;
81 
82  return ((*_d2mudvardeta[j])[_qp] * calculateF0() + _dmudvar[_qp] * df0deta) * _phi[_j][_qp] *
83  _test[_i][_qp] * _L[_qp];
84 }
const MaterialProperty< Real > & _L
Mobility.
Definition: ACBulk.h:47
const MaterialProperty< Real > & _gamma
std::vector< const MaterialProperty< Real > * > _d2mudvardeta
const MaterialProperty< Real > & _dmudvar
std::vector< const VariableValue * > _vals
Definition: ACGrGrBase.h:34

◆ initialSetup()

void ACBulk< Real >::initialSetup ( )
virtualinherited

Reimplemented in KKSMultiACBulkBase, CoupledAllenCahn, KKSACBulkBase, and AllenCahn.

Definition at line 86 of file ACBulk.h.

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

◆ precomputeQpJacobian()

Real ACBulk< Real >::precomputeQpJacobian ( )
protectedvirtualinherited

Definition at line 104 of file ACBulk.h.

105 {
106  // Get free energy derivative and Jacobian
107  Real dFdop = computeDFDOP(Residual);
108 
109  Real JdFdop = computeDFDOP(Jacobian);
110 
111  // Set Jacobian value using product rule
112  return _L[_qp] * JdFdop + _dLdop[_qp] * _phi[_j][_qp] * dFdop;
113 }
const MaterialProperty< Real > & _L
Mobility.
Definition: ACBulk.h:47
virtual Real computeDFDOP(PFFunctionType type)=0
const MaterialProperty< Real > & _dLdop
Mobility derivative w.r.t. order parameter.
Definition: ACBulk.h:50

◆ precomputeQpResidual()

Real ACBulk< Real >::precomputeQpResidual ( )
protectedvirtualinherited

Definition at line 93 of file ACBulk.h.

94 {
95  // Get free energy derivative from function
96  Real dFdop = computeDFDOP(Residual);
97 
98  // Set residual
99  return _L[_qp] * dFdop;
100 }
const MaterialProperty< Real > & _L
Mobility.
Definition: ACBulk.h:47
virtual Real computeDFDOP(PFFunctionType type)=0

◆ validParams()

InputParameters ACBulk< Real >::validParams ( )
staticinherited

Definition at line 75 of file ACBulk.h.

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

Member Data Documentation

◆ _d2mudvar2

const MaterialProperty<Real>& ACBarrierFunction::_d2mudvar2
protected

Definition at line 39 of file ACBarrierFunction.h.

Referenced by computeDFDOP().

◆ _d2mudvardeta

std::vector<const MaterialProperty<Real> *> ACBarrierFunction::_d2mudvardeta
protected

Definition at line 42 of file ACBarrierFunction.h.

Referenced by ACBarrierFunction(), and computeQpOffDiagJacobian().

◆ _dLdarg

std::vector<const MaterialProperty<Real > *> ACBulk< Real >::_dLdarg
protectedinherited

Mobility derivative w.r.t coupled variables.

Definition at line 53 of file ACBulk.h.

◆ _dLdop

const MaterialProperty<Real >& ACBulk< Real >::_dLdop
protectedinherited

Mobility derivative w.r.t. order parameter.

Definition at line 50 of file ACBulk.h.

◆ _dmudvar

const MaterialProperty<Real>& ACBarrierFunction::_dmudvar
protected

Definition at line 38 of file ACBarrierFunction.h.

Referenced by computeDFDOP(), and computeQpOffDiagJacobian().

◆ _gamma

const MaterialProperty<Real>& ACBarrierFunction::_gamma
protected

Definition at line 37 of file ACBarrierFunction.h.

Referenced by calculateF0(), computeDFDOP(), and computeQpOffDiagJacobian().

◆ _gamma_name

const MaterialPropertyName ACBarrierFunction::_gamma_name
protected

Definition at line 36 of file ACBarrierFunction.h.

◆ _L

const MaterialProperty<Real >& ACBulk< Real >::_L
protectedinherited

◆ _mu

const MaterialProperty<Real>& ACGrGrBase::_mu
protectedinherited

◆ _n_eta

unsigned int ACBarrierFunction::_n_eta
protected

◆ _op_num

const unsigned int ACGrGrBase::_op_num
protectedinherited

◆ _uname

const NonlinearVariableName ACBarrierFunction::_uname
protected

Definition at line 35 of file ACBarrierFunction.h.

Referenced by ACBarrierFunction().

◆ _vals

std::vector<const VariableValue *> ACGrGrBase::_vals
protectedinherited

◆ _vals_var

std::vector<unsigned int> ACGrGrBase::_vals_var
protectedinherited

◆ _vname

const std::vector<VariableName> ACBarrierFunction::_vname
protected

Definition at line 41 of file ACBarrierFunction.h.

Referenced by ACBarrierFunction().


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