Skip to content
/ DiffLiB Public

High-fidelity differentiable modeling of lithium-ion batteries and efficient gradient-based inverse analysis

License

Notifications You must be signed in to change notification settings

xwpken/DiffLiB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DiffLiB

Github Star Github Fork License

A differentiable simulation framework for solving forward and inverse problems of 🔋 lithium-ion batteries 🔋, with the backend support of the modern scientific computing framework JAX and the differentiable finite element analysis library JAX-FEM.

Features

🔆 High-fidelity modeling: Modeling with real battery geometries

🔆 Automatic computation of Jacobian: Ready to incoprate multi-physics coupling mechanisms

🔆 End-to-end differentiability: Automatic computation of parameter sensitivities

Installation

First intsall JAX (see JAX installation guide), then follow the JAX-FEM instructions to install JAX-FEM, which will create a new conda environment. Activate the environment and clone the repository:

git clone https://github.com/xwpken/DiffLiB.git
cd DiffLiB

then install the package locally:

pip install -e .

Examples

Forward predictions

Change to the cloned directory and run

python -m examples.forward.main

Variation of the terminal voltage during the constant-discharge.(Solid lines: DiffLiB; markers: PyBaMM)

Gradient computations

Change to the cloned directory and run

python -m examples.gradient.main

Taylor test results for the validation of gradient computations.

Validation with the finite difference method

grad_ad.shape = (8,)
grad_fd.shape = ()
grad_ad can give the gradient all at once, but grad_fd can only give one value!
Let's compare the value by both methods:
grad_ad[0] = -3.883050e+00
grad_fd = -3.883050e+00
Relative error = 0.000013%

Others

📣 Coming soon!

License

This project is licensed under the GNU General Public License v3 - see the LICENSE for details.

Citations

If you found this library useful, we appreciate your support if you consider citing the following paper:

@article{xu2025difflib,
  title={DiffLiB: High-fidelity differentiable modeling of lithium-ion batteries and efficient gradient-based parameter identification},
  author={Xu, Weipeng and Yang, Kaiqi and Zhang, Yuzhi and Sun, Shichao and Mao, Sheng and Xue, Tianju},
  journal={arXiv preprint arXiv:2504.20674},
  year={2025}
}

About

High-fidelity differentiable modeling of lithium-ion batteries and efficient gradient-based inverse analysis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages