Logo

Battery Simulator Web - DFN

☕ Buy me a coffee

Doyle-Fuller-Newman (DFN) Model Simulator

A fast, interactive web application exploring lithium-ion battery dynamics through the lens of electrochemical engineering.

Launch Simulator

Latest Updates & Feature Releases

Major Feature

1. Individual Degradation Mode Analysis (Degradation Analysis)

Simulate and compare how specific degradation mechanisms alter battery performance and dQ/dV curves relative to baseline initial parameters across 3 stages:

  • LLI (Loss of Lithium Inventory): 0%, 5%, and 10% cyclable lithium loss (simulating SEI growth and lithium trapping) while preserving active host volume.
  • LAM_NE (Loss of Anode Active Material): 0%, 5%, and 10% reduction in negative electrode host sites while strictly preserving total cyclable lithium moles.
  • LAM_PE (Loss of Cathode Active Material): 0%, 5%, and 10% reduction in positive electrode host sites while strictly preserving total cyclable lithium moles.
  • Porosity_NE & Porosity_PE: 0%, 20%, and 50% pore volume fraction reduction in Anode or Cathode, evaluating liquid-phase transport tortuosity without altering active material volume.
  • Kinetics_NE & Kinetics_PE: 0%, 20%, and 50% reduction in reference exchange current density (j0,ref), capturing interfacial passivation, CEI/SEI film resistance, and charge-transfer hindrance.
Physics & Numerics

2. Next-Gen Differential Capacity (dQ/dV) Analysis Engine

  • Voltage Inversion & Rebound Singularity Guard: Completely eliminated unnatural peak top truncations, artificial splits, and high-voltage curve discontinuities at high C-rates (5C, 10C) caused by non-equilibrium kinetic overpotentials.
  • Adaptive Savitzky-Golay Quadratic Smoothing: Produces smooth, continuous, and physically realistic phase-transition peak shapes matching experimental battery characterization.
Performance & Stability

3. Zero-Heap Allocation & Browser Crash Prevention

  • Zero-Allocation Newton Solver: Reusable scratch buffers pre-allocated in PrecomputedGrid with in-place LU decomposition (solveLUInPlace) and double-buffered state vectors eliminate over 800,000 array allocations per simulation run.
  • 30-Run Continuous Stress Test Verified: Rigorously verified across 30 consecutive full DFN simulations with stable ~7.9 MB heap usage (+1.39 MB net growth) and zero memory leakage.
  • Worker Lifecycle Management & DOM Optimization: Spatial profile snapshots are decanted to every 15 steps (80% transferable memory reduction), SVG path vertices are downsampled to 160 points, and web workers are fully terminated between tasks with GC recovery windows.

Technical Overview: Doyle-Fuller-Newman (DFN) vs. SPM / SPMe

The Doyle-Fuller-Newman (DFN) model (often called the Pseudo-2D or P2D model) is the gold standard for physics-based lithium-ion battery simulation. Unlike simpler models, it fully couples solid-state diffusion, electrolyte concentration gradients, electric potentials, and electroreactions across the physical thickness of the cell.

Electrochemical Equations & Physics

  • Dual-Scale Mesh: Solves coupled partial differential equations (PDEs) in the electrode thickness direction (x-axis) and inside active particles (r-axis).
  • Electrolyte Dynamics: Solves for electrolyte concentration ce(x,t) and liquid potential Φe(x,t) using concentration-dependent diffusivity and conductivity.
  • Butler-Volmer Kinetics: Models local charge transfer at the solid-electrolyte interfaces dynamically.
SPM vs DFN Complexity Diagram

The Computational Leap: SPM vs. SPMe vs. DFN

When choosing a battery model, engineers face a critical trade-off between physical fidelity and computational cost:

  • Single Particle Model (SPM): Assumes uniform electrolyte concentration and reaction rate. The entire electrode is represented by a single spherical particle. Extremely fast (milliseconds) but fails at high C-rates (> 1C).
  • SPM with Electrolyte (SPMe): Adds analytical corrections for electrolyte behavior. Fast and slightly more accurate, but still lacks full local resolution.
  • DFN Model: Solves hundreds of coupled algebraic and differential equations simultaneously at every single time step using a Newton-Raphson solver. Highly accurate for high C-rates and local state analysis, but requires immense memory and CPU resources.
