https://mooseframework.inl.gov
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 
10 #include "PFParamsPolyFreeEnergy.h"
11 
13 
16 {
18  params.addClassDescription(
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 
61 void
63 {
64  // Convert mobility from m^2/s to the length and time 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
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 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
MaterialProperty< Real > & _Qstar
MaterialProperty< Real > & _c_eq
MaterialProperty< Real > & _D
void addRequiredParam(const std::string &name, const std::string &doc_string)
PFParamsPolyFreeEnergy(const InputParameters &parameters)
unsigned int _qp
MaterialProperty< Real > & _M
Mateiral property declarations.
static InputParameters validParams()
MaterialProperty< RealGradient > & _grad_M
void paramError(const std::string &param, Args... args) const
Real _int_width
Input parameters.
Calculated properties for a single component phase field model using polynomial free energies...
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
MaterialProperty< Real > & _W
registerMooseObject("PhaseFieldApp", PFParamsPolyFreeEnergy)
MooseUnits pow(const MooseUnits &, int)
const VariableValue & _T
MaterialProperty< Real > & _kappa