Skip to content

Commit

Permalink
Merge pull request #1548 from pybamm-team/issue-1547-esoh-pouch-cell
Browse files Browse the repository at this point in the history
#1547 fix esoh model in pouch cell
  • Loading branch information
valentinsulzer authored Jul 15, 2021
2 parents 90a4cf6 + c42c309 commit f83f0a2
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

## Bug fixes

- Fixed ElectrodeSOH model for multi-dimensional simulations ([#1548](https://github.com/pybamm-team/PyBaMM/pull/1548))
- Removed the overly-restrictive check "each variable in the algebraic eqn keys must appear in the eqn" ([#1510](https://github.com/pybamm-team/PyBaMM/pull/1510))
- Made parameters importable through pybamm ([#1475](https://github.com/pybamm-team/PyBaMM/pull/1475))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ def _get_standard_active_material_variables(self, eps_solid):
L = param.L_p
c_s_max = param.c_p_max

C = eps_solid_av * L * param.A_cc * c_s_max * param.F / 3600
C = (
pybamm.yz_average(eps_solid_av)
* L
* param.A_cc
* c_s_max
* param.F
/ 3600
)
variables.update({self.domain + " electrode capacity [A.h]": C})

if self.domain == "Negative":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def _get_total_concentration_electrolyte(self, c_e, epsilon):
L_x = self.param.L_x
A = self.param.A_cc

c_e_av = pybamm.x_average(epsilon * c_e)
c_e_av = pybamm.yz_average(pybamm.x_average(epsilon * c_e))

variables = {"Total lithium in electrolyte [mol]": c_e_typ * L_x * A * c_e_av}

Expand Down
5 changes: 4 additions & 1 deletion pybamm/models/submodels/particle/base_particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ def _get_total_concentration_variables(self, variables):
+ "volume-averaged concentration [mol.m-3]": c_s_vol_av * c_scale,
"Total lithium in "
+ self.domain.lower()
+ " electrode [mol]": c_s_vol_av * eps_s_av * c_scale * L * A,
+ " electrode [mol]": pybamm.yz_average(c_s_vol_av * eps_s_av)
* c_scale
* L
* A,
}
)
return variables
Expand Down
29 changes: 18 additions & 11 deletions pybamm/solvers/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,17 +733,24 @@ def get_cycle_summary_variables(cycle_solution, esoh_sim):
esoh_sim.built_model.set_initial_conditions_from(
{"x_100": x_100_init, "C": C_init}
)
esoh_sol = esoh_sim.solve(
[0],
inputs={
"V_min": V_min,
"V_max": V_max,
"C_n": C_n,
"C_p": C_p,
"n_Li": n_Li,
},
solver=solver,
)

try:
esoh_sol = esoh_sim.solve(
[0],
inputs={
"V_min": V_min,
"V_max": V_max,
"C_n": C_n,
"C_p": C_p,
"n_Li": n_Li,
},
solver=solver,
)
except pybamm.SolverError: # pragma: no cover
raise pybamm.SolverError(
"Could not solve for summary variables, run "
"`sim.solve(calc_esoh=False)` to skip this step"
)
for var in esoh_sim.built_model.variables:
cycle_summary_variables[var] = esoh_sol[var].data[0]

Expand Down

0 comments on commit f83f0a2

Please sign in to comment.