Our Core Philosophy & Motivation: While it is tempting to always choose the most rigorous model (DFN) for "absolute exactness," the computational cost scales up exponentially. A key objective of this simulator is to let you experience this first-hand. By adjusting node resolutions, C-rates, and parameters, you can see how heavy DFN calculation is compared to SPM. In real engineering, we must choose the right model matching our specific budget and purpose (e.g. SPM for real-time onboard BMS, DFN for micro-scale battery design).

How to Use

Simulator UI

The simulator provides a straightforward interface to explore how different battery designs perform under load.

Operation Guide

  1. Select a Preset: Choose a standard battery chemistry (e.g., Chen2020 NMC, Prada2013 LFP) to load literature-verified parameters.
  2. Adjust Node Resolutions: Go to the "Geometry & Grid" tab. Adjusting grid nodes (L1, L2, L3) allows you to directly observe the trade-off between computation time and resolution.
  3. Run Simulation & Analyze: Run the solver and toggle visualizers (Electrolyte Concentration, Solid Concentration, Potentials, Reaction Rates) to see real-time profiles across the cell.

Background & Motivation

Battery simulation is often a barrier for many due to the complexity of scripts and commercial tools. This application aims to make battery design intuitive and accessible, allowing anyone to visualize the inner workings of a lithium-ion cell directly in their browser.

By providing a simple way to experience how "tweaking" a parameter shifts a battery's performance, I hope to foster a deeper understanding of the trade-offs involved in energy storage technology.

References & Acknowledgements

This simulator is built using electrochemical principles and is greatly inspired by the PyBaMM (Python Battery Mathematical Modelling) project, which provides a world-class open-source framework for battery modelling. We express our deep gratitude to the PyBaMM community for their pioneering work and for sharing the robust parameter sets used in this application.

Primary Software & Framework

  • PyBaMM: Sulzer et al. "Python Battery Mathematical Modelling (PyBaMM)." J. Open Source Softw. 6 (2021): 2980. pybamm.org

Academic Literature (Parameter Sources)

  • Chen2020 (LG M50): Chen et al. "Development of Experimental Techniques for Parameterization of Multi-scale Lithium-ion Battery Models." J. Electrochem. Soc. 167 (2020): 080534.
  • Marquis2019: Marquis et al. "An Upgraded Form of the Single-Particle Model with Electrolyte." J. Electrochem. Soc. 166 (2019): A3693.
  • Mohtat2020: Mohtat et al. "A Lithium-Ion Battery Prognostics Method." J. Electrochem. Soc. 167 (2020): 140536.
  • Kim2011 (NCA): Kim et al. "Multi-domain modeling of lithium-ion batteries encompassing multi-physics." J. Electrochem. Soc. 158 (2011): A955.
  • Ai2020: Ai et al. "Electrochemical Thermal-Mechanical Modelling of Stress Inhomogeneity in Lithium-Ion Pouch Cells." J. Electrochem. Soc. 167 (2020): 013512.
  • Ecker2015: Ecker et al. "Parameterization of a physico-chemical model of a lithium-ion battery." J. Electrochem. Soc. 162 (2015): A1836.
  • O'Kane2022: O’Kane et al. "Lithium-ion battery degradation: how to model it." Phys. Chem. Chem. Phys. 24 (2022): 7909.
  • O'Regan2022: O’Regan et al. "Thermal-electrochemical parameters of a high energy lithium-ion cylindrical battery." Electrochim. Acta 425 (2022): 140700.
  • Prada2013: Prada et al. "A simplified electrochemical and thermal aging model of LiFePO4-graphite Li-ion batteries." J. Electrochem. Soc. (2013).
  • Ramadass2004: Ramadass et al. "Development of first principles capacity fade model for Li-ion cells." J. Electrochem. Soc. 151 (2004): A196.
  • Xu2019: Xu et al. "A Lithium-Ion Battery NMC half-cell model." J. Electrochem. Soc. 166 (2019): A3456.

最新アップデート・新機能リリース

大型新機能

1. 個別劣化モード解析機能(Degradation Mode Analysis)

