-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_parameters.py
389 lines (319 loc) · 13.3 KB
/
make_parameters.py
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
class Parameters(object):
def __init__(self, C_rate=1, name="mypouch"):
"""
The parameters for the simulation.
Parameters
----------
C_rate : float
The C-rate for the discharge.
name : string
The name of the dimensional paramters to load.
"""
# Put C-rate in Parameters object
self.C_rate = C_rate
# Put name in parameters object
self.name = name
# Load up dimensional parameters
if self.name == "mypouch" or "mypouch_B":
# Geometry
self.L_cn_star = 10.0 * 1e-6
self.L_n_star = 100.0 * 1e-6
self.L_s_star = 25.0 * 1e-6
self.L_p_star = 100.0 * 1e-6
self.L_cp_star = 10 * 1e-6
if self.name == "mypouch":
self.L_tab_n_star = 48 * 1e-3
self.L_tab_p_star = 48 * 1e-3
self.tab_offset_star = 10 * 1e-3
self.tab_n_location = "t" # Location of negative tab (t, b, l, r)
self.tab_p_location = "t" # Location of negative tab (t, b, l, r)
elif self.name == "mypouch_B":
self.L_tab_n_star = 48 * 1e-3
self.L_tab_p_star = 48 * 1e-3
self.tab_offset_star = 66 * 1e-3
self.tab_n_location = "t" # Location of negative tab (t, b, l, r)
self.tab_p_location = "b" # Location of negative tab (t, b, l, r)
self.A_tab_n_star = self.L_cn_star * self.L_tab_n_star
self.A_tab_p_star = self.L_cp_star * self.L_tab_n_star
self.Lx_star = self.L_n_star + self.L_s_star + self.L_p_star
self.Ly_star = 180 * 1e-3
self.Lz_star = 220 * 1e-3
self.L_star = self.L_cn_star + self.Lx_star + self.L_cp_star
# Porosity
# self.epsilon_n = 0.485
# self.epsilon_s = 0.724
# self.epsilon_p = 0.385
# self.brug = 4
# Porosity
self.epsilon_n = 0.3
self.epsilon_s = 1.0
self.epsilon_p = 0.3
self.brug = 1.5
# Filler fractions
self.epsilon_f_n = 0.0326
self.epsilon_f_p = 0.025
# Cutoff voltage
self.V_min = 2.5
# Cutover voltage
self.V_max = 4.3
# Applied current density
self.I_app_1C = 1.0
self.I_star = self.C_rate * self.I_app_1C / self.Lz_star ** 2
# Electrical conductivity
self.sigma_cn_star = 1 * 1e7
self.sigma_n_star = 100
self.sigma_p_star = 100
self.sigma_cp_star = 0.5 * 1e7
# Diffusivity
self.D_n_tilde_star = 3.9 * 1e-14
self.D_p_tilde_star = 1 * 1e-14
self.D_e_typ_star = 5.34 * 1e-10
# Particle
self.c_n_max_star = 24983
self.c_p_max_star = 51218
self.R_n_star = 10 * 1e-6
self.R_p_star = 10 * 1e-6
self.a_n_star = 0.18 * 1e6
self.a_p_star = 0.15 * 1e6
# Electrochemistry
self.m_n_star = 2 * 1e-5
self.m_p_star = 6 * 1e-7
self.F_star = 96487
self.t_plus = 0.4
self.Rg_star = 8.314
# Density
self.rho_cn_star = 8954
self.rho_n_star = 1657
self.rho_s_star = 397
self.rho_p_star = 3262
self.rho_cp_star = 2707
# Specific heat
self.cp_cn_star = 385
self.cp_n_star = 700
self.cp_s_star = 700
self.cp_p_star = 700
self.cp_cp_star = 897
# Thermal conductivity
self.lambda_cn_star = 401
self.lambda_n_star = 1.7
self.lambda_s_star = 0.16
self.lambda_p_star = 2.1
self.lambda_cp_star = 237
# Thermal
self.T_inf_star = 298.15
self.h_star = 1
self.h_tab_star = self.h_star
# Typical voltage drop
self.Phi_star = 1
# Typical temperature difference
self.Delta_T_star = self.I_star * self.Phi_star / self.h_star
# Initial conditions
self.c_e_typ_star = 1e3
self.c_n_0_star = 19986
self.c_p_0_star = 40974
self.T_0_star = self.T_inf_star
else:
raise ValueError("Paramters set name not recognised!")
# Effective material properties
self.rho_eff_star = (
self.rho_cn_star * self.cp_cn_star * self.L_cn_star
+ self.rho_n_star * self.cp_n_star * self.L_n_star
+ self.rho_s_star * self.cp_s_star * self.L_s_star
+ self.rho_p_star * self.cp_p_star * self.L_p_star
+ self.rho_cp_star * self.cp_cp_star * self.L_cp_star
) / self.L_star
self.lambda_eff_star = (
self.lambda_cn_star * self.L_cn_star
+ self.lambda_n_star * self.L_n_star
+ self.lambda_s_star * self.L_s_star
+ self.lambda_p_star * self.L_p_star
+ self.lambda_cp_star * self.L_cp_star
) / self.L_star
# Calculate timescales
self.tau_d_star = self.F_star * self.c_n_max_star * self.L_star / self.I_star
self.tau_n_star = self.R_n_star ** 2 / self.D_n_tilde_star
self.tau_p_star = self.R_p_star ** 2 / self.D_p_tilde_star
self.tau_e_star = self.L_star ** 2 / self.D_e_typ_star
self.tau_rn_star = (
self.F_star / self.m_n_star / self.a_n_star / self.c_e_typ_star ** 0.5
)
self.tau_rp_star = (
self.F_star / self.m_p_star / self.a_p_star / self.c_e_typ_star ** 0.5
)
self.tau_th_star = self.rho_eff_star * self.Lz_star ** 2 / self.lambda_eff_star
# Calculate dimensionless parameters
self.L_cn = self.L_cn_star / self.Lx_star
self.L_n = self.L_n_star / self.Lx_star
self.L_s = self.L_s_star / self.Lx_star
self.L_p = self.L_p_star / self.Lx_star
self.L_cp = self.L_cp_star / self.Lx_star
self.L = self.L_cn + self.L_n + self.L_s + self.L_p + self.L_cp
self.Ly = self.Ly_star / self.Lz_star
self.tab_offset = self.tab_offset_star / self.Lz_star
self.L_tab_n = self.L_tab_n_star / self.Lz_star
self.A_tab_n = self.A_tab_n_star / self.Lx_star / self.Lz_star
self.tab_n_centre = self.tab_offset + self.L_tab_n / 2
self.L_tab_p = self.L_tab_p_star / self.Lz_star
self.A_tab_p = self.A_tab_p_star / self.Lx_star / self.Lz_star
self.tab_p_centre = self.Ly - self.tab_offset - self.L_tab_p / 2
self.gamma_n = self.tau_d_star / self.tau_n_star
self.gamma_p = self.tau_d_star / self.tau_p_star
self.m_n = self.tau_d_star / self.tau_rn_star
self.m_p = self.tau_d_star / self.tau_rp_star
self.sigma_cn = self.sigma_cn_star * self.Phi_star / self.I_star / self.Lx_star
self.sigma_n = self.sigma_n_star * self.Phi_star / self.I_star / self.Lx_star
self.sigma_p = self.sigma_p_star * self.Phi_star / self.I_star / self.Lx_star
self.sigma_cp = self.sigma_cp_star * self.Phi_star / self.I_star / self.Lx_star
self.beta_n = self.a_n_star * self.R_n_star
self.beta_p = self.a_p_star * self.R_p_star
self.C_hat_n = self.c_n_max_star / self.c_n_max_star
self.C_hat_p = self.c_p_max_star / self.c_n_max_star
self.rho_cn = self.rho_cn_star * self.cp_cn_star / self.rho_eff_star
self.rho_n = self.rho_n_star * self.cp_n_star / self.rho_eff_star
self.rho_s = self.rho_s_star * self.cp_s_star / self.rho_eff_star
self.rho_p = self.rho_p_star * self.cp_p_star / self.rho_eff_star
self.rho_cp = self.rho_cp_star * self.cp_cp_star / self.rho_eff_star
self.lambda_cn = self.lambda_cn_star / self.lambda_eff_star
self.lambda_n = self.lambda_n_star / self.lambda_eff_star
self.lambda_s = self.lambda_s_star / self.lambda_eff_star
self.lambda_p = self.lambda_p_star / self.lambda_eff_star
self.lambda_cp = self.lambda_cp_star / self.lambda_eff_star
self.epsilon = self.Lx_star / self.Lz_star
self.delta = self.tau_e_star / self.tau_d_star
self.Lambda = self.F_star * self.Phi_star / self.Rg_star / self.T_inf_star
self.nu = self.c_n_max_star / self.c_e_typ_star
self.Theta = self.Delta_T_star / self.T_inf_star
self.B = (
self.I_star
* self.Phi_star
* self.tau_th_star
/ self.rho_eff_star
/ self.Delta_T_star
/ self.Lx_star
)
self.gamma_th = self.tau_d_star / self.tau_th_star
self.h = self.h_star * self.Lx_star / self.lambda_eff_star
self.h_tab = self.h_tab_star * self.Lx_star / self.lambda_eff_star
self.c_n_0 = self.c_n_0_star / self.c_n_max_star
self.c_p_0 = self.c_p_0_star / self.c_p_max_star
self.T_0 = (self.T_0_star - self.T_inf_star) / self.Delta_T_star
# Scaled parameters
self.sigma_cn_prime = self.sigma_cn * self.epsilon ** 2
self.sigma_n_prime = self.sigma_n * self.delta
self.sigma_p_prime = self.sigma_p * self.delta
self.sigma_cp_prime = self.sigma_cp * self.epsilon ** 2
self.sigma_cn_dblprime = self.sigma_cn_prime * self.delta
self.sigma_cp_dblprime = self.sigma_cp_prime * self.delta
self.alpha = 1 / (self.sigma_cn_prime * self.L_cn) + 1 / (
self.sigma_cp_prime * self.L_cp
)
self.alpha_prime = 1 / (self.sigma_cn_dblprime * self.L_cn) + 1 / (
self.sigma_cp_dblprime * self.L_cp
)
self.h_prime = self.h / (self.epsilon ** 2)
self.h_tab_prime = self.h_tab / (self.epsilon ** 2)
# x-averaged values for density and thermal conductivity
# note lambda is renamed to lambda_x in code
self.rho = (
self.rho_cn * self.L_cn
+ self.rho_n * self.L_n
+ self.rho_s * self.L_s
+ self.rho_p * self.L_p
+ self.rho_cp * self.L_cp
) / self.L
self.lambda_x = (
self.lambda_cn * self.L_cn
+ self.lambda_n * self.L_n
+ self.lambda_s * self.L_s
+ self.lambda_p * self.L_p
+ self.lambda_cp * self.L_cp
) / self.L
def solid_diffusivity_n(self, c):
"""
Calculates the solid diffusivity in the negative electrode particle as
a function of concentration.
Parameters
----------
c: array_like
Array of concentration in each volume.
Returns
-------
array_like
The the value of the diffusivity at each given concentration.
"""
return 1
def solid_diffusivity_p(self, c):
"""
Calculates the solid diffusivity in the positive electrode particle as
a function of concentration.
Parameters
----------
c: array_like
Array of concentration in each volume.
Returns
-------
array_like
The the value of the diffusivity at each given concentration.
"""
return 1
def electrolyte_diffusivity(self, c):
"""
Calculates the electrolyte diffusivity as a function of concentration.
Parameters
----------
c: array_like
Array of concentration in each volume.
Returns
-------
array_like
The the value of the diffusivity at each given concentration.
"""
if self.name == "mypouch":
# From LIONSIMBA at ambient temperature
# Make c dimensional
c = c * self.c_e_typ_star
exponent = (
-4.43 - (54 / (self.T_inf_star - 229 - 5 * 1e-3 * c)) - 0.22 * 1e-3 * c
)
D_e = 1e-4 * 10 ** exponent
# Make D_e dimensionless
D_e = D_e / self.D_e_typ_star # Make dimensionless
else:
raise ValueError("Paramters set name not recognised!")
return D_e
def electrolyte_conductivity(self, c):
"""
Calculates the electrolyte conductivity as a function of concentration.
Parameters
----------
c: array_like
Array of concentration in each volume.
Returns
-------
array_like
The the value of the conductivity at each given concentration.
"""
if self.name == "mypouch":
# From LIONSIMBA at ambient temperature
# Make c dimensional
c = c * self.c_e_typ_star
temp = (
-10.5
+ 0.668 * 1e-3 * c
+ 0.494 * 1e-6 * c ** 2
+ (0.074 - 1.78 * 1e-5 * c - 8.86 * 1e-10 * c ** 2) * self.T_inf_star
+ (-6.96 * 1e-5 + 2.8 * 1e-8 * c) * self.T_inf_star ** 2
)
kappa_e = 1e-4 * c * temp ** 2
# Make kappa_e dimensionless
kappa_e = (
kappa_e
* self.Rg_star
* self.T_inf_star
/ self.F_star ** 2
/ self.D_e_typ_star
/ self.c_e_typ_star
)
else:
raise ValueError("Paramters set name not recognised!")
return kappa_e