CoupledSwitchingTimeDerivative Class Reference

This kernel adds a contribution $$\left( \frac{\partial F_a}{\partial \eta_{ai}} f_a + \frac{\partial F_b}{\partial \eta_{ai}} f_b + ... \right) \frac{\partial \eta_{ai}}{\partial t}$$ where $$a,b,..$$ are the phases, $$h_a, h_b,..$$ are the switching functions, $$\eta_{ai}$$ is the order parameter that is the nonlinear variable, $$t$$ is time, and $$F_a, F_b,..$$ are functions for each phase. More...

#include <CoupledSwitchingTimeDerivative.h>

Inheritance diagram for CoupledSwitchingTimeDerivative:
[legend]

## Public Member Functions

CoupledSwitchingTimeDerivative (const InputParameters &parameters)

virtual void initialSetup ()

## Protected Member Functions

virtual Real computeQpResidual ()

virtual Real computeQpJacobian ()

virtual Real computeQpOffDiagJacobian (unsigned int jvar)

## Protected Attributes

const unsigned int _nvar
Number of coupled variables. More...

const VariableName _v_name
name of order parameter that derivatives are taken wrt (needed to retrieve the derivative material properties) More...

std::vector< MaterialPropertyName > _Fj_names
Names of functions for each phase $$F_j$$. More...

const unsigned int _num_j
Number of phases. More...

std::vector< const MaterialProperty< Real > * > _prop_Fj
Values of the functions for each phase $$F_j$$. More...

std::vector< const MaterialProperty< Real > * > _prop_dFjdv
Derivatives of the functions wrt the nonlinear variable for this kernel. More...

std::vector< std::vector< const MaterialProperty< Real > * > > _prop_dFjdarg
Derivatives of the functions (needed for off-diagonal Jacobians) More...

std::vector< MaterialPropertyName > _hj_names
switching function names More...

std::vector< const MaterialProperty< Real > * > _prop_dhjdetai
Derivatives of the switching functions wrt the order parameter for this kernel. More...

std::vector< const MaterialProperty< Real > * > _prop_d2hjdetai2
Second derivatives of the switching functions wrt the order parameter for this kernel. More...

std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2hjdetaidarg
Second derivatives of the switching functions (needed for off-diagonal Jacobians) More...

## Detailed Description

This kernel adds a contribution $$\left( \frac{\partial F_a}{\partial \eta_{ai}} f_a + \frac{\partial F_b}{\partial \eta_{ai}} f_b + ... \right) \frac{\partial \eta_{ai}}{\partial t}$$ where $$a,b,..$$ are the phases, $$h_a, h_b,..$$ are the switching functions, $$\eta_{ai}$$ is the order parameter that is the nonlinear variable, $$t$$ is time, and $$F_a, F_b,..$$ are functions for each phase.

For the grand-potential model susceptibility equation, $$F_a$$ etc. are the phase densities.

Definition at line 33 of file CoupledSwitchingTimeDerivative.h.

## ◆ CoupledSwitchingTimeDerivative()

 CoupledSwitchingTimeDerivative::CoupledSwitchingTimeDerivative ( const InputParameters & parameters )

Definition at line 30 of file CoupledSwitchingTimeDerivative.C.