初期設定(健全状態)を基準として、主要な電池劣化メカニズムを3段階の劣化水準でシミュレーションし、放電曲線や dQ/dV 曲線のシフトを同一画面で重ね合わせて比較解析できるようになりました:

  • LLI(稼動リチウム量減少): 0%, 5%, 10% のリチウム減少(SEI成長やリチウムトラップを模擬)。活物質ホストサイト量は100%保持。
  • LAM_NE(負極活物質減少): セルの総稼動リチウム量を厳密に保存したまま、負極の充放電ホストサイト量を減少(0%, 5%, 10%)。
  • LAM_PE(正極活物質減少): セルの総稼動リチウム量を厳密に保存したまま、正極の充放電ホストサイト量を減少(0%, 5%, 10%)。
  • Porosity_NE & Porosity_PE(負極・正極の空孔率減少): 活物質量を一定に保ったまま電解液体積分率を低減(0%, 20%, 50%)。液相輸送の屈曲度上昇による過電圧増大を分離評価。
  • Kinetics_NE & Kinetics_PE(負極・正極の交換電流密度減少): 界面反応の基準交換電流密度(j0,ref)を低減(0%, 20%, 50%)。被膜形成や電荷移動抵抗の増大を模擬。
物理・数値計算

2. 微分容量(dQ/dV)解析エンジンの刷新

  • 特異点ガード(Singularity Guard)の実装: 高Cレート(5C, 10Cなど)や初期緩和時に生じる局所的な過電圧反転(dV/dQ ≤ 0)によるピークトップの切り落とし、不自然なピークスプリット、高電圧域の不連続アーティファクトを根本解消。
  • 適応型 Savitzky-Golay 平滑化: 実測データと同様の、物理的整合性を持った滑らかで連続な相転移ピーク波形を忠実に再現。
性能・堅牢性

3. ゼロアロケーション(Zero-Allocation)とブラウザクラッシュ防止

  • ソルバー内ゼロアロケーションの確立: ヤコビアン・残差計算用バッファの事前確保、インプレースLU分解(solveLUInPlace)、状態ベクトルのダブルバッファリングにより、時間発展ループ内でのヒープ配列生成を完全ゼロ化(1ランあたり約84万回の配列生成を根絶)。
  • 30回連続過酷負荷試験で実証: 全材料系・全劣化モード・極端レート(C/100〜10C)での30連続シミュレーションにおいて、ヒープ正味増加わずか +1.39 MB、物理メモリ 65 MB 以下で完全に安定推移(メモリリーク皆無)。
  • ワーカースレッド完全解放とDOM間引き: 空間プロファイル記録の間引き(15ステップ毎、転送データ量80%減)、チャート描画頂点の間引き(160点)、およびタスク終了時の Worker 完全 terminate と 60ms の GC 待機時間を新設。

技術解説:Doyle-Fuller-Newman (DFN) モデル vs SPM / SPMe

Doyle-Fuller-Newman (DFN) モデル(別名:Pseudo-2D または P2D モデル)は、物理法則に基づくリチウムイオン電池シミュレーションにおける「ゴールドスタンダード」です。簡易的なモデルとは異なり、電極の物理的な厚み方向におけるリチウムイオン移動、電解液濃度分布、液相・固相の電位、および局所的な界面化学反応を完全に連立させて解きます。

電気化学的な考慮点と物理

  • 2次元スケール格子: セル厚み方向(x軸)の液相挙動と、各ノード内にある活物質粒子内部(r軸)の固体内拡散方程式を二重の空間格子で解きます。
  • 電解液ダイナミクス: 電解液濃度 ce(x,t) と液相電位 Φe(x,t) を、濃度に依存する拡散係数や導電率を含めて動的に計算します。
  • Butler-Volmer 反応速度論: 活物質と電解液の界面における電荷移動(電流密度)を局所電位差に基づきリアルタイムで決定します。
SPM vs DFN 複雑度比較図

計算規模の跳ね上がり:SPM vs. SPMe vs. DFN

電池モデリングにおいて、エンジニアは常に「物理的正確性」と「計算負荷(スピード)」のトレードオフに直面します。

  • 単一粒子モデル (SPM): 電解液の濃度や反応分布を均一と仮定し、電極全体を「一つの球状粒子」に代表させます。ミリ秒単位で超高速計算が可能ですが、高Cレート(>1C)では液相の移動制限を無視するため誤差が大きくなります。
  • 電解液考慮型単一粒子モデル (SPMe): SPMに電解液の近似補正を追加したもので、比較的軽量でありながら中レートまで精度が向上します。
  • DFNモデル (本アプリで実装): 厚み方向のノード数に応じて、毎時間ステップで数百個の連立代数・微分方程式を Newton-Raphson 法により反復収束させながら解きます。高レートや局所状態の解析に不可欠ですが、計算負荷はSPMに比べ劇的に大きくなります。
