Skip to content

Commit

Permalink
pybamm-team#1117 add total lithium variables
Browse files Browse the repository at this point in the history
  • Loading branch information
brosaplanella committed Jul 29, 2020
1 parent 58e379b commit c0256cd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,21 @@ def _get_standard_concentration_variables(self, c_e_n, c_e_s, c_e_p):
"""

c_e_typ = self.param.c_e_typ
L_x = self.param.L_x

c_e = pybamm.Concatenation(c_e_n, c_e_s, c_e_p)
c_e_av = pybamm.x_average(c_e)
c_e_n_av = pybamm.x_average(c_e_n)
c_e_s_av = pybamm.x_average(c_e_s)
c_e_p_av = pybamm.x_average(c_e_p)

eps_n = self.param.epsilon_n
eps_s = self.param.epsilon_s
eps_p = self.param.epsilon_p
eps = pybamm.Concatenation(eps_n, eps_s, eps_p)

c_e_total = pybamm.Integral(eps * c_e, pybamm.standard_spatial_vars.x)

variables = {
"Electrolyte concentration": c_e,
"Electrolyte concentration [mol.m-3]": c_e_typ * c_e,
Expand All @@ -74,6 +82,9 @@ def _get_standard_concentration_variables(self, c_e_n, c_e_s, c_e_p):
"X-averaged positive electrolyte concentration": c_e_p_av,
"X-averaged positive electrolyte concentration [mol.m-3]": c_e_typ
* c_e_p_av,
"Total lithium concentration in electrolyte [mol.m-2]": c_e_typ
* L_x
* c_e_total,
}

return variables
Expand Down
22 changes: 12 additions & 10 deletions pybamm/models/submodels/particle/base_particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@ def __init__(self, param, domain):
def _get_standard_concentration_variables(self, c_s, c_s_xav):

c_s_surf = pybamm.surf(c_s)

c_s_surf_av = pybamm.x_average(c_s_surf)
geo_param = pybamm.geometric_parameters

if self.domain == "Negative":
c_scale = self.param.c_n_max
active_volume = geo_param.a_n_dim * geo_param.R_n / 3
eps_s = self.param.epsilon_s_n
L = self.param.L_n
elif self.domain == "Positive":
c_scale = self.param.c_p_max
active_volume = geo_param.a_p_dim * geo_param.R_p / 3
c_s_av = pybamm.r_average(c_s_xav)
c_s_av_vol = active_volume * c_s_av
eps_s = self.param.epsilon_s_p
L = self.param.L_p

c_s_rav = pybamm.r_average(c_s)
c_s_vol_av = pybamm.x_average(eps_s * c_s_rav)
variables = {
self.domain + " particle concentration": c_s,
self.domain + " particle concentration [mol.m-3]": c_s * c_scale,
Expand All @@ -52,12 +53,13 @@ def _get_standard_concentration_variables(self, c_s, c_s_xav):
"X-averaged "
+ self.domain.lower()
+ " particle surface concentration [mol.m-3]": c_scale * c_s_surf_av,
self.domain + " electrode active volume fraction": active_volume,
self.domain + " electrode volume-averaged concentration": c_s_av_vol,
self.domain + " electrode active volume fraction": eps_s,
self.domain + " electrode volume-averaged concentration": c_s_vol_av,
self.domain
+ " electrode "
+ "volume-averaged concentration [mol.m-3]": c_s_av_vol * c_scale,
self.domain + " electrode average extent of lithiation": c_s_av,
+ "volume-averaged concentration [mol.m-3]": c_s_vol_av * c_scale,
self.domain + " electrode average extent of lithiation": c_s_rav,
"Total lithium concentration in " + self.domain.lower() + " electrode [mol.m-2]": c_s_vol_av * c_scale * L,
}

return variables
Expand Down

0 comments on commit c0256cd

Please sign in to comment.