https://mooseframework.inl.gov
Loading...
Searching...
No Matches
KKSMultiACBulkF.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#include "KKSMultiACBulkF.h"
11
13
16{
18 params.addClassDescription("KKS model kernel (part 1 of 2) for the Bulk Allen-Cahn. This "
19 "includes all terms NOT dependent on chemical potential.");
20 params.addRequiredParam<Real>("wi", "Double well height parameter");
21 params.addRequiredParam<MaterialPropertyName>(
22 "gi_name", "Base name for the double well function g_i(eta_i)");
23 return params;
24}
25
27 : KKSMultiACBulkBase(parameters),
28 _wi(getParam<Real>("wi")),
29 _prop_dgi(getMaterialPropertyDerivative<Real>("gi_name", _etai_name)),
30 _prop_d2gi(getMaterialPropertyDerivative<Real>("gi_name", _etai_name, _etai_name))
31{
32}
33
34Real
36{
37 Real sum = 0.0;
38
39 switch (type)
40 {
41 case Residual:
42 for (unsigned int n = 0; n < _num_j; ++n)
43 sum += (*_prop_dhjdetai[n])[_qp] * (*_prop_Fj[n])[_qp];
44
45 return sum + _wi * _prop_dgi[_qp];
46
47 case Jacobian:
48 // For when this kernel is used in the Lagrange multiplier equation
49 // In that case the Lagrange multiplier is the nonlinear variable
50 if (_etai_var != _var.number())
51 return 0.0;
52
53 // For when eta_i is the nonlinear variable
54 for (unsigned int n = 0; n < _num_j; ++n)
55 sum += (*_prop_d2hjdetai2[n])[_qp] * (*_prop_Fj[n])[_qp];
56
57 return _phi[_j][_qp] * (sum + _wi * _prop_d2gi[_qp]);
58 }
59
60 mooseError("Invalid type passed in");
61}
62
63Real
65{
66 // get the coupled variable jvar is referring to
67 const unsigned int cvar = mapJvarToCvar(jvar);
68
69 // first get dependence of mobility _L on other variables using parent class
70 // member function
72
73 // Then add dependence of KKSMultiACBulkF on other variables
74 Real sum = 0.0;
75 for (unsigned int n = 0; n < _num_j; ++n)
76 sum += (*_prop_d2hjdetaidarg[n][cvar])[_qp] * (*_prop_Fj[n])[_qp] +
77 (*_prop_dhjdetai[n])[_qp] * (*_prop_dFjdarg[n][cvar])[_qp];
78
79 // Handle the case when this kernel is used in the Lagrange multiplier equation
80 // In this case the second derivative of the barrier function contributes
81 // to the off-diagonal Jacobian
82 if (jvar == _etai_var)
83 sum += _wi * _prop_d2gi[_qp];
84
85 res += _L[_qp] * sum * _phi[_j][_qp] * _test[_i][_qp];
86
87 return res;
88}
registerMooseObject("PhaseFieldApp", KKSMultiACBulkF)
void mooseError(Args &&... args)
const MaterialProperty< Real > & _L
Mobility.
Definition ACBulk.h:46
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition ACBulk.h:110
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
ACBulk child class that sets up necessary variables and materials for calculation of residual contrib...
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_dFjdarg
Derivatives of the free energy functions (needed for off-diagonal Jacobians)
unsigned int _etai_var
index of order parameter that derivatives are taken wrt
std::vector< const MaterialProperty< Real > * > _prop_dhjdetai
Derivatives of the switching functions wrt the order parameter for this kernel.
static InputParameters validParams()
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2hjdetaidarg
Second derivatives of the switching functions (needed for off-diagonal Jacobians)
std::vector< const MaterialProperty< Real > * > _prop_Fj
Values of the free energy functions for each phase .
std::vector< const MaterialProperty< Real > * > _prop_d2hjdetai2
Second derivatives of the switching functions wrt the order parameter for this kernel.
KKSMultiACBulkBase child class for the free energy term in the the Allen-Cahn bulk residual.
Real _wi
double well height parameter
virtual Real computeDFDOP(PFFunctionType type)
KKSMultiACBulkF(const InputParameters &parameters)
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
const MaterialProperty< Real > & _prop_d2gi
Second derivative of the double well function .
static InputParameters validParams()
const MaterialProperty< Real > & _prop_dgi
Derivative of the double well function .