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

Compute the gradient interface terms for a multiphase system. More...

#include <ACMultiInterface.h>

Inheritance diagram for ACMultiInterface:
[legend]

Public Member Functions

 ACMultiInterface (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeQpResidual ()
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int)
 

Protected Attributes

unsigned int _num_etas
 Order parameters. More...
 
std::vector< const VariableValue * > _eta
 
std::vector< const VariableGradient * > _grad_eta
 
std::vector< int > _eta_vars
 Lookup table from couple variable number into the etas vector. More...
 
unsigned int _a
 Index of the eta this kernel is operating on. More...
 
std::vector< MaterialPropertyName > _kappa_names
 Interface gradient prefactor. More...
 
std::vector< const MaterialProperty< Real > * > _kappa
 
const MaterialProperty< Real > & _L
 Mobility. More...
 

Detailed Description

Compute the gradient interface terms for a multiphase system.

This includes cross terms of the form \( \left( \eta_a\nabla\eta_b - \eta_b\nabla\eta_a \right)^2\). Note that in a two phase system with \( \eta = \eta_b = 1-\eta_a \) the regular ACInterface kernel can be used as the gradient interface term simplifies to the usual \( ()\nabla\eta)^2 \) form.

http://mooseframework.org/wiki/PhysicsModules/PhaseField/DevelopingModels/MultiPhaseModels/ACMultiInterface/

Definition at line 27 of file ACMultiInterface.h.

Constructor & Destructor Documentation

ACMultiInterface::ACMultiInterface ( const InputParameters &  parameters)

Definition at line 27 of file ACMultiInterface.C.

28  : Kernel(parameters),
29  _num_etas(coupledComponents("etas")),
30  _eta(_num_etas),
32  _eta_vars(_fe_problem.getNonlinearSystemBase().nVariables(), -1),
33  _kappa_names(getParam<std::vector<MaterialPropertyName>>("kappa_names")),
35  _L(getMaterialProperty<Real>("mob_name"))
36 {
37  if (_num_etas != _kappa_names.size())
38  mooseError("Supply the same nummber of etas and kappa_names.");
39 
40  unsigned int nvariables = _fe_problem.getNonlinearSystemBase().nVariables();
41 
42  int a = -1;
43  for (unsigned int i = 0; i < _num_etas; ++i)
44  {
45  // get all order parameters and their gradients
46  _eta[i] = &coupledValue("etas", i);
47  _grad_eta[i] = &coupledGradient("etas", i);
48 
49  // populate lookup table form jvar to _eta index
50  unsigned int var = coupled("etas", i);
51  if (var < nvariables)
52  _eta_vars[var] = i;
53 
54  // get the index of the variable the kernel is operating on
55  if (coupled("etas", i) == _var.number())
56  a = i;
57 
58  // get gradient prefactors
59  _kappa[i] = &getMaterialPropertyByName<Real>(_kappa_names[i]);
60  }
61 
62  if (a < 0)
63  mooseError("Kernel variable must be listed in etas for ACMultiInterface kernel ", name());
64  else
65  _a = a;
66 }
unsigned int _a
Index of the eta this kernel is operating on.
std::vector< int > _eta_vars
Lookup table from couple variable number into the etas vector.
unsigned int _num_etas
Order parameters.
std::vector< const MaterialProperty< Real > * > _kappa
std::vector< const VariableValue * > _eta
const MaterialProperty< Real > & _L
Mobility.
std::vector< const VariableGradient * > _grad_eta
std::vector< MaterialPropertyName > _kappa_names
Interface gradient prefactor.

Member Function Documentation

Real ACMultiInterface::computeQpJacobian ( )
protectedvirtual

Definition at line 102 of file ACMultiInterface.C.

103 {
104  Real sum = 0.0;
105  for (unsigned int b = 0; b < _num_etas; ++b)
106  {
107  // skip the diagonal term (does not contribute)
108  if (b == _a)
109  continue;
110 
111  sum += (*_kappa[b])[_qp] * (2.0 * _test[_i][_qp] * ((_phi[_j][_qp] * (*_grad_eta[b])[_qp] -
112  (*_eta[b])[_qp] * _grad_phi[_j][_qp]) *
113  (*_grad_eta[b])[_qp]) +
114  (-(_phi[_j][_qp] * (*_eta[b])[_qp] * _grad_test[_i][_qp] +
115  _test[_i][_qp] * (*_eta[b])[_qp] * _grad_phi[_j][_qp] +
116  _test[_i][_qp] * _phi[_j][_qp] * (*_grad_eta[b])[_qp]) *
117  (*_grad_eta[b])[_qp]) -
118  (-((*_eta[b])[_qp] * (*_eta[b])[_qp] * _grad_test[_i][_qp] +
119  2.0 * _test[_i][_qp] * (*_eta[b])[_qp] * (*_grad_eta[b])[_qp]) *
120  _grad_phi[_j][_qp]));
121  }
122 
123  return _L[_qp] * sum;
124 }
unsigned int _a
Index of the eta this kernel is operating on.
unsigned int _num_etas
Order parameters.
std::vector< const MaterialProperty< Real > * > _kappa
std::vector< const VariableValue * > _eta
const MaterialProperty< Real > & _L
Mobility.
std::vector< const VariableGradient * > _grad_eta
Real ACMultiInterface::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 127 of file ACMultiInterface.C.

