@@ -126,14 +126,18 @@ def _get_standard_current_collector_potential_variables(self, phi_s_cn, phi_s_cp
126
126
127
127
pot_scale = self .param .potential_scale
128
128
U_ref = self .param .U_p_ref - self .param .U_n_ref
129
+ phi_s_cp_dim = U_ref + phi_s_cp * pot_scale
129
130
130
131
# Local potential difference
131
132
V_cc = phi_s_cp - phi_s_cn
132
133
133
- # terminal voltage (Note: phi_s_cn is zero at the negative tab)
134
+ # Terminal voltage
135
+ # Note phi_s_cn is always zero at the negative tab
136
+ V = pybamm .boundary_value (phi_s_cp , "positive tab" )
137
+ V_dim = pybamm .boundary_value (phi_s_cp_dim , "positive tab" )
138
+
134
139
# Voltage is local current collector potential difference at the tabs, in 1D
135
140
# this will be equal to the local current collector potential difference
136
- phi_s_cp_dim = U_ref + phi_s_cp * pot_scale
137
141
138
142
variables = {
139
143
"Negative current collector potential" : phi_s_cn ,
@@ -142,6 +146,8 @@ def _get_standard_current_collector_potential_variables(self, phi_s_cn, phi_s_cp
142
146
"Positive current collector potential [V]" : phi_s_cp_dim ,
143
147
"Local voltage" : V_cc ,
144
148
"Local voltage [V]" : U_ref + V_cc * pot_scale ,
149
+ "Terminal voltage" : V ,
150
+ "Terminal voltage [V]" : V_dim ,
145
151
}
146
152
147
153
return variables
@@ -170,18 +176,13 @@ def _get_standard_whole_cell_variables(self, variables):
170
176
i_s = pybamm .Concatenation (i_s_n , i_s_s , i_s_p )
171
177
172
178
variables .update ({"Electrode current density" : i_s })
179
+
173
180
if self .set_positive_potential :
174
- # don't overwrite current collector potentials
175
- try :
176
- phi_s_cn = variables ["Negative current collector potential" ]
177
- except KeyError :
178
- phi_s_n = variables ["Negative electrode potential" ]
179
- phi_s_cn = pybamm .boundary_value (phi_s_n , "left" )
180
- try :
181
- phi_s_cp = variables ["Positive current collector potential" ]
182
- except KeyError :
183
- phi_s_p = variables ["Positive electrode potential" ]
184
- phi_s_cp = pybamm .boundary_value (phi_s_p , "right" )
181
+ # Get phi_s_cn from the current collector submodel and phi_s_p from the
182
+ # electrode submodel
183
+ phi_s_cn = variables ["Negative current collector potential" ]
184
+ phi_s_p = variables ["Positive electrode potential" ]
185
+ phi_s_cp = pybamm .boundary_value (phi_s_p , "right" )
185
186
variables .update (
186
187
self ._get_standard_current_collector_potential_variables (
187
188
phi_s_cn , phi_s_cp
0 commit comments