Skip to content
Snippets Groups Projects
Commit 89c2cc82 authored by Nicolas Eßing's avatar Nicolas Eßing
Browse files

State of submitting my thesis. Merge MATLAB code to tex.

parents 4786a80b 74f0a9b7
No related branches found
No related tags found
No related merge requests found
Showing
with 922 additions and 172 deletions
classdef AistSimulation < phasefieldMethod.TestSimulation & ...
simulationModels.AllPhysicalSimulation & ...
simulationModels.ThompsonSpaepen & ...
simulationModels.CombinedViscosity_1 & ...
simulationModels.WilsonFrenkelVelocity & ...
simulationModels.ClassicalNucleation
%AISTSIMULATION The simulation model for AIST
% TODO
properties (SetAccess = protected)
% Free energy
Lv = 878.9e6; % Latent heat [J/m^3]
L = 173e-3 * simulationModels.Constants.eV
Tm = 817; % Melting temperature [K]
% Viscosity
Tglass = 700; %TODO
ninf = 1.22e-3; % Viscosity for T -> Inf [Pa*s]
Tg = 445; % Glass transition temperature [K]
m = 128; % Fragility
Ea = 2.90 * simulationModels.Constants.eV; % Activation energy [eV]
% Velocity
jd = 1e-10;
r_atom = 1.5e-10;
R_hyd = 0.5e-10;
% Nucleation
IE = 5.5e-2; % Interfacial energy [J/m^2]
Vm;
end
properties (SetAccess = protected)
DIT; % diffuse interface thickness [m]
end
methods
function S = AistSimulation(spacing, seed)
S@phasefieldMethod.TestSimulation(spacing, seed);
S@simulationModels.AllPhysicalSimulation(spacing, seed);
S@simulationModels.WilsonFrenkelVelocity(spacing, seed);
S@simulationModels.ThompsonSpaepen(spacing, seed);
S@simulationModels.CombinedViscosity_1(spacing, seed);
S.Vm = S.L / S.Lv;
end
function S = setParameters(S, DIT, T)
S.DIT = DIT;
S.T = T;
end
function S = apply(S)
S.J = S.nucleationRate();
S = apply@simulationModels.AllPhysicalSimulation(S);
end
end
end
classdef GSTSimulation < phasefieldMethod.TestSimulation & ...
simulationModels.AllPhysicalSimulation & ...
simulationModels.ThompsonSpaepen & ...
simulationModels.CombinedViscosity11 & ...
simulationModels.CombinedVelocity & ...
simulationModels.HeterogeneousNucleation
%GSTSIMULATION A simulation for the model Zhi Yang used for GST.
properties (SetAccess = protected)
DIT; % diffuse interface thickness [m]
structf; % structure factor for nucleation
end
properties (SetAccess = protected)
IE = 0.06; % interfacial energy [J/m^2]
Lv = 625e6; % latent heat [J/m^3]
L = 625e6 * 2.9e-28; % latent heat per atom [J]
Vm = 2.9e-28; % volume per atom [m^3]
Tm = 889; % melting temperature [K]
ninf = 0.012; % viscosity for infinite temperature [Pa*s]
m = 140; % fragility
Tg = 472; % other glass transition temperature [K]
jd = 2.99e-10; % jump distance [m]
Ea = 2.3 * 1.6e-19; % activation energy [J]
Tglass = 534; % glass transition temperature [K]
r_atom = 1;
R_hyd = 1;
wa = 180; % wetting ange [degrees]
end
methods
function S = GSTSimulation(spacing, seed)
S@phasefieldMethod.TestSimulation(spacing, seed);
S@simulationModels.AllPhysicalSimulation(spacing, seed);
S@simulationModels.CombinedVelocity(spacing, seed);
S@simulationModels.ThompsonSpaepen(spacing, seed);
S@simulationModels.CombinedViscosity11(spacing, seed);
end
function S = setParameters(S, DIT, T)
S = S.assertForm(DIT, 'interface thickness');
S = S.assertForm(T, 'temperature');
S.DIT = DIT;
S.T = T;
end
function S = apply(S)
neighs = phasefieldMethod.analyse_structure_27(S.phasefield);
s = (2+cosd(S.wa)) * (1-cosd(S.wa)) * (1-cosd(S.wa)) /4;
S.structf = (neighs == 0) * 1 + ...
and((neighs >= 1), (neighs < 7)) * s*(1.2^2) + ...
and((neighs >= 7), (neighs < 26)) * s*1.2 + ...
(neighs >= 26) * s;
S.J = S.nucleationRate();
S = apply@simulationModels.AllPhysicalSimulation(S);
end
function s = structfactor(S)
s = S.structf;
end
function backupParams(S, file)
% Write the settings and evolution parameters to a .mat file.
% Arguments:
% file - Handle of a .mat file
% Returns nothing
S.backupParamsCore(file);
file.IE = S.IE;
file.DIT = S.DIT;
file.L = S.L;
file.Tm = S.Tm;
file.T = S.T;
% file.Vm = S.Vm;
file.ninf = S.ninf;
file.m = S.m;
file.Tg = S.Tg;
file.jd = S.jd;
file.Ea = S.Ea;
file.Tglass = S.Tglass;
file.wa = S.wa;
end
end
methods (Static)
function S = fromBackup(paramsfile, statefile)
S = phasefieldMethod.Simulation.fromBackupCore( ...
@phasefieldMethod.GSTSimulation, paramsfile, statefile);
S.IE = paramsfile.IE;
S.DIT = paramsfile.DIT;
S.L = paramsfile.L;
S.Tm = paramsfile.Tm;
S.T = paramsfile.T;
% S.Vm = paramsfile.Vm;
S.ninf = paramsfile.ninf;
S.m = paramsfile.m;
S.Tg = paramsfile.Tg;
S.jd = paramsfile.jd;
S.Ea = paramsfile.Ea;
S.Tglass = paramsfile.Tglass;
S.wa = paramsfile.wa;
S = S.apply();
end
end
end
classdef GeTeSimulation < phasefieldMethod.TestSimulation
classdef GeTeSimulation < phasefieldMethod.TestSimulation & ...
simulationModels.AllPhysicalSimulation & ...
simulationModels.ThompsonSpaepen & ...
simulationModels.CombinedViscosity11 & ...
simulationModels.FrenkelSimplifiedVelocity & ...
simulationModels.ClassicalNucleation
%GETESIMULATION A simulation model for GeTe. Temperature dependent
% Arrhenius behaviour for growth velocity and nucleation rate and a
% numerically set critical radius.
......@@ -7,81 +12,65 @@ classdef GeTeSimulation < phasefieldMethod.TestSimulation
% of 1.0789e64 m^-3*s^-2 * exp(-4.3eV/kB/T) is from A. M. Mio et al
% (who also give other values for v).
properties
properties (SetAccess = protected)
DIT = 0; % interface thickness [m]
r_c = 0; % critical radius [m]
T = 0; % temperature [K]
vinf = 5.9e14; % growth velocity for infinite temperature [m/s]
Ea_v = 1.77 % activation energy for velocity [eV]
Jinf = 1.0798e+64; % nucleation rate for infinite T [1/m^3/s]
Ea_J = 4.3; % activation energy for nucleation [eV]
end
end
properties ( Constant )
kB = 1.380649e-23; % Boltzmann constant, [J/K]
eV = 1.602176634e-19 % Electron volt [J]
properties (SetAccess = protected)
% For free energy
Lv = 17.9e3 / 33.11e-6
L = 17.9e3 / 33.11e-6 * 55e-30
Tm = 1000;
% For viscosity
ninf = 10^(-3.2);
Tg = 432.1;
m = 130.7
Tglass = 454
Ea = 1.85 * simulationModels.Constants.eV;
% For velocity
Atilde = 10^(-2);
% For nucleation
Vm = 55e-30;
jd = 3.8e-10;
IE;
IE_0 = 5.7e20 * 1e-3*simulationModels.Constants.eV;
IE_m = 0.021e20 * 1e-3*simulationModels.Constants.eV;
end
methods
function S = GeTeSimulation(spacing, seed)
S = S@phasefieldMethod.TestSimulation(spacing, seed);
S.M = 1;
S@phasefieldMethod.TestSimulation(spacing, seed);
S@simulationModels.AllPhysicalSimulation(spacing, seed);
S@simulationModels.ThompsonSpaepen(spacing, seed);
S@simulationModels.CombinedViscosity11(spacing, seed);
S@simulationModels.FrenkelSimplifiedVelocity(spacing, seed);
S@simulationModels.ClassicalNucleation();
end
function S = setParameters(S, DIT, r_c)
%SETPARAMETERS(DIT, r_c, T) - Set the numerical parameters
function S = setParameters(S, DIT)
%SETPARAMETERS(DIT) - Set the numerical parameters
% Arguments:
% DIT - diffuse interface thickness [m]
% r_c - critical radius [m]
% Returns:
% S - The updated object
assert(isscalar(DIT) && isnumeric(DIT), 'DIT has wrong type or size');
assert(isscalar(r_c) && isnumeric(r_c), 'DIT has wrong type or size');
S.DIT = single( DIT );
S.r_c = single( r_c );
v = S.vinf .* exp( - S.Ea_v .* S.eV ./ (S.kB .* S.T) );
S.eps = sqrt(v .* r_c ./ 2);
S.W = v .* r_c ./ (4 .* DIT .^2);
S.dGv = v ./ (6 .* DIT);
end
function S = setTemp(S, T)
% Initialise or update the temperature field
S = S.assertForm(T, 'T');
S.T = T;
v = S.vinf .* exp( - S.Ea_v .* S.eV ./ (S.kB .* S.T) );
S.eps = sqrt(v .* S.r_c ./ 2);
S.W = v .* S.r_c ./ (4 .* S.DIT .^2);
S.dGv = v ./ (6 .* S.DIT);
S.J = S.Jinf .* exp( - S.Ea_J .* S.eV ./ (S.kB .* S.T) );
end
function S = apply(S)
v = S.vinf .* exp( - S.Ea_v .* S.eV ./ (S.kB * S.T));
S.M = 1;
S.eps = sqrt(v .* S.r_c ./ 2);
S.W = v .* S.r_c ./ (4 .* S.DIT .^2);
S.dGv = v ./ (6 .* S.DIT);
S.J = S.Jinf .* exp( - S.Ea_J .* S.eV ./ (S.kB .* S.T) );
S = apply@phasefieldMethod.Simulation(S);
S.IE = S.IE_0 + S.IE_m .* S.T;
S.J = S.nucleationRate();
S = apply@simulationModels.AllPhysicalSimulation(S);
end
function exportParameters(S, folder, index)
%EXPORTPARAMETERS(folder, index) - Export the current
% parameters.
% This function does nothing, but can be overwritten to export
% parameters.
% In this class, the temperature field is exported.
% Arguments:
% folder - Name of the folder to save in. Must already exist.
% index - An index to this export. Will appear in the
......@@ -90,13 +79,12 @@ classdef GeTeSimulation < phasefieldMethod.TestSimulation
filename = fullfile(folder,sprintf('temperature_%d.vtk',index));
phasefieldMethod.mat2vtk(S.T, filename, S.spacing, ...
[0,0,0], 'grainindices');
[0,0,0], 'temperature');
end
function backupParams(S, file)
S.backupParamsCore(file);
file.DIT = S.DIT;
file.r_c = S.r_c;
file.T = S.T;
file.vinf = S.vinf;
file.Ea_v = S.Ea_v;
......@@ -112,7 +100,6 @@ classdef GeTeSimulation < phasefieldMethod.TestSimulation
paramsfile, statefile);
S.DIT = paramsfile.DIT;
S.r_c = paramsfile.r_c;
S.T = paramsfile.T;
S.vinf = paramsfile.vinf;
S.Ea_v = paramsfile.Ea_v;
......
classdef SbTeSimulation < phasefieldMethod.TestSimulation & ...
simulationModels.AllPhysicalSimulation & ...
simulationModels.ThompsonSpaepen & ...
simulationModels.ArrheniusVelocity & ...
simulationModels.ArrheniusViscosity & ...
simulationModels.ClassicalNucleation
%SBTESIMULATION The simulation model for Sb2Te
% TODO
properties (SetAccess = protected)
% For free energy
Tm = 837.5; % Melting temperature [K]
Lv = 296.4e6; % Latent heat [J/m^3]
L;
% For velocity
v00 = 1.89885855985e+15; % Growth velocity for T -> Inf [m/s]
Ea = 2.91633477015e-19; % Activation energy [J]
% For nucleation
IE = 7.29e-2;
n00 = 1.2e-99;
jd = 1;
Vm = 4*pi/3;
end
properties (SetAccess = protected)
DIT; % diffuse interface thickness [m]
end
methods
function S = SbTeSimulation(spacing, seed)
S@phasefieldMethod.TestSimulation(spacing, seed);
S@simulationModels.AllPhysicalSimulation(spacing, seed);
S@simulationModels.ThompsonSpaepen(spacing, seed);
S@simulationModels.ArrheniusVelocity(spacing, seed);
S@simulationModels.ArrheniusViscosity(spacing, seed);
S@simulationModels.ClassicalNucleation();
end
function S = setParameters(S, DIT, T)
S.DIT = DIT;
S.T = T;
end
function S = apply(S)
S.J = S.nucleationRate();
S = apply@simulationModels.AllPhysicalSimulation(S);
end
end
end
classdef ScaleableAist < phasefieldMethod.TestSimulation & ...
simulationModels.ScaleableSimulation & ...
simulationModels.ThompsonSpaepen & ...
simulationModels.CombinedViscosity_1 & ...
simulationModels.WilsonFrenkelVelocity & ...
simulationModels.ClassicalNucleation
%AISTSIMULATION The simulation model for AIST
% TODO
properties (SetAccess = protected)
% Free energy
Lv = 878.9e6; % Latent heat [J/m^3]
L = 173e-3 * simulationModels.Constants.eV
Tm = 817; % Melting temperature [K]
% Viscosity
Tglass = 700; %TODO
ninf = 1.22e-3; % Viscosity for T -> Inf [Pa*s]
Tg = 445; % Glass transition temperature [K]
m = 128; % Fragility
Ea = 2.91 * simulationModels.Constants.eV; % Activation energy [eV]
% Velocity
jd = 1e-10;
r_atom = 1.5e-10;
R_hyd = 0.5e-10;
% Nucleation
IE = 5.5e-2; % Interfacial energy [J/m^2]
Vm;
end
properties (SetAccess = protected)
DIT; % diffuse interface thickness [m]
r_c; % Critical radius [m]
end
methods
function S = ScaleableAist(spacing, seed)
S@phasefieldMethod.TestSimulation(spacing, seed);
S@simulationModels.ScaleableSimulation(spacing, seed);
S@simulationModels.WilsonFrenkelVelocity(spacing, seed);
S@simulationModels.ThompsonSpaepen(spacing, seed);
S@simulationModels.CombinedViscosity_1(spacing, seed);
S.Vm = S.L / S.Lv;
end
function S = setParameters(S, DIT, r_c, T)
S.DIT = DIT;
S.r_c = r_c;
S.T = T;
end
function S = apply(S)
S.J = S.nucleationRate();
S = apply@simulationModels.ScaleableSimulation(S);
end
end
end
classdef SbTeSimulation < phasefieldMethod.TestSimulation
classdef ScaleableSbTe < phasefieldMethod.TestSimulation & ...
simulationModels.ScaleableSimulation & ...
simulationModels.ThompsonSpaepen & ...
simulationModels.ArrheniusVelocity & ...
simulationModels.ArrheniusViscosity & ...
simulationModels.ClassicalNucleation
%SBTESIMULATION The simulation model for Sb2Te
% TODO
properties (Constant)
vinf = 1.89885855985e+15; % growth velocity for T -> Inf [m/s]
Ea = 21122.9267551; % activation energy divided by kB [K]
properties (SetAccess = protected)
% For free energy
Tm = 837.5; % Melting temperature [K]
Lv = 296.4e6; % Latent heat [J/m^3]
L;
% For velocity
v00 = 1.89885855985e+15; % Growth velocity for T -> Inf [m/s]
Ea = 2.91633477015e-19; % Activation energy [J]
% For nucleation
IE = 7.29e-2;
n00 = 1.2e-99;
jd = 1;
Vm = 4*pi/3;
end
properties (SetAccess = protected)
DIT; % diffuse interface thickness [m]
r_c; % critical radius [m]
T; % temperature [K]
end
properties (SetAccess = private, GetAccess = private)
......@@ -18,7 +34,7 @@ classdef SbTeSimulation < phasefieldMethod.TestSimulation
end
methods
function S = SbTeSimulation(spacing, seed, printNucleiSizes)
function S = ScaleableSbTe(spacing, seed, printNucleiSizes)
%SBTESIMULATION(spacing, seed, printNucleiSizes) - Create a
% simulation for Sb2Te.
% Before simulating, you need to pass parameters, define a time
......@@ -30,25 +46,25 @@ classdef SbTeSimulation < phasefieldMethod.TestSimulation
% printed into the infoLine
% Returns:
% S - An instance of this class
%
% All subclasses must define a consturctor to call this
% superclass constructor to provide these parameters.
S = S@phasefieldMethod.TestSimulation(spacing, seed);
S@phasefieldMethod.TestSimulation(spacing, seed);
S@simulationModels.ScaleableSimulation(spacing, seed);
S@simulationModels.ThompsonSpaepen(spacing, seed);
S@simulationModels.ArrheniusVelocity(spacing, seed);
S@simulationModels.ArrheniusViscosity(spacing, seed);
S@simulationModels.ClassicalNucleation();
S.printNucleiSizes = printNucleiSizes;
end
function S = setParameters(S, DIT, r_c, T, J)
function S = setParameters(S, DIT, r_c, T)
S.DIT = DIT;
S.r_c = r_c;
S.T = T;
S.J = J;
v = S.vinf .* exp(-S.Ea ./ T);
S.M = 1;
S.eps = sqrt( v .* r_c ./ 2 );
S.W = v .* r_c ./ (4 * DIT .* DIT);
S.dGv = v ./ (6 * DIT);
end
function S = apply(S)
S.J = S.nucleationRate();
S = apply@simulationModels.ScaleableSimulation(S);
end
function l = infoLine(S)
......@@ -82,4 +98,4 @@ classdef SbTeSimulation < phasefieldMethod.TestSimulation
end
end
\ No newline at end of file
end
classdef SimpleGeTe < phasefieldMethod.TestSimulation & ...
simulationModels.ScaleableSimulation & ...
simulationModels.FrenkelSimplifiedVelocity & ...
simulationModels.ThompsonSpaepen & ...
simulationModels.CombinedViscosity11 & ...
simulationModels.ArrheniusNucleation
%GETESIMULATION A simulation model for GeTe. Temperature dependent
% Arrhenius behaviour for growth velocity and nucleation rate and a
% numerically set critical radius.
% The growth velocity of 5.9e14 m/s * exp(-1.77eV/kB/T) is taken from
% Q. M. Lu and M. Libera, the nucleation rate
% of 1.0789e64 m^-3*s^-2 * exp(-4.3eV/kB/T) is from A. M. Mio et al
% (who also give other values for v).
properties (SetAccess = protected)
DIT = 0; % interface thickness [m]
r_c = 0;
end
properties (SetAccess = protected)
% For viscosity
ninf = 10^(-3.2);
Tg = 432.1;
m = 130.7
Tglass = 454
Ea = 1.85 * simulationModels.Constants.eV;
% For free energy
Lv = 17.9e3 / 33.11e-6
L = 17.9e3 / 33.11e-6 * 55e-30
Tm = 1000;
% For velocity
Atilde = 10^(-2);
% For nucleation
J_Ea = 4.3 * simulationModels.Constants.eV;
J00 = exp(103);
end
methods
function S = SimpleGeTe(spacing, seed)
S@phasefieldMethod.TestSimulation(spacing, seed);
S@simulationModels.ScaleableSimulation(spacing, seed);
S@simulationModels.ThompsonSpaepen(spacing, seed);
S@simulationModels.CombinedViscosity11(spacing, seed);
S@simulationModels.FrenkelSimplifiedVelocity(spacing, seed);
S@simulationModels.ArrheniusNucleation();
end
function S = setParameters(S, DIT, r_c)
%SETPARAMETERS(DIT, r_c) - Set the numerical parameters
% Arguments:
% DIT - diffuse interface thickness [m]
% r_c - critical radius [m]
% Returns:
% S - The updated object
assert(isscalar(DIT) && isnumeric(DIT), 'DIT has wrong type or size');
assert(isscalar(r_c) && isnumeric(r_c), 'r_c has wrong type or size');
S.DIT = single( DIT );
S.r_c = single( r_c );
end
function S = apply(S)
S.J = S.nucleationRate();
S = apply@simulationModels.ScaleableSimulation(S);
end
function exportParameters(S, folder, index)
%EXPORTPARAMETERS(folder, index) - Export the current
% parameters.
% In this class, the temperature field is exported.
% Arguments:
% folder - Name of the folder to save in. Must already exist.
% index - An index to this export. Will appear in the
% filename.
% Returns nothing.
filename = fullfile(folder,sprintf('temperature_%d.vtk',index));
phasefieldMethod.mat2vtk(S.T, filename, S.spacing, ...
[0,0,0], 'temperature');
end
function backupParams(S, file)
S.backupParamsCore(file);
file.DIT = S.DIT;
file.T = S.T;
file.vinf = S.vinf;
file.Ea_v = S.Ea_v;
file.Jinf = S.Jinf;
file.Ea_J = S.Ea_J;
end
end
methods( Static )
function S = fromBackup(paramsfile, statefile)
S = phasefieldMethod.Simulation.fromBackupCore( ...
@phasefieldMethod.SimpleSimulation, ...
paramsfile, statefile);
S.DIT = paramsfile.DIT;
S.T = paramsfile.T;
S.vinf = paramsfile.vinf;
S.Ea_v = paramsfile.Ea_v;
S.Jinf = paramsfile.Jinf;
S.Ea_J = paramsfile.Ea_J;
S = S.apply();
end
end
end
\ No newline at end of file
classdef GSTSimulation < phasefieldMethod.TestSimulation
%GSTSIMULATION A simulation for the model Zhi Yang used for GST.
% Default parameters are for GST but can be replaced.
properties
IE = 0.06; % interfacial energy [J/m^2]
DIT; % diffuse interface thickness [m]
L = 625e6; % latent heat [J/m^3]
Tm = 889; % melting temperature [K]
T; % temperature [K]
Vm = 2.9e-28; % volume of a monomer [m^3]
ninf = 0.012; % viscosity for infinite temperature [Pa*s]
m = 140; % fragility
Tg = 472; % other glass transition temperature [K]
jd = 2.99e-10; % jump distance [m]
Ea = 2.3 * 1.6e-19; % activation energy [J]
Tglass = 534; % glass transition temperature [K]
wa = 180; % wetting ange [degrees]
end
properties (SetAccess = protected)
n; % viscosity [Pa*s]
end
properties ( Constant )
kB = 1.380649e-23; % Boltzmann constant, [J/K]
eV = 1.602176634e-19 % Electron volt [J]
end
methods
function S = GSTSimulation(spacing, seed)
S = S@phasefieldMethod.TestSimulation(spacing, seed);
end
function S = apply(S)
S.eps = sqrt(6*S.IE*S.DIT);
S.W = 3*S.IE/S.DIT;
S.dGv = S.L*(S.Tm - S.T)*2.*S.T/S.Tm./(S.Tm+S.T);
dGv00 = S.L*(S.Tm - S.Tglass)*2*S.Tglass/S.Tm/(S.Tm+S.Tglass);
n00 = (10^(log10(S.ninf)+(12-log10(S.ninf))*(S.Tg/S.Tglass)*...
exp((S.m/(12-log10(S.ninf))-1)*(S.Tg/S.Tglass-1))));
n0 = n00/exp(S.Ea/S.kB/S.Tglass);
vinf = 4*S.kB*S.Tglass*(1-exp(-dGv00*S.Vm/S.kB/S.Tglass))/...
(3*pi*S.jd*S.jd*n00*dGv00)/exp(-S.Ea/S.kB/S.Tglass);
structneighbours27 = phasefieldMethod.analyse_structure_27(S.phasefield);
sf = structfactor(S.wa, gather(structneighbours27));
S.n = viscosity(n0, S.Ea, S.T, S.Tglass, S.m, S.ninf, S.Tg);
S.J = nucleationrate(S.dGv, S.IE, S.Vm, S.T, S.jd, S.n, sf);
S.M = mobility(S.W, S.eps, vinf, S.Ea, S.Tglass, S.T, ...
S.dGv, S.Vm, S.jd, S.n);
S = apply@phasefieldMethod.Simulation(S);
end
function backupParams(S, file)
% Write the settings and evolution parameters to a .mat file.
% Arguments:
% file - Handle of a .mat file
% Returns nothing
S.backupParamsCore(file);
file.IE = S.IE;
file.DIT = S.DIT;
file.L = S.L;
file.Tm = S.Tm;
file.T = S.T;
file.Vm = S.Vm;
file.ninf = S.ninf;
file.m = S.m;
file.Tg = S.Tg;
file.jd = S.jd;
file.Ea = S.Ea;
file.Tglass = S.Tglass;
file.wa = S.wa;
end
end
methods (Static)
function S = fromBackup(paramsfile, statefile)
S = phasefieldMethod.Simulation.fromBackupCore( ...
@phasefieldMethod.GSTSimulation, paramsfile, statefile);
S.IE = paramsfile.IE;
S.DIT = paramsfile.DIT;
S.L = paramsfile.L;
S.Tm = paramsfile.Tm;
S.T = paramsfile.T;
S.Vm = paramsfile.Vm;
S.ninf = paramsfile.ninf;
S.m = paramsfile.m;
S.Tg = paramsfile.Tg;
S.jd = paramsfile.jd;
S.Ea = paramsfile.Ea;
S.Tglass = paramsfile.Tglass;
S.wa = paramsfile.wa;
S = S.apply();
end
end
end
function M = mobility(W, eps, vinf, Ea, Tglass, T, dGv, Vm, jd, n)
%TODO doc
kBT = phasefieldMethod.GSTSimulation.kB.*T;
% for T < Tglass
M = sqrt(2*W)/6/eps*vinf*exp(-Ea./kBT);
% for T>Tglass
upf2 = sqrt(2*W)/6/eps*4.*kBT.*(1-exp(-dGv*Vm./kBT))./(3*pi*jd*jd*n.*dGv);
% combine
M(T > Tglass) = upf2(T > Tglass);
end
function J = nucleationrate(dGv, IE, Vm, T, jd, n, structfactor)
%TODO doc
dGv = max(dGv, 0); % change negative terms to zero
rcrit = 2 * IE ./ dGv; % critical radius matrix
nc = 4/3*pi * (rcrit).^3 /Vm; % points in critical nucleus
kBT = phasefieldMethod.GSTSimulation.kB*T;
jf = kBT./(3*pi*jd*jd*jd*n); % jump frequency
I0 = 4*jf.*(nc.^(2/3)).*sqrt(dGv*Vm./(6*pi*nc.*kBT))/Vm; % nuclatio rate prefactor
dGc = 16/3*pi*(IE^3)./(dGv.*dGv); % nucleaton barrier energy
dGc = dGc .* structfactor; % consider heterogeneous effects
J = I0.*exp(-dGc./kBT); % nucleation rate
end
function n = viscosity(n0, Ea, T, Tglass, m, ninf, Tg)
%TODO doc
kBT = phasefieldMethod.GSTSimulation.kB*T;
n = n0*exp(Ea/kBT); % viscosity for T < Tglass
n2 = 10.^(log10(ninf)+(12-log10(ninf)) ... % T > Tglass
*(Tg./T).*exp((m/(12-log10(ninf))-1)*(Tg./T -1)));
n(T > Tglass) = n2(T > Tglass);
%TODO if n goes to Inf at some points, it might be necessary to fix
end
function sf = structfactor(wa, neighs)
s =(2+cosd(wa))*(1-cosd(wa))*(1-cosd(wa))/4;
sf = (neighs == 0) * 1 + ...
and((neighs >= 1), (neighs < 7)) * s*(1.2^2) + ...
and((neighs >= 7), (neighs < 26)) * s*1.2 + ...
(neighs >= 26) * s;
end
\ No newline at end of file
classdef AllPhysicalSimulation < simulationModels.PhysicalSimulation
%ALLPHYSICALSIMULATION - A simulation using only physically reasonable
% values.
%
% Properties that need to be defined by subclasses:
% DIT
% IE
%
% Methods that need to be provided by subclasses:
% volumefreeEnergy
% velocity
% nucleationRate
properties (Abstract, SetAccess = protected)
DIT;
IE;
end
methods
function S = AllPhysicalSimulation(spacing, seed)
S@simulationModels.PhysicalSimulation(spacing, seed);
end
function S = apply(S)
S.eps = sqrt(6 .* S.IE .* S.DIT);
S.W = 3 .* S.IE ./ S.DIT;
S.dGv = S.volumeFreeEnergy();
S.M = S.velocity() ./ (6 * S.DIT .* S.dGv);
S = apply@simulationModels.PhysicalSimulation(S);
end
end
end
classdef ArrheniusNucleation
%ARRHENIUSNUCLEATION A arrhenius approximation for the nucleation rate.
properties (Abstract, SetAccess = protected)
J_Ea;
J00;
end
methods
function J = nucleationRate(S)
kB = simulationModels.Constants.kB;
J = S.J00 .* exp( - S.J_Ea ./ kB ./ S.T );
end
end
end
classdef ArrheniusVelocity < simulationModels.PhysicalSimulation
%ARRHENIUSVELOCITY - A simulation with an arrhenius model for the
% growth velocity.
%
% Properties that need to be defined by subclasses:
% v00 - velocity for T -> inf [m/s]
% Ea - Activation energy [J]
%
% Methods provided:
% velocity
properties (Abstract, SetAccess = protected)
v00; % velocity for T -> inf [m/s]
Ea; % Activation energy [J]
end
methods
function S = ArrheniusVelocity(spacing, seed)
S = S@simulationModels.PhysicalSimulation(spacing, seed);
end
function v = velocity(S)
kB = simulationModels.Constants.kB;
v = S.v00 .* exp( - S.Ea ./ (kB * S.T));
end
end
end
classdef ArrheniusViscosity < simulationModels.PhysicalSimulation
%ARRHENIUSVISCOSITY - A simulation with an arrhenius model for the
% viscosity.
%
% Properties that need to be defined by subclasses:
% n00 - Viscosity for T -> inf [Pa*s]
% Ea - Activation energy [J]
%
% Methods provided:
% viscosity
properties (Abstract, SetAccess = protected)
n00; % Viscosity for T -> inf [Pa*s]
Ea; % Activation energy [J]
end
methods
function S = ArrheniusViscosity(spacing, seed)
S = S@simulationModels.PhysicalSimulation(spacing, seed);
end
function n = viscosity(S)
kB = simulationModels.Constants.kB;
n = S.n00 .* exp( S.Ea ./ (kB * S.T));
end
end
end
classdef ClassicalNucleation < simulationModels.HeterogeneousNucleation
%CLASSICALNUCLEATION - A simulation using classical nucleation theory
% for the nucleation rate.
% Uses the more general heterogeneous model with a structfactor set to
% one.
%
% Properties that need to be defined by subclasses:
% jd
% IE
%
% Methods that need to be provided by subclasses:
% volumefreeEnergy
% viscosity
%
% Methods provided:
% structfactor
% nucleationRate
% apply
methods (Abstract)
volumeFreeEnergy(S)
viscosity(S)
end
methods
function s = structfactor(S)
s = 1;
end
end
end
classdef CombinedVelocity < simulationModels.ArrheniusVelocity & ...
simulationModels.WilsonFrenkelVelocity
%COMBINEDVELOCITY - A simulation with a combined model for the groth
% velocity.
%
% Properties that need to be defined by subclasses:
% jd
% r_atom
% R_hyd
% Ea
%
% Methods that need to be provided by subclasses:
% freeEnergy
% viscosity
%
% Methods provided:
% velcocity
properties (Abstract, SetAccess = protected)
Tglass; % Glass transition temperature
end
properties (SetAccess = protected)
v00;
end
methods
function S = CombinedVelocity(spacing, seed)
S@simulationModels.ArrheniusVelocity(spacing, seed);
S@simulationModels.WilsonFrenkelVelocity(spacing, seed);
% Make the transition between the models continuous
kB = simulationModels.Constants.kB;
Ttemp = S.T;
S.T = S.Tglass;
S.v00 = S.velocity() / exp( - S.Ea ./ (kB * S.Tglass));
S.T = Ttemp;
end
function v = velocity(S)
v = velocity@simulationModels.WilsonFrenkelVelocity(S);
v2 = velocity@simulationModels.ArrheniusVelocity(S);
v(S.T<S.Tglass) = v2(S.T<S.Tglass);
end
end
end
classdef CombinedViscosity11 < simulationModels.ArrheniusViscosity & ...
simulationModels.MyegaViscosity11
%COMBINEDVISCOSITY - A simulation with a combined model for the
% viscosity, using the MYEGA model for temperatures above the glass
% transition temperature Tglass and an Arrhenius model for lower
% temperatures.
%
% Properties that need to be defined by subclasses:
% Tglass
% Ea
% ninf
% Tg
% m
%
% Methods provided:
% viscosity
properties (Abstract, SetAccess = protected)
Tglass; % Glass transition temperature
end
properties (SetAccess = protected)
n00;
end
methods
function S = CombinedViscosity11(spacing, seed)
S@simulationModels.ArrheniusViscosity(spacing, seed);
S@simulationModels.MyegaViscosity11(spacing, seed);
% Make the transition between the models continuous
kB = simulationModels.Constants.kB;
% S.n00 = S.temperaureViscosity(S.Tglass) / ...
S.n00 = (10^(log10(S.ninf)+(12-log10(S.ninf))*(S.Tg/S.Tglass)*...
exp((S.m/(12-log10(S.ninf))-1)*(S.Tg/S.Tglass-1)))) / ...
exp( S.Ea ./ (kB * S.Tglass));
end
function n = viscosity(S)
n = viscosity@simulationModels.MyegaViscosity11(S);
n2 = viscosity@simulationModels.ArrheniusViscosity(S);
n(S.T<S.Tglass) = n2(S.T<S.Tglass);
end
end
end
classdef CombinedViscosity_1 < simulationModels.ArrheniusViscosity & ...
simulationModels.MyegaViscosity_1
%COMBINEDVISCOSITY - A simulation with a combined model for the
% viscosity, using the MYEGA model for temperatures above the glass
% transition temperature Tglass and an Arrhenius model for lower
% temperatures.
%
% Properties that need to be defined by subclasses:
% Tglass
% Ea
% ninf
% Tg
% m
%
% Methods provided:
% viscosity
properties (Abstract, SetAccess = protected)
Tglass; % Glass transition temperature
end
properties (SetAccess = protected)
n00;
end
methods
function S = CombinedViscosity_1(spacing, seed)
S@simulationModels.ArrheniusViscosity(spacing, seed);
S@simulationModels.MyegaViscosity_1(spacing, seed);
% Make the transition between the models continuous
kB = simulationModels.Constants.kB;
S.n00 = S.temperaureViscosity(S.Tglass) / ...
exp( S.Ea ./ (kB * S.Tglass));
end
function n = viscosity(S)
n = viscosity@simulationModels.MyegaViscosity_1(S);
n2 = viscosity@simulationModels.ArrheniusViscosity(S);
n(S.T<S.Tglass) = n2(S.T<S.Tglass);
end
end
end
classdef Constants
% A class that defines some general used constants.
properties (Constant)
kB = 1.380649e-23; % Boltzmann constant, [J/K]
eV = 1.602176634e-19 % Electron volt [J]
Na = 6.02214076e23 % Avogadro constant [1/mol]
zeroC = 273.15 % Zero degrees celsius [K]
end
end
\ No newline at end of file
classdef FrenkelSimplifiedVelocity < simulationModels.PhysicalSimulation
%WILSONFRENKELVELOCITY - A simulation using a velocity from the Wilson
% and Frenkel model.
%
% Properties that need to be defined by subclasses:
% Atilde
%
% Methods that need to be provided by subclasses:
% freeEnergy
% viscosity
%
% Methods provided:
% velcocity
properties (Abstract, SetAccess = protected)
Atilde
end
methods (Abstract)
freeEnergy(S)
viscosity(S)
end
methods
function S = FrenkelSimplifiedVelocity(spacing, seed)
S@simulationModels.PhysicalSimulation(spacing, seed);
end
function v = velocity(S)
kB = simulationModels.Constants.kB;
v = S.Atilde ./ S.viscosity() .* ...
(1 - exp(- S.freeEnergy() ./ (kB .* S.T)) );
end
end
end
classdef HeterogeneousNucleation
%CLASSICALNUCLEATION - A simulation using classical nucleation theory
% for the nucleation rate, but includes heterogeneous effects.
%
% Properties that need to be defined by subclasses:
% jd
% IE
%
% Methods that need to be provided by subclasses:
% volumefreeEnergy
% viscosity
% structfactor
%
% Methods provided:
% nucleationRate
% apply
properties (Abstract, SetAccess = protected)
jd;
IE;
Vm;
end
methods (Abstract)
volumeFreeEnergy(S)
viscosity(S)
structfactor(S)
end
methods
function J = nucleationRate(S)
kB = simulationModels.Constants.kB;
dGv = S.volumeFreeEnergy();
sf = S.structfactor();
nc = 32 * pi ./ (3 .* S.Vm) .* (S.IE ./ dGv).^3;
disp(nc);
% It is important that the exp() term is in the middle, as the
% other factors get quite large.
J = 4 .* nc.^(2/3) .* ...
dGv.^2 .* sqrt(kB * S.T ./ S.IE.^3) .* ...
exp( -16 * pi * S.IE.^3 ./ (3 * dGv.^2 .* kB .* S.T) .* sf) ...
./ (24 * pi^2 * S.jd.^3 .* S.viscosity());
end
end
end
classdef MyegaViscosity11 < simulationModels.PhysicalSimulation
%MYEGAVISCOSITY - A simulation using the MYEGA model for the viscosity.
%
% Properties that need to be defined by subclasses:
% ninf - Viscosity for T -> inf [Pa*s]
% Tg - Reference temperature in MYEGA equation [K]
% m - Fragility [1]
%
% Methods provided:
% viscosity
properties (Abstract, SetAccess = protected)
ninf; % Viscosity for T -> inf [Pa*s]
Tg; % Reference temperature in MYEGA equation [K]
m; % Fragility [1]
end
methods
function S = MyegaViscosity11(spacing, seed)
S = S@simulationModels.PhysicalSimulation(spacing, seed);
end
function n = viscosity(S)
n = S.temperaureViscosity(S.T);
end
end
methods (Access = protected)
function n = temperaureViscosity(S, T)
n = 10.^(log10(S.ninf) + (12-log10(S.ninf)) ...
*(S.Tg./T) .* exp((S.m/(12-log10(S.ninf)) - 1) ...
*(S.Tg./T - 1)));
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment