feat(zoo): add the multilayer pouch stack with a 3D temperature field per zone - #5815
BradyPlanden wants to merge 10 commits into
Conversation
The multilayer pouch stack becomes the `multilayer_3d_thermal` zoo entry, with `MultiLayer3DThermalSPM` as the registered model and the SPMe and DFN variants alongside it. Nothing under packages/pybamm changes any more: `pybamm.source`'s domain check is sidestepped by `_compat.source`, which assembles the same mass-matrix source on the per-zone domains. Fixes found while bringing it to the zoo's bar: - The SPMe's electrolyte gained lithium on discharge (1000 -> 4160 mol.m-3 in 30 minutes) from a net source term. It now resolves c_e(x) with the composite concentration overpotential and electrolyte and solid ohmic drops of pybamm's SPMe, and matches it to 0.34 mV (was 41 mV). - The DFN no longer built on main, where electrode conductivity takes the stoichiometry. It now keeps migration inside the electrolyte flux, as BasicDFN does, and computes electrolyte ohmic heat from its own fields rather than the initial concentration. - apply_stack_scaling scaled the capacity by every unit cell even in series, so a C-rate drove each cell N times too hard. - Default parameters now include the face heat transfer coefficients, so the model builds from its own defaults. The tests pin the isothermal reduction to pybamm's SPM, SPMe, and DFN, the adiabatic energy balance, heat equal to current times lost voltage, electrolyte lithium conservation, and the current handover under one-sided cooling. The legacy num_layers/layers_per_zone keywords, never released, are dropped.
b70778e to
7a940ea
Compare
…owners The manifest names the model's original author as its maintainer, so zoo.info() and the docs table point users and bug reports at them rather than at PyBaMM. Code owners need write access, which the author does not have, so the folder's CODEOWNERS line is the maintainers team, who approve pull requests to it as needed.
|
Hi @BradyPlanden thanks for putting this together. I did some more thinking and I believe that there may be a cleaner implementation which is more DRY in terms of using the existing pybamm models and not defining from scratch. I am working on some changes I will commit them soon. |
|
@BradyPlanden I opened #5840 against this branch, as I couldn't commit to this PR directly. The main difference is that each zone uses PyBaMM's own SPM, SPMe or DFN under the stack's options, so options like particle phases, hysteresis and intercalation kinetics now work in every zone. That replaces the hand-written zone equations, including your SPMe and DFN fixes, which the new zones no longer need. We achieve this with It also fixes four issues I found checking against PyBaMM's lumped model, all present since #5489:
Layer-by-layer tab resistance is ready too, but I've kept it for a separate PR once it has more evidence behind it. Happy to adjust anything to fit the zoo. |
Description
This brings the multilayer pouch model from #5489 (by mleot) into the model zoo, as the zoo's first contributed model, and resolves #5505. #5489's seven commits are rebased onto
mainwith their authorship, and one commit on top moves the models out ofpybamm.lithium_ionintopackages/pybamm-model-zoo/src/pybamm_model_zoo/multilayer_3d_thermal/. The net diff touches nothing underpackages/pybamm/.The stack's
num_physical_layersunit cells are lumped intonum_subdivisionszones through its thickness. Each zone runs an SPM, SPMe, or DFN for its unit cells in parallel and carries its own 3D temperature field on a scikit-fem mesh, whose volume average its kinetics and transport see. Adjacent zones exchange heat through a contact resistance, and the zones connect in parallel, with their current fractions solved for, or in series. A cooling plate on one face or a hot layer can then move current between layers, whichBasic3DThermalSPM's single temperature and electrochemistry cannot.Checking each variant against PyBaMM's own model, held isothermal, turned up four bugs in #5489:
SPMeSPMe, lithium conservedmain, where electrode conductivity takes the stoichiometryDFN, migration kept inside the electrolyte flux as inBasicDFNapply_stack_scalingin seriesThe SPM matched
SPMto 0.03 mV before and after.pybamm.sourcerefuses every domain but"cell"and"current collector". Add Model for Multilayer Stacked Pouch Cells with thru-stack heat generation & diffusion. #5489 widened that check in core; here_compat.sourceassembles the same mass-matrix source on the per-zone domains instead, and names the upstream change that would retire it.MultiLayer3DThermalSPMis the registered model.MultiLayer3DThermalSPMeandMultiLayer3DThermalDFNshare its folder, stacking, thermal coupling and geometry, and override only each zone's electrochemistry.num_layers/layers_per_zonekeywords are dropped, invalid arguments raisepybamm.OptionError, and"Layer i current [A]"is now the zone's current, with"Layer i per-unit-cell current [A]"beside it.model.toml, in the community tier, sozoo.info()and the docs table send users to them for support. Code owners need write access, which mleot does not have, so@pybamm-team/maintainersown the folder in CODEOWNERS and approve its pull requests as needed.The README lists what is not validated. The largest gap is the thermal conductivity: it is PyBaMM's
lambda_eff, a thickness-weighted in-plane average that includes the current collectors, applied in every direction, so conduction through the stack is overstated.Also found, for a separate core PR:
pybamm.x_average(eps * c_e)returnsx_average(eps) * x_average(c_e)whenepsis a concatenation of per-region broadcasts, becauseXAverage.symbol_is_constanttreats it as uniform. This entry sums its electrolyte lithium region by region to avoid it.Type of change
A model zoo entry, so its bullet is in
packages/pybamm-model-zoo/CHANGELOG.mdand PyBaMM's changelog is untouched.Important checks:
Please confirm the following before marking the PR as ready for review:
nox -s pre-commitnox -s testsnox -s doctests