128 {
129  const VariableValue & _eta_a = _u;
130  const VariableGradient & _grad_eta_a = _grad_u;
131 
132  const int b = _eta_vars[jvar];
133  if (b < 0)
134  return 0.0;
135 
136  return _L[_qp] * (*_kappa[b])[_qp] *
137  (2.0 * _test[_i][_qp] *
138  ((_eta_a[_qp] * _grad_phi[_j][_qp] - _phi[_j][_qp] * _grad_eta_a[_qp]) *
139  (*_grad_eta[b])[_qp] +
140  (_eta_a[_qp] * (*_grad_eta[b])[_qp] - (*_eta[b])[_qp] * _grad_eta_a[_qp]) *
141  _grad_phi[_j][_qp]) +
142  (-(_eta_a[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp] +
143  _test[_i][_qp] * _phi[_j][_qp] * _grad_eta_a[_qp] +
144  _test[_i][_qp] * _eta_a[_qp] * _grad_phi[_j][_qp]) *
145  (*_grad_eta[b])[_qp] -
146  (_eta_a[_qp] * (*_eta[b])[_qp] * _grad_test[_i][_qp] +
147  _test[_i][_qp] * (*_eta[b])[_qp] * _grad_eta_a[_qp] +
148  _test[_i][_qp] * _eta_a[_qp] * (*_grad_eta[b])[_qp]) *
149  _grad_phi[_j][_qp]) -
150  (-(2.0 * (*_eta[b])[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp] +
151  2.0 * _test[_i][_qp] *
152  (_phi[_j][_qp] * (*_grad_eta[b])[_qp] + (*_eta[b])[_qp] * _grad_phi[_j][_qp])) *
153  _grad_eta_a[_qp]));
154 }
std::vector< int > _eta_vars
Lookup table from couple variable number into the etas vector.
std::vector< const MaterialProperty< Real > * > _kappa
std::vector< const VariableValue * > _eta
const MaterialProperty< Real > & _L
Mobility.
std::vector< const VariableGradient * > _grad_eta
Real ACMultiInterface::computeQpResidual ( )
protectedvirtual

Definition at line 69 of file ACMultiInterface.C.

70 {
71  const VariableValue & _eta_a = _u;
72  const VariableGradient & _grad_eta_a = _grad_u;
73 
74  Real sum = 0.0;
75  for (unsigned int b = 0; b < _num_etas; ++b)
76  {
77  // skip the diagonal term (does not contribute)
78  if (b == _a)
79  continue;
80 
81  sum += (*_kappa[b])[_qp] *
82  (
83  // order 1 terms
84  2.0 * _test[_i][_qp] *
85  (_eta_a[_qp] * (*_grad_eta[b])[_qp] - (*_eta[b])[_qp] * _grad_eta_a[_qp]) *
86  (*_grad_eta[b])[_qp]
87  // volume terms
88  +
89  (-(_eta_a[_qp] * (*_eta[b])[_qp] * _grad_test[_i][_qp] +
90  _test[_i][_qp] * (*_eta[b])[_qp] * _grad_eta_a[_qp] +
91  _test[_i][_qp] * _eta_a[_qp] * (*_grad_eta[b])[_qp]) *
92  (*_grad_eta[b])[_qp]) -
93  (-((*_eta[b])[_qp] * (*_eta[b])[_qp] * _grad_test[_i][_qp] +
94  2.0 * _test[_i][_qp] * (*_eta[b])[_qp] * (*_grad_eta[b])[_qp]) *
95  _grad_eta_a[_qp]));
96  }
97 
98  return _L[_qp] * sum;
99 }
unsigned int _a
Index of the eta this kernel is operating on.
unsigned int _num_etas
Order parameters.
std::vector< const MaterialProperty< Real > * > _kappa
std::vector< const VariableValue * > _eta
const MaterialProperty< Real > & _L
Mobility.
std::vector< const VariableGradient * > _grad_eta

Member Data Documentation

unsigned int ACMultiInterface::_a
protected

Index of the eta this kernel is operating on.

Definition at line 46 of file ACMultiInterface.h.

Referenced by ACMultiInterface(), computeQpJacobian(), and computeQpResidual().

std::vector<const VariableValue *> ACMultiInterface::_eta
protected
std::vector<int> ACMultiInterface::_eta_vars
protected

Lookup table from couple variable number into the etas vector.

Definition at line 43 of file ACMultiInterface.h.

Referenced by ACMultiInterface(), and computeQpOffDiagJacobian().

std::vector<const VariableGradient *> ACMultiInterface::_grad_eta
protected
std::vector<const MaterialProperty<Real> *> ACMultiInterface::_kappa
protected
std::vector<MaterialPropertyName> ACMultiInterface::_kappa_names
protected

Interface gradient prefactor.

Definition at line 49 of file ACMultiInterface.h.

Referenced by ACMultiInterface().

const MaterialProperty<Real>& ACMultiInterface::_L
protected

Mobility.

Definition at line 53 of file ACMultiInterface.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

unsigned int ACMultiInterface::_num_etas
protected

Order parameters.

Definition at line 38 of file ACMultiInterface.h.

Referenced by ACMultiInterface(), computeQpJacobian(), and computeQpResidual().


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