本シミュレータの最も大きなモチベーションと哲学:
「できることなら、最も厳密で物理的に正確なモデル(DFN)をあらゆる場面で使いたい」という気持ちは、エンジニアとして非常によく理解できます。しかし、モデルを厳密にするほど**計算の規模と処理の大変さは指数関数的に跳ね上がります**。
このシミュレータでは、グリッドノード数やCレートを変更した際、内部ソルバーの計算ステップや時間がどのように推移するかを肌で体験できるようにしています。BMS(バッテリーマネジメントシステム)のようなリアルタイム制御には超高速なSPMが必要であり、詳細な極板設計には重厚なDFNが必要になるというように、**「目的に合わせて最適なモデルを選ぶ」**という工学的な最適化の視点を感じ取っていただければ幸いです。

シミュレータの使い方

Simulator UI

シミュレータは、異なる電池設計や格子分割数が計算負荷や放電挙動にどう影響するかを、ブラウザ上で直感的に体験できます。

操作ガイド

  1. プリセットの選択: Chen2020 NMC や Prada2013 LFP などの標準プリセットを読み込みます。
  2. 格子(グリッド)ノード数の調整: 「Geometry & Grid」タブで分割ノード数を L1(粗い)から L3(細かい)まで切り替えられます。ノード数を増やすと、計算が目に見えて重くなり(処理の大変さ)、一方で空間プロファイルが滑らかに解像されていくトレードオフを確認できます。
  3. シミュレーション実行とプロファイル解析: 「Run Simulation」をクリックするとソルバーが走り、電解液濃度、固相濃度、電位、反応速度の空間分布が時系列でプロットされます。

開発背景と想い

電池シミュレーションは通常、複雑なスクリプトや高価な商用ツールの影に隠れて、多くの人にとって敷居の高いものでした。このアプリケーションは、電池設計を直感的にし、誰でもブラウザ上でリチウムイオン電池の内部動作を可視化できるようにすることを目指しています。

厳密モデルと簡易モデルの計算負荷の差を体感し、技術的な要件とシステムのリソース制限の間で適切なバランスを取るためのヒントを得ていただければ幸いです。

Reference & Acknowledgements (引用と謝辞)

本シミュレータは電気化学の原理に基づいて構築されており、電池モデリングの世界的なオープンソースフレームワークである PyBaMM (Python Battery Mathematical Modelling) プロジェクトから多大なインスピレーションを受けています。このアプリケーションで使用されているパラメータセットを提供・公開しているPyBaMMコミュニティの先駆的な取り組みに、深く感謝いたします。

主要ソフトウェア・フレームワーク

  • PyBaMM: Sulzer et al. "Python Battery Mathematical Modelling (PyBaMM)." J. Open Source Softw. 6 (2021): 2980. pybamm.org

学術論文(パラメータ引用元)

  • Chen2020 (LG M50): Chen et al. "Development of Experimental Techniques for Parameterization of Multi-scale Lithium-ion Battery Models." J. Electrochem. Soc. 167 (2020): 080534.
  • Marquis2019: Marquis et al. "An Upgraded Form of the Single-Particle Model with Electrolyte." J. Electrochem. Soc. 166 (2019): A3693.
  • Mohtat2020: Mohtat et al. "A Lithium-Ion Battery Prognostics Method." J. Electrochem. Soc. 167 (2020): 140536.
  • Kim2011 (NCA): Kim et al. "Multi-domain modeling of lithium-ion batteries encompassing multi-physics." J. Electrochem. Soc. 158 (2011): A955.
  • Ai2020: Ai et al. "Electrochemical Thermal-Mechanical Modelling of Stress Inhomogeneity in Lithium-Ion Pouch Cells." J. Electrochem. Soc. 167 (2020): 013512.
  • Ecker2015: Ecker et al. "Parameterization of a physico-chemical model of a lithium-ion battery." J. Electrochem. Soc. 162 (2015): A1836.
  • O'Kane2022: O’Kane et al. "Lithium-ion battery degradation: how to model it." Phys. Chem. Chem. Phys. 24 (2022): 7909.
  • O'Regan2022: O’Regan et al. "Thermal-electrochemical parameters of a high energy lithium-ion cylindrical battery." Electrochim. Acta 425 (2022): 140700.
  • Prada2013: Prada et al. "A simplified electrochemical and thermal aging model of LiFePO4-graphite Li-ion batteries." J. Electrochem. Soc. (2013).
  • Ramadass2004: Ramadass et al. "Development of first principles capacity fade model for Li-ion cells." J. Electrochem. Soc. 151 (2004): A196.
  • Xu2019: Xu et al. "A Lithium-Ion Battery NMC half-cell model." J. Electrochem. Soc. 166 (2019): A3456.