31  : DerivativeMaterialInterface<JvarMapKernelInterface<CoupledTimeDerivative>>(parameters),
32  _nvar(_coupled_moose_vars.size()), // number of coupled variables
33  _v_name(getVar("v", 0)->name()),
34  _Fj_names(getParam<std::vector<MaterialPropertyName>>("Fj_names")),
35  _num_j(_Fj_names.size()),
39  _hj_names(getParam<std::vector<MaterialPropertyName>>("hj_names")),
43 {
44  // check passed in parameter vectors
45  if (_num_j != _hj_names.size())
46  paramError("hj_names", "Need to pass in as many hj_names as Fj_names");
47
48  // reserve space and set phase material properties
49  for (unsigned int n = 0; n < _num_j; ++n)
50  {
51  // get phase free energy and derivatives
52  _prop_Fj[n] = &getMaterialPropertyByName<Real>(_Fj_names[n]);
53  _prop_dFjdv[n] = &getMaterialPropertyDerivative<Real>(_Fj_names[n], _var.name());
54  _prop_dFjdarg[n].resize(_nvar);
55
56  // get switching function and derivatives wrt eta_i, the nonlinear variable
57  _prop_dhjdetai[n] = &getMaterialPropertyDerivative<Real>(_hj_names[n], _v_name);
58  _prop_d2hjdetai2[n] = &getMaterialPropertyDerivative<Real>(_hj_names[n], _v_name, _v_name);
59  _prop_d2hjdetaidarg[n].resize(_nvar);
60
61  for (unsigned int i = 0; i < _nvar; ++i)
62  {
63  MooseVariableFEBase * cvar = _coupled_moose_vars[i];
64  // Get derivatives of all Fj wrt all coupled variables
65  _prop_dFjdarg[n][i] = &getMaterialPropertyDerivative<Real>(_Fj_names[n], cvar->name());
66
67  // Get second derivatives of all hj wrt eta_i and all coupled variables
68  _prop_d2hjdetaidarg[n][i] =
69  &getMaterialPropertyDerivative<Real>(_hj_names[n], _v_name, cvar->name());
70  }
71  }
72 }
std::vector< const MaterialProperty< Real > * > _prop_Fj
Values of the functions for each phase .
const unsigned int _nvar
Number of coupled variables.
std::vector< MaterialPropertyName > _Fj_names
Names of functions for each phase .
std::vector< const MaterialProperty< Real > * > _prop_dFjdv
Derivatives of the functions wrt the nonlinear variable for this kernel.
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2hjdetaidarg
Second derivatives of the switching functions (needed for off-diagonal Jacobians) ...
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_dFjdarg
Derivatives of the functions (needed for off-diagonal Jacobians)
std::vector< MaterialPropertyName > _hj_names
switching function names
const VariableName _v_name
name of order parameter that derivatives are taken wrt (needed to retrieve the derivative material pr...
std::vector< const MaterialProperty< Real > * > _prop_dhjdetai
Derivatives of the switching functions wrt the order parameter for this kernel.
std::vector< const MaterialProperty< Real > * > _prop_d2hjdetai2
Second derivatives of the switching functions wrt the order parameter for this kernel.
const unsigned int _num_j
Number of phases.

## ◆ computeQpJacobian()

 Real CoupledSwitchingTimeDerivative::computeQpJacobian ( )
protectedvirtual

Definition at line 95 of file CoupledSwitchingTimeDerivative.C.

96 {
97  Real sum = 0.0;
98  for (unsigned int n = 0; n < _num_j; ++n)
99  sum += (*_prop_dhjdetai[n])[_qp] * (*_prop_dFjdv[n])[_qp];
100
101  return CoupledTimeDerivative::computeQpResidual() * sum * _phi[_j][_qp];
102 }
std::vector< const MaterialProperty< Real > * > _prop_dFjdv
Derivatives of the functions wrt the nonlinear variable for this kernel.
std::vector< const MaterialProperty< Real > * > _prop_dhjdetai
Derivatives of the switching functions wrt the order parameter for this kernel.
const unsigned int _num_j
Number of phases.

## ◆ computeQpOffDiagJacobian()

 Real CoupledSwitchingTimeDerivative::computeQpOffDiagJacobian ( unsigned int jvar )
protectedvirtual

Definition at line 105 of file CoupledSwitchingTimeDerivative.C.

106 {
107  // get the coupled variable jvar is referring to
108  const unsigned int cvar = mapJvarToCvar(jvar);
109
110  if (jvar == _v_var)
111  {
112  Real sum = 0.0;
113
114  for (unsigned int n = 0; n < _num_j; ++n)
115  sum +=
116  ((*_prop_d2hjdetai2[n])[_qp] * _v_dot[_qp] + (*_prop_dhjdetai[n])[_qp] * _dv_dot[_qp]) *
117  (*_prop_Fj[n])[_qp];
118
119  return _phi[_j][_qp] * sum * _test[_i][_qp];
120  }
121
122  Real sum = 0.0;
123  for (unsigned int n = 0; n < _num_j; ++n)
124  sum += (*_prop_d2hjdetaidarg[n][cvar])[_qp] * (*_prop_Fj[n])[_qp] +
125  (*_prop_dhjdetai[n])[_qp] * (*_prop_dFjdarg[n][cvar])[_qp];
126
127  return CoupledTimeDerivative::computeQpResidual() * sum * _phi[_j][_qp];
128 }
std::vector< const MaterialProperty< Real > * > _prop_Fj
Values of the functions for each phase .
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2hjdetaidarg
Second derivatives of the switching functions (needed for off-diagonal Jacobians) ...
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_dFjdarg
Derivatives of the functions (needed for off-diagonal Jacobians)
std::vector< const MaterialProperty< Real > * > _prop_dhjdetai
Derivatives of the switching functions wrt the order parameter for this kernel.
std::vector< const MaterialProperty< Real > * > _prop_d2hjdetai2
Second derivatives of the switching functions wrt the order parameter for this kernel.
const unsigned int _num_j
Number of phases.

## ◆ computeQpResidual()

 Real CoupledSwitchingTimeDerivative::computeQpResidual ( )
protectedvirtual

Definition at line 85 of file CoupledSwitchingTimeDerivative.C.

86 {
87  Real sum = 0.0;
88  for (unsigned int n = 0; n < _num_j; ++n)
89  sum += (*_prop_dhjdetai[n])[_qp] * (*_prop_Fj[n])[_qp];
90
91  return CoupledTimeDerivative::computeQpResidual() * sum;
92 }
std::vector< const MaterialProperty< Real > * > _prop_Fj
Values of the functions for each phase .
std::vector< const MaterialProperty< Real > * > _prop_dhjdetai
Derivatives of the switching functions wrt the order parameter for this kernel.
const unsigned int _num_j
Number of phases.

## ◆ initialSetup()

 void CoupledSwitchingTimeDerivative::initialSetup ( )
virtual

Definition at line 75 of file CoupledSwitchingTimeDerivative.C.

76 {
77  for (unsigned int n = 0; n < _num_j; ++n)
78  {
79  validateNonlinearCoupling<Real>(_Fj_names[n]);
80  validateNonlinearCoupling<Real>(_hj_names[n]);
81  }
82 }
std::vector< MaterialPropertyName > _Fj_names
Names of functions for each phase .
std::vector< MaterialPropertyName > _hj_names
switching function names
const unsigned int _num_j
Number of phases.

## ◆ _Fj_names

 std::vector CoupledSwitchingTimeDerivative::_Fj_names
protected

Names of functions for each phase $$F_j$$.

Definition at line 53 of file CoupledSwitchingTimeDerivative.h.

Referenced by CoupledSwitchingTimeDerivative(), and initialSetup().

## ◆ _hj_names

 std::vector CoupledSwitchingTimeDerivative::_hj_names
protected

switching function names

Definition at line 68 of file CoupledSwitchingTimeDerivative.h.

Referenced by CoupledSwitchingTimeDerivative(), and initialSetup().

## ◆ _num_j

 const unsigned int CoupledSwitchingTimeDerivative::_num_j
protected

Number of phases.

Definition at line 56 of file CoupledSwitchingTimeDerivative.h.

## ◆ _nvar

 const unsigned int CoupledSwitchingTimeDerivative::_nvar
protected

Number of coupled variables.

Definition at line 46 of file CoupledSwitchingTimeDerivative.h.

Referenced by CoupledSwitchingTimeDerivative().

## ◆ _prop_d2hjdetai2

 std::vector *> CoupledSwitchingTimeDerivative::_prop_d2hjdetai2
protected

Second derivatives of the switching functions wrt the order parameter for this kernel.

Definition at line 74 of file CoupledSwitchingTimeDerivative.h.

Referenced by computeQpOffDiagJacobian(), and CoupledSwitchingTimeDerivative().

## ◆ _prop_d2hjdetaidarg

 std::vector *> > CoupledSwitchingTimeDerivative::_prop_d2hjdetaidarg
protected

Second derivatives of the switching functions (needed for off-diagonal Jacobians)

Definition at line 77 of file CoupledSwitchingTimeDerivative.h.

Referenced by computeQpOffDiagJacobian(), and CoupledSwitchingTimeDerivative().

## ◆ _prop_dFjdarg

 std::vector *> > CoupledSwitchingTimeDerivative::_prop_dFjdarg
protected

Derivatives of the functions (needed for off-diagonal Jacobians)

Definition at line 65 of file CoupledSwitchingTimeDerivative.h.

Referenced by computeQpOffDiagJacobian(), and CoupledSwitchingTimeDerivative().

## ◆ _prop_dFjdv

 std::vector *> CoupledSwitchingTimeDerivative::_prop_dFjdv
protected

Derivatives of the functions wrt the nonlinear variable for this kernel.

Definition at line 62 of file CoupledSwitchingTimeDerivative.h.

Referenced by computeQpJacobian(), and CoupledSwitchingTimeDerivative().

## ◆ _prop_dhjdetai

 std::vector *> CoupledSwitchingTimeDerivative::_prop_dhjdetai
protected

Derivatives of the switching functions wrt the order parameter for this kernel.

Definition at line 71 of file CoupledSwitchingTimeDerivative.h.

## ◆ _prop_Fj

 std::vector *> CoupledSwitchingTimeDerivative::_prop_Fj
protected

Values of the functions for each phase $$F_j$$.

Definition at line 59 of file CoupledSwitchingTimeDerivative.h.

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

## ◆ _v_name

 const VariableName CoupledSwitchingTimeDerivative::_v_name
protected

name of order parameter that derivatives are taken wrt (needed to retrieve the derivative material properties)

Definition at line 50 of file CoupledSwitchingTimeDerivative.h.

Referenced by CoupledSwitchingTimeDerivative().

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