-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparameterized_system_properties.m
101 lines (93 loc) · 3.08 KB
/
parameterized_system_properties.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
classdef parameterized_system_properties < system_properties
properties
%% Solubility definition
% Polynomial to calculate solubility in kg/kg. The first element is
% the coefficient of zero-order temperature term.
solubilityPoly = [4.564e-3; 3.032e-5; 8.437e-6];
%% Kinetics definition
% Primary nucleation
pnKp = 1e8
pnP = 2
pnKe = 0
pnEa = 0
% Secondary nucleation
snKb = 1e10
snB = 2
snJ = 2/3
snEa = 0
% Growth (of each axis)
% Each element should be of the same size
gKg = 0.1
gG = 1
gBeta = 0
gEa = 0
% Dissolution (of each axis)
dKd = 2.2
dD = 1
dBeta = 0
dEa = 0
end
methods
function obj = set.gBeta(obj, x)
if obj.sizeGrids.highBound * x + 1 <= 0
error('Invalid gBeta: potential flipped growth rate.')
end
obj.gBeta = x;
end
function obj = set.dBeta(obj, x)
if obj.sizeGrids.highBound * x + 1 <= 0
error('Invalid dBeta: potential flipped dissolution rate.')
end
obj.dBeta = x;
end
end
methods
function obj = parameterized_system_properties()
obj.sizeGrids = size_grid(999, 999);
end
end
methods
function [GD, Bp, Bs] = kinetics(obj, svar)
R = 8.3145;
sigma = svar.sigma;
vf = svar.vf;
tC = svar.tC;
tK = tC + 273.15;
if sigma > 0
if obj.gBeta == 0
% size-independent growth
GD = obj.gKg * sigma .^ obj.gG ...
* exp(-obj.gEa / R / tK);
else
% size-dependent growth
GD = obj.gKg * sigma .^ obj.gG ...
* (1 + obj.gBeta * svar.lGrids) ...
* exp(-obj.gEa / R / tK);
end
Bp = obj.pnKp * sigma .^ obj.pnP ...
* exp(-obj.pnKe / R / log(sigma + 1)^2 ) ...
* exp(-obj.pnEa / R / tK);
Bs = obj.snKb * sigma ^ obj.snB * vf ^ obj.snJ * exp(-obj.snEa / R / tK);
else
% sigma < 0
if obj.dBeta == 0
% size-independent dissolution
GD = obj.dKd * sigma .^ obj.dD ...
* exp(-obj.dEa / R / tK);
else
% size-dependent dissolution
GD = obj.dKd * sigma .^ obj.dD ...
* (1 + obj.dBeta * svar.lGrids) ...
* exp(-obj.dEa / R / tK);
end
Bp = 0;
Bs = 0;
end
end
function cStar = solubility(obj, T)
poly = obj.solubilityPoly;
Ts = (ones(size(poly)) * T) .^ ((0:numel(poly)-1)');
cStar = sum(Ts .* poly);
end
end
end