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

Constructor & Destructor Documentation

◆ ACMultiInterface()

ACMultiInterface::ACMultiInterface ( const InputParameters &  parameters)

Definition at line 31 of file ACMultiInterface.C.

32  : Kernel(parameters),
33  _num_etas(coupledComponents("etas")),
34  _eta(_num_etas),
36  _eta_vars(_fe_problem.getNonlinearSystemBase().nVariables(), -1),
37  _kappa_names(getParam<std::vector<MaterialPropertyName>>("kappa_names")),
39  _L(getMaterialProperty<Real>("mob_name"))
40 {
41  if (_num_etas != _kappa_names.size())
42  paramError("kappa_names", "Supply the same number of etas and kappa_names.");
43 
44  unsigned int nvariables = _fe_problem.getNonlinearSystemBase().nVariables();
45 
46  int a = -1;
47  for (unsigned int i = 0; i < _num_etas; ++i)
48  {
49  // get all order parameters and their gradients
50  _eta[i] = &coupledValue("etas", i);
51  _grad_eta[i] = &coupledGradient("etas", i);
52 
53  // populate lookup table form jvar to _eta index
54  unsigned int var = coupled("etas", i);
55  if (var < nvariables)
56  _eta_vars[var] = i;
57 
58  // get the index of the variable the kernel is operating on
59  if (coupled("etas", i) == _var.number())
60  a = i;
61 
62  // get gradient prefactors
63  _kappa[i] = &getMaterialPropertyByName<Real>(_kappa_names[i]);
64  }
65 
66  if (a < 0)
67  paramError(
68  "etas", "Kernel variable must be listed in etas for ACMultiInterface kernel ", name());
69  else
70  _a = a;
71 }
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.
const std::string name
Definition: Setup.h:22
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

◆ computeQpJacobian()

Real ACMultiInterface::computeQpJacobian ( )
protectedvirtual

Definition at line 106 of file ACMultiInterface.C.

107 {
108  Real sum = 0.0;
109  for (unsigned int b = 0; b < _num_etas; ++b)
110  {
111  // skip the diagonal term (does not contribute)
112  if (b == _a)
113  continue;
114 
115  sum += (*_kappa[b])[_qp] *
116  (2.0 * _test[_i][_qp] *
117  ((_phi[_j][_qp] * (*_grad_eta[b])[_qp] - (*_eta[b])[_qp] * _grad_phi[_j][_qp]) *
118  (*_grad_eta[b])[_qp]) +
119  (-(_phi[_j][_qp] * (*_eta[b])[_qp] * _grad_test[_i][_qp] +
120  _test[_i][_qp] * (*_eta[b])[_qp] * _grad_phi[_j][_qp] +
121  _test[_i][_qp] * _phi[_j][_qp] * (*_grad_eta[b])[_qp]) *
122  (*_grad_eta[b])[_qp]) -
123  (-((*_eta[b])[_qp] * (*_eta[b])[_qp] * _grad_test[_i][_qp] +
124  2.0 * _test[_i][_qp] * (*_eta[b])[_qp] * (*_grad_eta[b])[_qp]) *
125  _grad_phi[_j][_qp]));
126  }
127 
128  return _L[_qp] * sum;
129 }
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

◆ computeQpOffDiagJacobian()

Real ACMultiInterface::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 132 of file ACMultiInterface.C.

133 {
134  const VariableValue & _eta_a = _u;
135  const VariableGradient & _grad_eta_a = _grad_u;
136 
137  const int b = _eta_vars[jvar];
138  if (b < 0)
139  return 0.0;
140 
141  return _L[_qp] * (*_kappa[b])[_qp] *
142  (2.0 * _test[_i][_qp] *
143  ((_eta_a[_qp] * _grad_phi[_j][_qp] - _phi[_j][_qp] * _grad_eta_a[_qp]) *
144  (*_grad_eta[b])[_qp] +
145  (_eta_a[_qp] * (*_grad_eta[b])[_qp] - (*_eta[b])[_qp] * _grad_eta_a[_qp]) *
146  _grad_phi[_j][_qp]) +
147  (-(_eta_a[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp] +
148  _test[_i][_qp] * _phi[_j][_qp] * _grad_eta_a[_qp] +
149  _test[_i][_qp] * _eta_a[_qp] * _grad_phi[_j][_qp]) *
150  (*_grad_eta[b])[_qp] -
151  (_eta_a[_qp] * (*_eta[b])[_qp] * _grad_test[_i][_qp] +
152  _test[_i][_qp] * (*_eta[b])[_qp] * _grad_eta_a[_qp] +
153  _test[_i][_qp] * _eta_a[_qp] * (*_grad_eta[b])[_qp]) *
154  _grad_phi[_j][_qp]) -
155  (-(2.0 * (*_eta[b])[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp] +
156  2.0 * _test[_i][_qp] *
157  (_phi[_j][_qp] * (*_grad_eta[b])[_qp] + (*_eta[b])[_qp] * _grad_phi[_j][_qp])) *
158  _grad_eta_a[_qp]));
159 }
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

◆ computeQpResidual()

Real ACMultiInterface::computeQpResidual ( )
protectedvirtual

Definition at line 74 of file ACMultiInterface.C.

75 {
76  const VariableValue & _eta_a = _u;
77  const VariableGradient & _grad_eta_a = _grad_u;
78 
79  Real sum = 0.0;
80  for (unsigned int b = 0; b < _num_etas; ++b)
81  {
82  // skip the diagonal term (does not contribute)
83  if (b == _a)
84  continue;
85 
86  sum += (*_kappa[b])[_qp] *
87  (
88  // order 1 terms
89  2.0 * _test[_i][_qp] *
90  (_eta_a[_qp] * (*_grad_eta[b])[_qp] - (*_eta[b])[_qp] * _grad_eta_a[_qp]) *
91  (*_grad_eta[b])[_qp]
92  // volume terms
93  + (-(_eta_a[_qp] * (*_eta[b])[_qp] * _grad_test[_i][_qp] +
94  _test[_i][_qp] * (*_eta[b])[_qp] * _grad_eta_a[_qp] +
95  _test[_i][_qp] * _eta_a[_qp] * (*_grad_eta[b])[_qp]) *
96  (*_grad_eta[b])[_qp]) -
97  (-((*_eta[b])[_qp] * (*_eta[b])[_qp] * _grad_test[_i][_qp] +
98  2.0 * _test[_i][_qp] * (*_eta[b])[_qp] * (*_grad_eta[b])[_qp]) *
99  _grad_eta_a[_qp]));
100  }
101 
102  return _L[_qp] * sum;
103 }
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

◆ _a

unsigned int ACMultiInterface::_a
protected

Index of the eta this kernel is operating on.

Definition at line 49 of file ACMultiInterface.h.

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

◆ _eta

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

◆ _eta_vars

std::vector<int> ACMultiInterface::_eta_vars
protected

Lookup table from couple variable number into the etas vector.

Definition at line 46 of file ACMultiInterface.h.

Referenced by ACMultiInterface(), and computeQpOffDiagJacobian().

◆ _grad_eta

std::vector<const VariableGradient *> ACMultiInterface::_grad_eta
protected

◆ _kappa

std::vector<const MaterialProperty<Real> *> ACMultiInterface::_kappa
protected

◆ _kappa_names

std::vector<MaterialPropertyName> ACMultiInterface::_kappa_names
protected

Interface gradient prefactor.

Definition at line 52 of file ACMultiInterface.h.

Referenced by ACMultiInterface().

◆ _L

const MaterialProperty<Real>& ACMultiInterface::_L
protected

Mobility.

Definition at line 56 of file ACMultiInterface.h.

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

◆ _num_etas

unsigned int ACMultiInterface::_num_etas
protected

Order parameters.

Definition at line 41 of file ACMultiInterface.h.

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


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