https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ACGBPoly.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 "ACGBPoly.h"
11#include "Material.h"
12
13registerMooseObject("PhaseFieldApp", ACGBPoly);
14
17{
19 params.addClassDescription("Grain-Boundary model concentration dependent residual");
20 params.addRequiredCoupledVar("c", "Other species concentration");
21 params.addParam<Real>("en_ratio", 1.0, "Ratio of surface energy to GB energy");
22 return params;
23}
24
26 : ACBulk<Real>(parameters),
27 _c(coupledValue("c")),
28 _c_var(coupled("c")),
29 _mu(getMaterialProperty<Real>("mu")),
30 _gamma(getMaterialProperty<Real>("gamma_asymm")),
31 _en_ratio(getParam<Real>("en_ratio"))
32{
33}
34
35Real
37{
38 Real mult = 2.0 * _en_ratio * _mu[_qp] * _gamma[_qp];
39
40 Real c = _c[_qp];
41 if (c < 1.0e-8)
42 c = 0.0;
43 if (c > 1.0)
44 c = 1.0;
45
46 switch (type)
47 {
48 case Residual:
49 return mult * _u[_qp] * c * c;
50
51 case Jacobian:
52 return mult * _phi[_j][_qp] * c * c;
53 }
54
55 mooseError("Invalid type passed in");
56}
57
58Real
60{
61 Real c = _c[_qp];
62 if (c < 1.0e-8)
63 c = 0.0;
64 if (c > 1.0)
65 c = 1.0;
66
67 if (jvar == _c_var)
68 {
69 Real mult = 2.0 * _en_ratio * _mu[_qp] * _gamma[_qp];
70 Real dDFDOP = 2.0 * mult * _u[_qp] * c * _phi[_j][_qp];
71
72 return _L[_qp] * _test[_i][_qp] * dDFDOP;
73 }
74
75 return 0.0;
76}
registerMooseObject("PhaseFieldApp", ACGBPoly)
void mooseError(Args &&... args)
This is the Allen-Cahn equation base class that implements the bulk or local energy term of the equat...
Definition ACBulk.h:25
const MaterialProperty< Real > & _L
Mobility.
Definition ACBulk.h:46
static InputParameters validParams()
Definition ACBulk.h:69
virtual Real computeDFDOP(PFFunctionType type)
Definition ACGBPoly.C:36
Real _en_ratio
Definition ACGBPoly.h:33
const MaterialProperty< Real > & _gamma
Definition ACGBPoly.h:31
ACGBPoly(const InputParameters &parameters)
Definition ACGBPoly.C:25
const MaterialProperty< Real > & _mu
Definition ACGBPoly.h:30
const VariableValue & _c
Definition ACGBPoly.h:27
static InputParameters validParams()
Definition ACGBPoly.C:16
unsigned int _c_var
Definition ACGBPoly.h:28
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition ACGBPoly.C:59
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)