https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ACInterface2DMultiPhase1.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
11
13
16{
19 "Gradient energy Allen-Cahn Kernel where the derivative of interface parameter kappa "
20 "wrt the gradient of order parameter is considered.");
21 params.addParam<MaterialPropertyName>("dkappadgrad_etaa_name",
22 "dkappadgrad_etaa",
23 "The derivative of the kappa with respect to grad_etaa");
24 params.addParam<MaterialPropertyName>(
25 "d2kappadgrad_etaa_name",
26 "d2kappadgrad_etaa",
27 "The second derivative of the kappa with respect to grad_etaa");
29 "etas", "All other coupled order parameters eta_i of the multiphase problem");
30 return params;
31}
32
34 : ACInterface(parameters),
35 _dkappadgrad_etaa(getMaterialProperty<RealGradient>("dkappadgrad_etaa_name")),
36 _d2kappadgrad_etaa(getMaterialProperty<RealTensorValue>("d2kappadgrad_etaa_name")),
37 _num_etas(coupledComponents("etas")),
38 _eta(_num_etas),
39 _grad_eta(_num_etas)
40{
41}
42
43Real
45{
46 // get the sum of square of gradients of all order parameters
47 Real SumSquareGradOp = _grad_u[_qp] * _grad_u[_qp];
48 for (unsigned int i = 0; i < _num_etas; ++i)
49 {
50 _grad_eta[i] = &coupledGradient("etas", i);
51 SumSquareGradOp += (*_grad_eta[i])[_qp] * (*_grad_eta[i])[_qp];
52 }
53 return SumSquareGradOp;
54}
55
56Real
61
62Real
64{
65 // dsum is the derivative \f$ \frac\partial{\partial \eta} \left( \nabla (L\psi) \right) \f$
66 RealGradient dsum = _dLdop[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp];
67
68 // compute the derivative of the gradient of the mobility
69 if (_variable_L)
70 {
71 RealGradient dgradL =
72 _grad_phi[_j][_qp] * _dLdop[_qp] + _grad_u[_qp] * _phi[_j][_qp] * _d2Ldop2[_qp];
73
74 for (unsigned int i = 0; i < _n_args; ++i)
75 dgradL += (*_gradarg[i])[_qp] * _phi[_j][_qp] * (*_d2Ldargdop[i])[_qp];
76
77 dsum += dgradL * _test[_i][_qp];
78 }
79 Real jac1 = 0.5 * dsum * _dkappadgrad_etaa[_qp] * sumSquareGradEta();
80 Real jac2 =
81 0.5 * nablaLPsi() * (_d2kappadgrad_etaa[_qp] * _grad_phi[_j][_qp]) * sumSquareGradEta();
82 Real jac3 = nablaLPsi() * _dkappadgrad_etaa[_qp] * _grad_u[_qp] * _grad_phi[_j][_qp];
83 return jac1 + jac2 + jac3;
84}
85
86Real
88{
89 // get the coupled variable jvar is referring to
90 const unsigned int cvar = mapJvarToCvar(jvar);
91
92 // dsum is the derivative \f$ \frac\partial{\partial \eta} \left( \nabla (L\psi) \right) \f$
93 RealGradient dsum = (*_dLdarg[cvar])[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp];
94
95 // compute the derivative of the gradient of the mobility
96 if (_variable_L)
97 {
98 RealGradient dgradL = _grad_phi[_j][_qp] * (*_dLdarg[cvar])[_qp] +
99 _grad_u[_qp] * _phi[_j][_qp] * (*_d2Ldargdop[cvar])[_qp];
100
101 for (unsigned int i = 0; i < _n_args; ++i)
102 dgradL += (*_gradarg[i])[_qp] * _phi[_j][_qp] * (*_d2Ldarg2[cvar][i])[_qp];
103
104 dsum += dgradL * _test[_i][_qp];
105 }
106
107 // the gradient of coupled variable etab
108 _grad_eta[0] = &coupledGradient("etas", 0);
109
110 Real jac1 = 0.5 * dsum * _dkappadgrad_etaa[_qp] * sumSquareGradEta();
111 Real jac2 =
112 -0.5 * nablaLPsi() * (_d2kappadgrad_etaa[_qp] * _grad_phi[_j][_qp]) * sumSquareGradEta();
113 Real jac3 = nablaLPsi() * _dkappadgrad_etaa[_qp] * (*_grad_eta[0])[_qp] * _grad_phi[_j][_qp];
114 return jac1 + jac2 + jac3;
115}
registerMooseObject("PhaseFieldApp", ACInterface2DMultiPhase1)
Compute the Allen-Cahn interface term with the weak form residual .
ACInterface2DMultiPhase1(const InputParameters &parameters)
unsigned int _num_etas
Order parameters.
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
const MaterialProperty< RealTensorValue > & _d2kappadgrad_etaa
static InputParameters validParams()
std::vector< const VariableGradient * > _grad_eta
const MaterialProperty< RealGradient > & _dkappadgrad_etaa
Interfacial parameter.
Compute the Allen-Cahn interface term with the weak form residual .
Definition ACInterface.h:21
const bool _variable_L
flag set if L is a function of non-linear variables in args
Definition ACInterface.h:48
std::vector< const VariableGradient * > _gradarg
Gradients for all coupled variables.
Definition ACInterface.h:68
const MaterialProperty< Real > & _dLdop
Mobility derivatives w.r.t. order parameter.
Definition ACInterface.h:51
const MaterialProperty< Real > & _d2Ldop2
Definition ACInterface.h:52
std::vector< const MaterialProperty< Real > * > _dLdarg
Mobility derivative w.r.t. other coupled variables.
Definition ACInterface.h:59
static InputParameters validParams()
Definition ACInterface.C:15
std::vector< const MaterialProperty< Real > * > _d2Ldargdop
Definition ACInterface.h:60
RealGradient nablaLPsi()
the term
Definition ACInterface.C:82
std::vector< std::vector< const MaterialProperty< Real > * > > _d2Ldarg2
Definition ACInterface.h:61
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)