-
-
Notifications
You must be signed in to change notification settings - Fork 606
/
Copy pathstandard_variables.py
309 lines (292 loc) · 9.27 KB
/
standard_variables.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
#
# Standard variables for the models
#
import pybamm
import numpy as np
# Electrolyte concentration
c_e_n = pybamm.Variable(
"Negative electrolyte concentration",
domain="negative electrode",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, np.inf),
)
c_e_s = pybamm.Variable(
"Separator electrolyte concentration",
domain="separator",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, np.inf),
)
c_e_p = pybamm.Variable(
"Positive electrolyte concentration",
domain="positive electrode",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, np.inf),
)
c_e = pybamm.concatenation(c_e_n, c_e_s, c_e_p)
c_e_av = pybamm.Variable(
"X-averaged electrolyte concentration",
domain="current collector",
bounds=(0, np.inf),
)
# Electrolyte porosity times concentration
eps_c_e_n = pybamm.Variable(
"Negative electrode porosity times concentration",
domain="negative electrode",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, np.inf),
)
eps_c_e_s = pybamm.Variable(
"Separator porosity times concentration",
domain="separator",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, np.inf),
)
eps_c_e_p = pybamm.Variable(
"Positive electrode porosity times concentration",
domain="positive electrode",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, np.inf),
)
eps_c_e = pybamm.concatenation(eps_c_e_n, eps_c_e_s, eps_c_e_p)
eps_c_e_av = pybamm.Variable(
"X-averaged porosity times concentration",
domain="current collector",
bounds=(0, np.inf),
)
# Electrolyte potential
phi_e_n = pybamm.Variable(
"Negative electrolyte potential",
domain="negative electrode",
auxiliary_domains={"secondary": "current collector"},
)
phi_e_s = pybamm.Variable(
"Separator electrolyte potential",
domain="separator",
auxiliary_domains={"secondary": "current collector"},
)
phi_e_p = pybamm.Variable(
"Positive electrolyte potential",
domain="positive electrode",
auxiliary_domains={"secondary": "current collector"},
)
phi_e = pybamm.concatenation(phi_e_n, phi_e_s, phi_e_p)
# Electrode potential
phi_s_n = pybamm.Variable(
"Negative electrode potential",
domain="negative electrode",
auxiliary_domains={"secondary": "current collector"},
)
phi_s_p = pybamm.Variable(
"Positive electrode potential",
domain="positive electrode",
auxiliary_domains={"secondary": "current collector"},
)
# Potential difference
delta_phi_n = pybamm.Variable(
"Negative electrode surface potential difference",
domain="negative electrode",
auxiliary_domains={"secondary": "current collector"},
)
delta_phi_p = pybamm.Variable(
"Positive electrode surface potential difference",
domain="positive electrode",
auxiliary_domains={"secondary": "current collector"},
)
delta_phi_n_av = pybamm.Variable(
"X-averaged negative electrode surface potential difference",
domain="current collector",
)
delta_phi_p_av = pybamm.Variable(
"X-averaged positive electrode surface potential difference",
domain="current collector",
)
# current collector variables
phi_s_cn = pybamm.Variable(
"Negative current collector potential", domain="current collector"
)
phi_s_cp = pybamm.Variable(
"Positive current collector potential", domain="current collector"
)
i_boundary_cc = pybamm.Variable(
"Current collector current density", domain="current collector"
)
phi_s_cn_composite = pybamm.Variable(
"Composite negative current collector potential", domain="current collector"
)
phi_s_cp_composite = pybamm.Variable(
"Composite positive current collector potential", domain="current collector"
)
i_boundary_cc_composite = pybamm.Variable(
"Composite current collector current density", domain="current collector"
)
# Particle concentration
c_s_n = pybamm.Variable(
"Negative particle concentration",
domain="negative particle",
auxiliary_domains={
"secondary": "negative electrode",
"tertiary": "current collector",
},
bounds=(0, 1),
)
c_s_p = pybamm.Variable(
"Positive particle concentration",
domain="positive particle",
auxiliary_domains={
"secondary": "positive electrode",
"tertiary": "current collector",
},
bounds=(0, 1),
)
c_s_n_xav = pybamm.Variable(
"X-averaged negative particle concentration",
domain="negative particle",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, 1),
)
c_s_p_xav = pybamm.Variable(
"X-averaged positive particle concentration",
domain="positive particle",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, 1),
)
c_s_n_rav = pybamm.Variable(
"R-averaged negative particle concentration",
domain="negative electrode",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, 1),
)
c_s_p_rav = pybamm.Variable(
"R-averaged positive particle concentration",
domain="positive electrode",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, 1),
)
c_s_n_rxav = pybamm.Variable(
"R-X-averaged negative particle concentration",
domain="current collector",
bounds=(0, 1),
)
c_s_p_rxav = pybamm.Variable(
"R-X-averaged positive particle concentration",
domain="current collector",
bounds=(0, 1),
)
c_s_n_surf = pybamm.Variable(
"Negative particle surface concentration",
domain="negative electrode",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, 1),
)
c_s_p_surf = pybamm.Variable(
"Positive particle surface concentration",
domain="positive electrode",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, 1),
)
c_s_n_surf_xav = pybamm.Variable(
"X-averaged negative particle surface concentration",
domain="current collector",
bounds=(0, 1),
)
c_s_p_surf_xav = pybamm.Variable(
"X-averaged positive particle surface concentration",
domain="current collector",
bounds=(0, 1),
)
# Average particle concentration gradient (for polynomial particle concentration
# models). Note: we make the distinction here between the flux defined as
# N = -D*dc/dr and the concentration gradient q = dc/dr
q_s_n_rav = pybamm.Variable(
"R-averaged negative particle concentration gradient",
domain="negative electrode",
auxiliary_domains={"secondary": "current collector"},
)
q_s_p_rav = pybamm.Variable(
"R-averaged positive particle concentration gradient",
domain="positive electrode",
auxiliary_domains={"secondary": "current collector"},
)
q_s_n_rxav = pybamm.Variable(
"R-X-averaged negative particle concentration gradient", domain="current collector"
)
q_s_p_rxav = pybamm.Variable(
"R-X-averaged positive particle concentration gradient", domain="current collector"
)
# Porosity
eps_n = pybamm.Variable(
"Negative electrode porosity",
domain="negative electrode",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, 1),
)
eps_s = pybamm.Variable(
"Separator porosity",
domain="separator",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, 1),
)
eps_p = pybamm.Variable(
"Positive electrode porosity",
domain="positive electrode",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, 1),
)
eps = pybamm.concatenation(eps_n, eps_s, eps_p)
# Piecewise constant (for asymptotic models)
eps_n_pc = pybamm.Variable(
"X-averaged negative electrode porosity", domain="current collector", bounds=(0, 1)
)
eps_s_pc = pybamm.Variable(
"X-averaged separator porosity", domain="current collector", bounds=(0, 1)
)
eps_p_pc = pybamm.Variable(
"X-averaged positive electrode porosity", domain="current collector", bounds=(0, 1)
)
eps_piecewise_constant = pybamm.concatenation(
pybamm.PrimaryBroadcast(eps_n_pc, "negative electrode"),
pybamm.PrimaryBroadcast(eps_s_pc, "separator"),
pybamm.PrimaryBroadcast(eps_p_pc, "positive electrode"),
)
# Temperature
T_cn = pybamm.Variable(
"Negative currents collector temperature", domain="current collector"
)
T_n = pybamm.Variable(
"Negative electrode temperature",
domain="negative electrode",
auxiliary_domains={"secondary": "current collector"},
)
T_s = pybamm.Variable(
"Separator temperature",
domain="separator",
auxiliary_domains={"secondary": "current collector"},
)
T_p = pybamm.Variable(
"Positive electrode temperature",
domain="positive electrode",
auxiliary_domains={"secondary": "current collector"},
)
T_cp = pybamm.Variable(
"Positive currents collector temperature", domain="current collector"
)
T = pybamm.concatenation(T_n, T_s, T_p)
T_av = pybamm.Variable("X-averaged cell temperature", domain="current collector")
T_vol_av = pybamm.Variable("Volume-averaged cell temperature")
# SEI variables
L_inner_av = pybamm.Variable(
"X-averaged inner negative electrode SEI thickness", domain="current collector"
)
L_inner = pybamm.Variable(
"Inner negative electrode SEI thickness",
domain=["negative electrode"],
auxiliary_domains={"secondary": "current collector"},
)
L_outer_av = pybamm.Variable(
"X-averaged outer negative electrode SEI thickness", domain="current collector"
)
L_outer = pybamm.Variable(
"Outer negative electrode SEI thickness",
domain=["negative electrode"],
auxiliary_domains={"secondary": "current collector"},
)