https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PFParamsPolyFreeEnergy.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 "Phase field parameters for polynomial free energy for single component systems");
20 params.addCoupledVar("T", "Temperature variable in Kelvin");
21 params.addRequiredCoupledVar("c", "Concentration");
22 params.addRequiredParam<Real>(
23 "int_width", "The interfacial width of void surface in the length scale of the problem");
24 params.addParam<Real>(
25 "length_scale", 1.0e-9, "defines the base length scale of the problem in m");
26 params.addParam<Real>("time_scale", 1.0e-9, "defines the base time scale of the problem");
27 MooseEnum poly_order("4 6 8");
29 "polynomial_order", poly_order, "Order of polynomial free energy");
30 params.addRequiredParam<Real>("D0", "Diffusivity prefactor for vacancies in m^2/s");
31 params.addRequiredParam<Real>("Em", "Migration energy in eV");
32 params.addRequiredParam<Real>("Ef", "Formation energy in eV");
33 params.addRequiredParam<Real>("surface_energy", "Surface energy in J/m2");
34 return params;
35}
36
38 : Material(parameters),
39 _c(coupledValue("c")),
40 _T(coupledValue("T")),
41 _M(declareProperty<Real>("M")),
42 _grad_M(declareProperty<RealGradient>("grad_M")),
43 _kappa(declareProperty<Real>("kappa")),
44 _c_eq(declareProperty<Real>("c_eq")),
45 _W(declareProperty<Real>("barr_height")),
46 _Qstar(declareProperty<Real>("Qstar")),
47 _D(declareProperty<Real>("D")),
48 _int_width(getParam<Real>("int_width")),
49 _length_scale(getParam<Real>("length_scale")),
50 _time_scale(getParam<Real>("time_scale")),
51 _order(getParam<MooseEnum>("polynomial_order")),
52 _D0(getParam<Real>("D0")),
53 _Em(getParam<Real>("Em")),
54 _Ef(getParam<Real>("Ef")),
55 _surface_energy(getParam<Real>("surface_energy")),
56 _JtoeV(6.24150974e18), // joule to eV conversion
57 _kb(8.617343e-5) // Boltzmann constant in eV/K
58{
59}
60
61void
63{
64 // Convert mobility from m^2/s to the length and time scale
65 Real D0_c = _D0 * _time_scale / (_length_scale * _length_scale);
66
67 Real kbT = _kb * _T[_qp];
68
69 // Compute equilibrium concentration and diffusivity
70 _c_eq[_qp] = std::exp(-_Ef / kbT);
71 _D[_qp] = D0_c * std::exp(-_Em / kbT);
72
73 // Compute free energy integral constant, such that int^1_0 f_loc = KN*sqrt(W)
74 Real KN = 0.0;
75
76 switch (_order)
77 {
78 case 0: // Fourth oder
79 KN = 2.0 / 3.0;
80 break;
81 case 1: // Sixth order
82 KN = 3.0 / 16.0 * std::sqrt(3.0) + 9.0 / 64.0 * std::sqrt(2.0) *
83 (std::log(-std::sqrt(2.0) + std::sqrt(3.0)) +
84 std::log(std::sqrt(2.0) + std::sqrt(3.0)));
85 break;
86 case 2: // Eigth order
87 KN = 0.835510425;
88 break;
89 default:
90 paramError("polynomial_order", "Incorrect polynomial order");
91 }
92
93 // Convert surface energy from J/m2 to eV/length_scale
94 Real surf_energy = _surface_energy * _JtoeV * _length_scale * _length_scale;
95
96 // Set interfacial parameter and energy barrier
97 _kappa[_qp] = surf_energy * _int_width / KN;
98 _W[_qp] = surf_energy / (2.0 * _int_width * KN);
99
100 Real Co = 0.0;
101 Real a = _c_eq[_qp];
102
103 switch (_order)
104 {
105 case 0: // 4th order polynomial
106 Co = std::pow(2.0, 5.0) * (1.0 + 2.0 * a - 2.0 * a * a);
107 break;
108 case 1: // 6th order polynomial
109 Co = std::pow(2.0, 7.0) * (9.0 / 2.0 * a - 9.0 / 2.0 * a * a + 3.0 / 4.0);
110 break;
111 case 2: // 8th order polynomial
112 Co = std::pow(2.0, 9.0) * (15.0 / 4.0 * a - 15.0 / 4.0 * a * a + 3.0 / 8.0);
113 break;
114 default:
115 mooseError("Error in PFParamsPolyFreeEnergy: incorrect polynomial order");
116 }
117
118 _M[_qp] = KN / Co * (_D[_qp] * _int_width / surf_energy);
119 _grad_M[_qp] = 0.0;
120
121 _Qstar[_qp] = -4.0; // eV
122}
registerMooseObject("PhaseFieldApp", PFParamsPolyFreeEnergy)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(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)
void addCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _qp
static InputParameters validParams()
void paramError(const std::string &param, Args... args) const
void mooseError(Args &&... args) const
Calculated properties for a single component phase field model using polynomial free energies.
MaterialProperty< Real > & _c_eq
Real _int_width
Input parameters.
MaterialProperty< Real > & _Qstar
PFParamsPolyFreeEnergy(const InputParameters &parameters)
MaterialProperty< Real > & _W
MaterialProperty< Real > & _M
Mateiral property declarations.
MaterialProperty< RealGradient > & _grad_M
MaterialProperty< Real > & _D
static InputParameters validParams()
MaterialProperty< Real > & _kappa