https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ACGrGrPoly.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 "ACGrGrPoly.h"
11
13
16{
18 params.addClassDescription("Grain-Boundary model poly-crystalline interface Allen-Cahn Kernel");
19 return params;
20}
21
23 : ACGrGrBase(parameters), _gamma(getMaterialProperty<Real>("gamma_asymm"))
24{
25}
26
27Real
29{
30 return _u[_qp];
31}
32
33std::vector<Real>
35{
36 std::vector<Real> other_ops(_op_num);
37 for (unsigned int i = 0; i < _op_num; ++i)
38 other_ops[i] = (*_vals[i])[_qp];
39
40 return other_ops;
41}
42
43Real
45{
46 // assign op and other_ops
47 Real op = assignThisOp();
48 std::vector<Real> other_ops(_op_num);
49 other_ops = assignOtherOps();
50
51 // Sum all other order parameters
52 Real SumOPj = 0.0;
53 for (unsigned int i = 0; i < _op_num; ++i)
54 SumOPj += other_ops[i] * other_ops[i];
55
56 // Calculate either the residual or Jacobian of the grain growth free energy
57 switch (type)
58 {
59 case Residual:
60 {
61 return _mu[_qp] * (op * op * op - op + 2.0 * _gamma[_qp] * op * SumOPj);
62 }
63
64 case Jacobian:
65 {
66 return _mu[_qp] * (_phi[_j][_qp] * (3.0 * op * op - 1.0 + 2.0 * _gamma[_qp] * SumOPj));
67 }
68
69 default:
70 mooseError("Invalid type passed in");
71 }
72}
73
74Real
76{
77 // assign op and other_ops
78 Real op = assignThisOp();
79 std::vector<Real> other_ops(_op_num);
80 other_ops = assignOtherOps();
81
82 for (unsigned int i = 0; i < _op_num; ++i)
83 if (jvar == _vals_var[i])
84 {
85 // Derivative of Sumopj
86 const Real dSumOPj = 2.0 * other_ops[i] * _phi[_j][_qp];
87 const Real dDFDOP = _mu[_qp] * 2.0 * _gamma[_qp] * op * dSumOPj;
88
89 return _L[_qp] * _test[_i][_qp] * dDFDOP;
90 }
91
92 return 0.0;
93}
registerMooseObject("PhaseFieldApp", ACGrGrPoly)
void mooseError(Args &&... args)
const MaterialProperty< Real > & _L
Mobility.
Definition ACBulk.h:46
This is the base class for kernels that calculate the residual for grain growth.
Definition ACGrGrBase.h:22
static InputParameters validParams()
Definition ACGrGrBase.C:13
const MaterialProperty< Real > & _mu
Definition ACGrGrBase.h:34
const unsigned int _op_num
Definition ACGrGrBase.h:29
const std::vector< const VariableValue * > _vals
Definition ACGrGrBase.h:31
const std::vector< unsigned int > _vals_var
Definition ACGrGrBase.h:32
This kernel calculates the residual for grain growth for a single phase, poly-crystal system.
Definition ACGrGrPoly.h:22
virtual Real computeDFDOP(PFFunctionType type)
Definition ACGrGrPoly.C:44
static InputParameters validParams()
Definition ACGrGrPoly.C:15
const MaterialProperty< Real > & _gamma
Definition ACGrGrPoly.h:34
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition ACGrGrPoly.C:75
ACGrGrPoly(const InputParameters &parameters)
Definition ACGrGrPoly.C:22
virtual Real assignThisOp()
Definition ACGrGrPoly.C:28
virtual std::vector< Real > assignOtherOps()
Definition ACGrGrPoly.C:34
void addClassDescription(const std::string &doc_string)