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 | def auxiliaries(t, solver_variables, control_variables, i_fc, operating_inputs, parameters):
"""This function calculates the flows passing through the auxiliaries.
Parameters
----------
t : float
Time (s).
solver_variables : dict
Variables calculated by the solver. They correspond to the fuel cell internal states.
control_variables : dict
Variables controlled by the user.
i_fc : float
Fuel cell current density at time t (A.m-2).
operating_inputs : dict
Operating inputs of the fuel cell.
parameters : dict
Parameters of the fuel cell model.
Returns
-------
Jv_a_in : float
Vapor flow at the anode gas channel inlet (mol.m-2.s-1).
Jv_a_out : float
Vapor flow at the anode gas channel outlet (mol.m-2.s-1).
Jv_c_in : float
Vapor flow at the cathode gas channel inlet (mol.m-2.s-1).
Jv_c_out : float
Vapor flow at the cathode gas channel outlet (mol.m-2.s-1).
J_H2_in : float
H2 flow at the anode gas channel inlet (mol.m-2.s-1).
J_H2_out : float
H2 flow at the anode gas channel outlet (mol.m-2.s-1).
J_O2_in : float
O2 flow at the cathode gas channel inlet (mol.m-2.s-1).
J_O2_out : float
O2 flow at the cathode gas channel outlet (mol.m-2.s-1).
J_N2_in : float
N2 flow at the cathode gas channel inlet (mol.m-2.s-1).
J_N2_out : float
N2 flow at the cathode gas channel outlet (mol.m-2.s-1).
Wasm_in : float
Anode side supply manifold inlet flow (kg.s-1).
Wasm_out : float
Anode side supply manifold outlet flow (kg.s-1).
Waem_in : float
Anode side external manifold inlet flow (kg.s-1).
Waem_out : float
Anode side external manifold outlet flow (kg.s-1).
Wcsm_in : float
Cathode side supply manifold inlet flow (kg.s-1).
Wcsm_out : float
Cathode side supply manifold outlet flow (kg.s-1).
Wcem_in : float
Cathode side external manifold inlet flow (kg.s-1).
Wcem_out : float
Cathode side external manifold outlet flow (kg.s-1).
Ware : float
Anode side recirculation flow (kg.s-1).
Wv_asm_in : float
Vapor flow at the anode supply manifold inlet (mol.s-1).
Wv_aem_out : float
Vapor flow at the anode external manifold outlet (mol.s-1).
Wv_csm_in : float
Vapor flow at the cathode supply manifold inlet (mol.s-1).
Wv_cem_out : float
Vapor flow at the cathode external manifold outlet (mol.s-1).
"""
# __________________________________________________Preliminaries___________________________________________________
# Extraction of the variables
Pasm, Paem, Pcsm = solver_variables['Pasm'], solver_variables['Paem'], solver_variables['Pcsm']
Pcem, Phi_asm, Phi_aem = solver_variables['Pcem'], solver_variables['Phi_asm'], solver_variables['Phi_aem']
Phi_csm, Phi_cem = solver_variables['Phi_csm'], solver_variables['Phi_cem']
Wcp, Wa_inj, Wc_inj = solver_variables['Wcp'], solver_variables['Wa_inj'], solver_variables['Wc_inj']
# Extraction of the operating inputs and the parameters
T_des, Pa_des, Pc_des = operating_inputs['T_des'], operating_inputs['Pa_des'], operating_inputs['Pc_des']
Sa, Sc = operating_inputs['Sa'], operating_inputs['Sc']
Phi_a_des, Phi_c_des = control_variables['Phi_a_des'], control_variables['Phi_c_des']
Aact, Hgc, Wgc = parameters['Aact'], parameters['Hgc'], parameters['Wgc']
type_auxiliary = parameters['type_auxiliary']
# Intermediate values
Mext, Pagc, Pcgc, Phi_agc, Phi_cgc, y_cgc, Magc, Mcgc, Pr_aem, Pr_cem, \
Maem, Masm, Mcem, Mcsm, k_purge, Abp_a, Abp_c, i_n = \
auxiliaries_int_values(t, solver_variables, operating_inputs, parameters)
# _________________________________________Inlet and outlet global flows____________________________________________
"""Global flows here refer to flows that integrate all the chemical species circulating together.
Slight differences are to be noted in the expression of these flows depending on the type of auxiliary selected.
"""
# At the anode side
if type_auxiliary == "forced-convective_cathode_with_anodic_recirculation":
# Anode inlet
Wasm_in = Ksm_in * (Pa_des - Pasm) # kg.s-1
Wasm_out = Ksm_out * (Pasm - Pagc) # kg.s-1
Ja_in = Wasm_out / (Hgc * Wgc * Masm) # mol.m-2.s-1
# Anode outlet
Waem_in = Kem_in * (Pagc - Paem) # kg.s-1
Ware = n_cell * Maem * (Paem / (Paem - Phi_aem * Psat(T_des))) * (Sa - 1) * (i_fc + i_n) / (
2 * F) * Aact # kg.s-1
Waem_out = k_purge * C_D * A_T * Paem / (R * T_des)**0.5 * Pr_aem ** (1 / gamma_H2) * \
(Magc * 2 * gamma_H2 / (gamma_H2 - 1) * (1 - Pr_aem ** ((gamma_H2 - 1) / gamma_H2)))**0.5 # kg.s-1
Ja_out = Waem_in / (Hgc * Wgc * Magc) # mol.m-2.s-1
elif type_auxiliary == "forced-convective_cathode_with_flow-through_anode":
# Anode inlet
Wrd = n_cell * M_H2 * Sa * (i_fc + i_n) / (2 * F) * Aact # kg.s-1
Wasm_in = Wrd + Wa_inj # kg.s-1
Wasm_out = Ksm_out * (Pasm - Pagc) # kg.s-1
Ja_in = Wasm_out / (Hgc * Wgc * Masm) # mol.m-2.s-1
# Anode outlet
Waem_in = Kem_in * (Pagc - Paem) # kg.s-1
Ware = 0 # kg.s-1
Waem_out = C_D * Abp_a * Paem / (R * T_des)**0.5 * Pr_aem ** (1 / gamma_H2) * \
(Magc * 2 * gamma_H2 / (gamma_H2 - 1) * (1 - Pr_aem ** ((gamma_H2 - 1) / gamma_H2)))**0.5
# kg.s-1
Ja_out = Waem_in / (Hgc * Wgc * Magc) # mol.m-2.s-1
else: # elif type_auxiliary == "no_auxiliary" (only 1 cell):
# Anode inlet
Wasm_in, Wasm_out = 0, 0 # kg.s-1
Ja_in = (1 + Phi_a_des * Psat(T_des) / (Pagc - Phi_a_des * Psat(T_des))) * \
Sa * (i_fc + i_n) / (2 * F) * Aact / (Hgc * Wgc) # mol.m-2.s-1
# Anode outlet
Waem_in, Ware, Waem_out = 0, 0, 0 # kg.s-1
Ja_out = Kem_in * (Pagc - Pa_des) / (Hgc * Wgc * Magc) # mol.m-2.s-1
# At the cathode side
if type_auxiliary == "forced-convective_cathode_with_anodic_recirculation" or \
type_auxiliary == "forced-convective_cathode_with_flow-through_anode":
# Cathode inlet
Wcsm_in = Wcp + Wc_inj # kg.s-1
Wcsm_out = Ksm_out * (Pcsm - Pcgc) # kg.s-1
Jc_in = Wcsm_out / (Hgc * Wgc * Mcsm) # mol.m-2.s-1
# Cathode outlet
Wcem_in = Kem_in * (Pcgc - Pcem) # kg.s-1
Wcem_out = C_D * Abp_c * Pcem / (R * T_des)**0.5 * Pr_cem ** (1 / gamma) * \
(Mcgc * 2 * gamma / (gamma - 1) * (1 - Pr_cem ** ((gamma - 1) / gamma)))**0.5 # kg.s-1
Jc_out = Wcem_in / (Hgc * Wgc * Mcgc) # mol.m-2.s-1
else: # elif type_auxiliary == "no_auxiliary" (only 1 cell):
# Cathode inlet
Wcsm_in, Wcsm_out = 0, 0 # kg.s-1
Jc_in = (1 + Phi_c_des * Psat(T_des) / (Pcgc - Phi_c_des * Psat(T_des))) * \
1 / yO2_ext * Sc * (i_fc + i_n) / (4 * F) * Aact / (Hgc * Wgc) # mol.m-2.s-1
# Cathode outlet
Wcem_in, Wcem_out = 0, 0 # kg.s-1
Jc_out = Kem_in * (Pcgc - Pc_des) / (Hgc * Wgc * Mcgc) # mol.m-2.s-1
# ________________________________________Inlet and outlet specific flows___________________________________________
"""Specific flows here refer to flows that integrate only a single chemical species within the ensemble of species
circulating together. For example, only the water vapor flow within the ensemble of hydrogen and water vapor.
"""
# Vapor flows at the GC (mol.m-2.s-1)
if type_auxiliary == "forced-convective_cathode_with_anodic_recirculation" or \
type_auxiliary == "forced-convective_cathode_with_flow-through_anode":
Jv_a_in = Phi_asm * Psat(T_des) / Pasm * Ja_in
Jv_c_in = Phi_csm * Psat(T_des) / Pcsm * Jc_in
else: # elif type_auxiliary == "no_auxiliary":
Jv_a_in = Phi_a_des * Psat(T_des) / Pagc * Ja_in
Jv_c_in = Phi_c_des * Psat(T_des) / Pcgc * Jc_in
Jv_a_out = Phi_agc * Psat(T_des) / Pagc * Ja_out
Jv_c_out = Phi_cgc * Psat(T_des) / Pcgc * Jc_out
# H2 flows at the GC (mol.m-2.s-1)
if type_auxiliary == "forced-convective_cathode_with_anodic_recirculation" or \
type_auxiliary == "forced-convective_cathode_with_flow-through_anode":
J_H2_in = (1 - Phi_asm * Psat(T_des) / Pasm) * Ja_in
else: # elif type_auxiliary == "no_auxiliary":
J_H2_in = (1 - Phi_a_des * Psat(T_des) / Pagc) * Ja_in
J_H2_out = (1 - Phi_agc * Psat(T_des) / Pagc) * Ja_out
# O2 flows at the GC (mol.m-2.s-1)
if type_auxiliary == "forced-convective_cathode_with_anodic_recirculation" or \
type_auxiliary == "forced-convective_cathode_with_flow-through_anode":
J_O2_in = yO2_ext * (1 - Phi_csm * Psat(T_des) / Pcsm) * Jc_in
else: # elif type_auxiliary == "no_auxiliary":
J_O2_in = yO2_ext * (1 - Phi_c_des * Psat(T_des) / Pcgc) * Jc_in
J_O2_out = y_cgc * (1 - Phi_cgc * Psat(T_des) / Pcgc) * Jc_out
# N2 flows at the GC (mol.m-2.s-1)
if type_auxiliary == "forced-convective_cathode_with_anodic_recirculation" or \
type_auxiliary == "forced-convective_cathode_with_flow-through_anode":
J_N2_in = (1 - yO2_ext) * (1 - Phi_csm * Psat(T_des) / Pcsm) * Jc_in
else: # elif type_auxiliary == "no_auxiliary":
J_N2_in = (1 - yO2_ext) * (1 - Phi_c_des * Psat(T_des) / Pcgc) * Jc_in
J_N2_out = (1 - y_cgc) * (1 - Phi_cgc * Psat(T_des) / Pcgc) * Jc_out
# Vapor flows at the manifold (mol.s-1)
if type_auxiliary == "forced-convective_cathode_with_anodic_recirculation":
Wv_asm_in = Phi_aem * Psat(T_des) / Paem * (Ware / Maem)
Wv_aem_out = Phi_aem * Psat(T_des) / Paem * (Waem_out / Maem)
Wv_csm_in = Phi_ext * Psat(Text) / Pext * (Wcp / Mext) + Wc_inj / M_H2O
Wv_cem_out = Phi_cem * Psat(T_des) / Pcem * (Wcem_out / Mcem)
elif type_auxiliary == "forced-convective_cathode_with_flow-through_anode":
Wv_asm_in = Wa_inj / M_H2O
Wv_aem_out = Phi_aem * Psat(T_des) / Paem * (Waem_out / Maem)
Wv_csm_in = Phi_ext * Psat(Text) / Pext * (Wcp / Mext) + Wc_inj / M_H2O
Wv_cem_out = Phi_cem * Psat(T_des) / Pcem * (Wcem_out / Mcem)
else: # elif type_auxiliary == "no_auxiliary":
Wv_asm_in, Wv_aem_out, Wv_csm_in, Wv_cem_out = [0] * 4
return Jv_a_in, Jv_a_out, Jv_c_in, Jv_c_out, \
J_H2_in, J_H2_out, J_O2_in, J_O2_out, J_N2_in, J_N2_out, \
Wasm_in, Wasm_out, Waem_in, Waem_out, Wcsm_in, Wcsm_out, Wcem_in, Wcem_out, Ware, \
Wv_asm_in, Wv_aem_out, Wv_csm_in, Wv_cem_out
|