@@ -40,24 +40,23 @@ def _get_standard_potential_variables(self, phi_s):
40
40
electrode.
41
41
"""
42
42
param = self .param
43
+ pot = param .potential_scale
43
44
phi_s_av = pybamm .x_average (phi_s )
44
45
45
46
if self .domain == "Negative" :
46
- phi_s_dim = param . potential_scale * phi_s
47
- phi_s_av_dim = param . potential_scale * phi_s_av
47
+ phi_s_dim = pot * phi_s
48
+ phi_s_av_dim = pot * phi_s_av
48
49
delta_phi_s = phi_s
49
50
50
51
elif self .domain == "Positive" :
51
- phi_s_dim = param .U_p_ref - param .U_n_ref + param .potential_scale * phi_s
52
- phi_s_av_dim = (
53
- param .U_p_ref - param .U_n_ref + param .potential_scale * phi_s_av
54
- )
52
+ phi_s_dim = param .U_p_ref - param .U_n_ref + pot * phi_s
53
+ phi_s_av_dim = param .U_p_ref - param .U_n_ref + pot * phi_s_av
55
54
56
55
v = pybamm .boundary_value (phi_s , "right" )
57
56
delta_phi_s = phi_s - pybamm .PrimaryBroadcast (v , ["positive electrode" ])
58
57
delta_phi_s_av = pybamm .x_average (delta_phi_s )
59
- delta_phi_s_dim = delta_phi_s * param . potential_scale
60
- delta_phi_s_av_dim = delta_phi_s_av * param . potential_scale
58
+ delta_phi_s_dim = delta_phi_s * pot
59
+ delta_phi_s_av_dim = delta_phi_s_av * pot
61
60
62
61
variables = {
63
62
self .domain + " electrode potential" : phi_s ,
@@ -108,6 +107,41 @@ def _get_standard_current_variables(self, i_s):
108
107
109
108
return variables
110
109
110
+ def _get_standard_current_collector_potential_variables (self , phi_s_cn , phi_s_cp ):
111
+ """
112
+ A private function to obtain the standard variables which
113
+ can be derived from the potentials in the current collector.
114
+
115
+ Parameters
116
+ ----------
117
+ phi_cc : :class:`pybamm.Symbol`
118
+ The potential in the current collector.
119
+
120
+ Returns
121
+ -------
122
+ variables : dict
123
+ The variables which can be derived from the potential in the
124
+ current collector.
125
+ """
126
+
127
+ pot_scale = self .param .potential_scale
128
+ U_ref = self .param .U_p_ref - self .param .U_n_ref
129
+
130
+ # Local potential difference
131
+ V_cc = phi_s_cp - phi_s_cn
132
+
133
+ variables = {
134
+ "Negative current collector potential" : phi_s_cn ,
135
+ "Negative current collector potential [V]" : phi_s_cn * pot_scale ,
136
+ "Positive current collector potential" : phi_s_cp ,
137
+ "Positive current collector potential [V]" : U_ref + phi_s_cp * pot_scale ,
138
+ "Local current collector potential difference" : V_cc ,
139
+ "Local current collector potential difference [V]" : U_ref
140
+ + V_cc * pot_scale ,
141
+ }
142
+
143
+ return variables
144
+
111
145
def _get_standard_whole_cell_variables (self , variables ):
112
146
"""
113
147
A private function to obtain the whole-cell versions of the
@@ -131,14 +165,23 @@ def _get_standard_whole_cell_variables(self, variables):
131
165
132
166
i_s = pybamm .Concatenation (i_s_n , i_s_s , i_s_p )
133
167
168
+ variables .update ({"Electrode current density" : i_s })
134
169
if self .set_positive_potential :
135
- phi_s_p = variables ["Positive electrode potential" ]
136
- phi_s_cp = pybamm .boundary_value (phi_s_p , "right" )
137
- variables = {
138
- "Electrode current density" : i_s ,
139
- "Positive current collector potential" : phi_s_cp ,
140
- }
141
- else :
142
- variables = {"Electrode current density" : i_s }
143
-
170
+ # don't overwrite current collector potentials
171
+ try :
172
+ phi_s_cn = variables ["Negative current collector potential" ]
173
+ except KeyError :
174
+ phi_s_n = variables ["Negative electrode potential" ]
175
+ phi_s_cn = pybamm .boundary_value (phi_s_n , "left" )
176
+ try :
177
+ phi_s_cp = variables ["Positive current collector potential" ]
178
+ except KeyError :
179
+ phi_s_p = variables ["Positive electrode potential" ]
180
+ phi_s_cp = pybamm .boundary_value (phi_s_p , "right" )
181
+ variables .update (
182
+ self ._get_standard_current_collector_potential_variables (
183
+ phi_s_cn , phi_s_cp
184
+ )
185
+ )
144
186
return variables
187
+
0 commit comments