Reading Time: 8 minutes

TL;DR

Battery electrochemistry modeling using partial differential equations (PDEs) provides high-fidelity simulation of lithium-ion cell behavior. The Single Particle Model (SPM) offers computational efficiency for real-time applications, while the Doyle-Fuller-Newman (DFN) model captures full electrolyte dynamics for high-power scenarios. This guide covers the governing equations, implementation with FiPy, and validation techniques for both approaches.

Introduction

Lithium-ion battery simulation relies on physics-based models that describe the coupled electrochemical processes inside the cell. These models form the foundation for battery management systems (BMS), design optimization, and performance prediction. The choice between simplified and full-fidelity models involves trading computational speed against accuracy—a decision that impacts everything from embedded controllers to research simulations.

This article provides a practical guide to battery electrochemistry modeling using PDEs, covering:

  • The mathematical framework behind P2D/DFN models
  • Simplifications leading to the Single Particle Model
  • Implementation strategies using the FiPy finite volume library
  • When to choose SPM versus DFN based on your application
  • Common challenges in parameter estimation and validation

The PDE Framework: P2D/DFN Model

The Pseudo-Two-Dimensional (P2D) model, also known as the Doyle-Fuller-Newman (DFN) model, represents the gold standard for physics-based battery simulation. It captures transport phenomena across both the cell thickness (x-direction) and within individual electrode particles (r-direction), hence “pseudo-2D” [^1][^2].

Core Governing Equations

The full P2D model consists of four coupled nonlinear PDEs describing conservation laws in solid and electrolyte phases [^3][^4]:

1. Solid-Phase Diffusion (Fick’s Second Law)

Lithium intercalation within spherical active particles:

$$
\frac{\partial c_s}{\partial t} = \frac{D_s}{r^2} \frac{\partial}{\partial r}\left(r^2 \frac{\partial c_s}{\partial r}\right)
$$

Where:

  • $c_s$ = solid lithium concentration (mol/m³)
  • $D_s$ = solid-phase diffusivity (m²/s)
  • $r$ = radial coordinate within particle

Boundary Conditions:

  • Center ($r = 0$): $\frac{\partial c_s}{\partial r} = 0$ (symmetry)
  • Surface ($r = R_s$): $-D_s \frac{\partial c_s}{\partial r} = \frac{j_{Li}}{F}$

2. Electrolyte Concentration Transport

Lithium-ion movement through electrolyte pores:

$$
\varepsilon_e \frac{\partial c_e}{\partial t} = \nabla \cdot (D_{e,eff} \nabla c_e) + \frac{1 – t_0^+}{F} j_{Li}
$$

Where:

  • $\varepsilon_e$ = electrolyte porosity
  • $c_e$ = electrolyte concentration (mol/m³)
  • $D_{e,eff}$ = effective electrolyte diffusivity (m²/s)
  • $t_0^+$ = cation transference number
  • $j_{Li}$ = pore wall flux (A/m²)

3. Solid-Phase Potential (Ohm’s Law)

Current flow through electrode matrix:

$$
i_s = -\sigma_{eff} \nabla \phi_s, \quad \nabla \cdot i_s = -j_{Li}
$$

Where:

  • $\sigma_{eff}$ = effective electronic conductivity (S/m)
  • $\phi_s$ = solid potential (V)

4. Electrolyte-Phase Potential

Ion transport in electrolyte:

$$
i_e = -\kappa_{eff} \nabla \phi_e + \frac{2\kappa_{eff}RT}{F}(1 – t_0^+) \nabla \ln c_e, \quad \nabla \cdot i_e = j_{Li}
$$

Where:

  • $\kappa_{eff}$ = effective ionic conductivity (S/m)
  • $\phi_e$ = electrolyte potential (V)
  • $R$ = universal gas constant (8.314 J/(mol·K))
  • $T$ = temperature (K)
  • $F$ = Faraday’s constant (96485 C/mol)

Coupling Through Butler-Volmer Kinetics

The reaction flux $j_{Li}$ couples solid and electrolyte via electrochemical kinetics:

$$
j_{Li} = a_s i_0 \left[ \exp\left(\frac{\alpha_a F \eta}{RT}\right) – \exp\left(-\frac{\alpha_c F \eta}{RT}\right) \right]
$$

Where:

  • $a_s$ = specific interfacial area (m²/m³)
  • $i_0$ = exchange current density (A/m²)
  • $\alpha_a, \alpha_c$ = anodic/cathodic transfer coefficients
  • $\eta = \phi_s – \phi_e – U(c_s)$ = overpotential (V)
  • $U(c_s)$ = open-circuit voltage (V), function of surface concentration

Terminal voltage is obtained from the potential difference across the cell:

$$
V(t) = \phi_s(L,t) – \phi_s(0,t) – R_{film} i_{app}(t)
$$

Where $L$ is total cell thickness and $R_{film}$ accounts for contact resistances [^5].

Boundary Conditions

Proper boundary conditions are essential for well-posed PDE problems [^6]:

Variable x=0 (Negative CC) x=L (Positive CC) Particle Surface (r=Rs) Particle Center (r=0)
$\phi_s$ 0 (reference) $V_{cell}(t)$ or $i_{app}$ Coupled via Butler-Volmer $\frac{\partial c_s}{\partial r}=0$
$c_e$ $\frac{\partial c_e}{\partial x}=0$ $\frac{\partial c_e}{\partial x}=0$ $-D_s\frac{\partial c_s}{\partial r}=j_{Li}/F$ $\frac{\partial c_s}{\partial r}=0$
$\phi_e$ $\frac{\partial \phi_e}{\partial x}=0$ $\frac{\partial \phi_e}{\partial x}=0$

The complete P2D system comprises 17 coupled PDEs and algebraic equations when accounting for both electrodes, electrolyte, and multiple particles [^7].

Simplified Approach: Single Particle Model (SPM)

The Single Particle Model (SPM) reduces computational cost by making two key simplifications [^8][^9]:

  1. Uniform current distribution: Each electrode is represented by a single spherical particle, assuming uniform reaction current density across the electrode thickness.
  2. Neglected electrolyte dynamics: Electrolyte concentration and potential gradients are assumed uniform or constant.

Mathematical Simplification

The SPM retains only the solid-phase diffusion PDE for each electrode:

$$
\frac{\partial c_s}{\partial t} = \frac{D_s}{r^2} \frac{\partial}{\partial r}\left(r^2 \frac{\partial c_s}{\partial r}\right)
$$

The terminal voltage simplifies to:

$$
V(t) = U(c_{s,surf}^{pos}) – U(c_{s,surf}^{neg}) – R_{int} \cdot i_{app}(t)
$$

Where $R_{int}$ is lumped internal resistance (often constant or empirical).

Computational advantage: SPM reduces the system from 17 coupled equations to essentially 2 diffusion PDEs (one per electrode), cutting simulation time by 10-100× [^10].

When to Use SPM

SPM is appropriate for [^11]:

  • Battery Management Systems (BMS): Real-time SOC/SOH estimation on embedded hardware
  • Low-to-moderate C-rates: < 1C discharge where electrolyte concentration variations are minimal
  • Controller design: Rapid iteration during algorithm development
  • Preliminary design studies: Quick parameter sweeps before committing to full DFN

Accuracy limits: SPM fails to capture voltage sag at high rates, electrolyte depletion effects, and localized concentration gradients. For 3C charging or power-intensive applications, errors exceed 5-10% [^12].

Extended SPM (SPMe)

The Single Particle Model with electrolyte (SPMe) adds a lumped electrolyte dynamics equation, bridging SPM and DFN. It captures moderate electrolyte concentration variations without full PDE treatment, offering better accuracy at ~2-3× the cost of SPM [^13].

Full Fidelity: Doyle-Fuller-Newman (DFN) Model

The DFN model implements complete porous-electrode theory, solving transport in both solid and liquid phases across the cell stack [^1][^2].

Complete PDE System

The DFN retains all four PDE families:

  1. Solid diffusion (2 PDEs: anode + cathode particles)
  2. Electrolyte concentration (1 PDE across cell thickness)
  3. Solid potential (2 PDEs: anode + cathode)
  4. Electrolyte potential (1 PDE across cell thickness)

Plus algebraic constraints:

  • Butler-Volmer kinetics at particle surfaces
  • Kirchhoff voltage law for terminal voltage
  • Current conservation boundaries

Total: ~6-8 PDEs depending on formulation (some combine/eliminate variables).

When DFN is Required

Use DFN for [^14]:

  • High-rate applications: > 2C charging/discharging where electrolyte gradients dominate
  • Detailed electrode design: Optimizing thickness, porosity, particle size distributions
  • Aging and degradation: SEI growth, lithium plating depend on local conditions
  • Thermal coupling: Temperature gradients interact with electrochemical processes
  • Validation reference: Benchmark reduced-order models against high-fidelity truth

Computational cost: DFN simulations can be 10-100× slower than SPM, requiring careful numerical optimization (implicit schemes, adaptive meshing) [^15].

Implementation with FiPy

FiPy is an open-source Python finite volume solver ideal for battery PDEs due to its flexible mesh handling and built-in diffusion/reaction terms [^16].

Setting Up the P2D Problem

A minimal FiPy implementation follows these steps:

from fipy import CellVariable, Grid2D, TransientTerm, DiffusionTerm

# 1. Define 2D mesh (x: cell thickness, r: particle radius)
mesh = Grid2D(dx=dx, dy=dr, nx=100, ny=50)

# 2. Create solution variables
c_s = CellVariable(name="solid_concentration", mesh=mesh, hasOld=True)
phi_s = CellVariable(name="solid_potential", mesh=mesh)
c_e = CellVariable(name="electrolyte_concentration", mesh=mesh)
phi_e = CellVariable(name="electrolyte_potential", mesh=mesh)

# 3. Define governing equations
eq_s = (TransientTerm(var=c_s) == 
       DiffusionTerm(coeff=D_s, var=c_s))

eq_phi_s = (ImplicitSourceTerm(coeff=sigma_eff, var=phi_s) == 
            -j_Li)  # reaction source

# 4. Add boundary conditions
c_s.faceGrad.constraint = ...  # particle surface flux
phi_s.constraint[boundary_id] = ...  # applied voltage

# 5. Time stepping
for step in range(num_steps):
    c_s.updateOld()
    eq_s.solve(var=c_s, dt=dt)
    # ... solve coupled equations sequentially or fully coupled

Practical Implementation Tips

Based on the FVbattpy reference implementation [^17]:

  1. Mesh strategy: Refine near electrode/electrolyte interfaces where gradients are steep
  2. Coupling approach: Use block-iterative solvers (Gauss-Seidel) or Newton-Raphson for full coupling
  3. Time stepping: Adaptive time control during transients; explicit schemes unstable for diffusion
  4. Initialization: Start from equilibrium (OCV) to avoid solver divergence
  5. Parameter files: Store material properties in structured config (YAML/JSON) for reproducibility

Complete FiPy Example

The FVbattpy GitHub repository provides a full P2D implementation with:

  • Multi-layer geometry (anode|separator|cathode)
  • Butler-Volmer reaction kinetics
  • Parameter sets for common chemistries (NMC, LFP, graphite)
  • Simulation drivers for constant current/voltage profiles
  • Visualization and post-processing

This reference code demonstrates best practices for handling:

  • Variable material properties (concentration-dependent diffusivity)
  • Moving boundary problems (particle swelling)
  • Thermal coupling extensions

Model Comparison: SPM vs DFN

The trade-off between speed and accuracy determines model selection [^11][^12]:

Feature SPM DFN
PDEs solved 2 (solid diffusion only) 6-8 (full coupled system)
Computational cost Very low (seconds/minutes) High (minutes/hours)
Electrolyte dynamics Neglected Full
Accuracy at 0.5C >99% >99%
Accuracy at 3C 90-95% >98%
Parameter count ~10 ~30+
Best for BMS Yes Limited (offline calibration)
Design optimization Preliminary Final validation

Decision Framework

Follow this flowchart for model selection:

High-power application (>2C)? ──Yes──> Use DFN
       │
      No
       │
Real-time embedded control? ──Yes──> Use SPM or SPMe
       │
      No
       │
Parameter estimation available? ──No──> Start with SPM, validate later
       │
      Yes
       │
Computational budget充足? ──Yes──> Use DFN for highest fidelity
       │
      No
       │
Use SPMe (middle ground)

Recommendation: Always benchmark your chosen model against experimental data or a trusted DFN simulation before deployment [^14].

Practical Challenges

Parameter Estimation

PDE models require numerous physical parameters [^18]:

  • Solid-phase: $D_s$, $a_s$, $i_0$, $U(c)$ curve
  • Electrolyte: $D_{e,eff}(\varepsilon)$, $\kappa_{eff}(\varepsilon, c_e)$, $t_0^+$
  • Geometric: electrode thicknesses, particle radii, porosities
  • Transport: Bruggeman exponents for effective properties

Key challenges [^19]:

  1. Overparameterization: Different parameter combinations produce similar voltage outputs, making unique identification difficult
  2. State dependence: Parameters vary with SOC, temperature, aging; require comprehensive datasets
  3. Measurement difficulty: Some parameters (e.g., $i_0$, $D_s$) require specialized lab equipment (EIS, GITT)
  4. Computational expense: Each parameter evaluation requires full PDE solve; optimization loops become expensive

Mitigation strategies:

  • Sensitivity analysis: Identify and estimate only influential parameters; fix others from literature
  • Reduced-order models: Use SPM/SPMe for parameter estimation, then transfer to DFN
  • Hybrid methods: Combine physics-based models with machine learning surrogates for faster optimization
  • Multi-stage estimation: Estimate lumped parameters first (internal resistance), then electrochemical ones [^20]

Computational Cost Management

Full DFN solves remain expensive. Strategies to reduce runtime:

  1. Mesh optimization: Coarse mesh in separator, refined in electrodes; 1D instead of full 2D
  2. Time stepping: Adaptive $\Delta t$ (large during equilibrium, small during transients)
  3. Solver selection: Use implicit (BDF) schemes; PETSc for parallel solves
  4. Model order reduction: Proper Orthogonal Decomposition (POD) or surrogate modeling
  5. Hardware acceleration: GPU-ported solvers (CUDA-enabled FiPy variants)

For typical 1C simulations, optimized DFN runs in 5-30 minutes on modern CPUs; SPM completes in seconds [^21].

Model Validation and Verification

V&V ensures your simulation matches reality [^22][^23]:

Verification (solving equations correctly):

  • Code review and unit tests
  • Compare with analytical solutions (e.g., constant-flux diffusion)
  • Mesh independence studies (refine until results converge)
  • Degenerate cases: zero current, fully charged/discharged states

Validation (solving correct equations):

  • Compare simulated voltage/current against experimental cycling data
  • Use standard profiles: USABC, FUDS, DST drive cycles
  • Error metrics: RMSE < 50 mV for voltage; MAPE < 2% for SOC
  • Parameter uncertainty quantification: confidence intervals on predictions

Recommended validation protocol:

  1. Static tests: OCV characterization, HPPC (Hybrid Pulse Power Characterization) for resistance
  2. Dynamic tests: Constant-current discharges at multiple C-rates (0.2C, 1C, 2C)
  3. Temperature variation: Repeat at 10°C, 25°C, 40°C to test thermal coupling
  4. Aging data: Track capacity fade over 100+ cycles for degradation models

Tools: MATLAB/Simulink Battery Toolbox, PyBaMM, or custom FiPy scripts with experimental data import.

Conclusion and Next Steps

Battery electrochemistry modeling with PDEs offers a powerful bridge between fundamental physics and practical engineering. The choice between SPM and DFN hinges on your specific trade-off between computational efficiency and simulation fidelity:

  • SPM: Real-time BMS, controller prototyping, rapid design exploration
  • DFN: High-fidelity validation, detailed design optimization, aging studies

Getting started:

  1. Experiment with PyBaMM: Provides ready-to-use SPM, SPMe, and DFN implementations with extensive parameter libraries [^24]
  2. Explore FVbattpy: Study the FiPy-based P2D code for customization and extension
  3. Benchmark your application: Validate model predictions against your specific cell chemistry and operating conditions
  4. Master parameter estimation: Invest in experimental characterization or use public datasets (e.g., NASA battery data)
  5. Implement V&V workflow: Build automated testing to catch model degradation over time

The next article in this series will cover thermal coupling in battery PDE models, showing how to extend electrochemical simulations to predict temperature rise and hotspots during fast charging.


Related Guides


References

[^1]: Doyle, M., Fuller, T. F., & Newman, J. (1993). Modeling of galvanostatic charge and discharge of the lithium/polymer/insertion cell. Journal of the Electrochemical Society, 140(6), 1526-1533.
[^2]: Newman, J., & Thomas-Alyea, K. E. (2012). Electrochemical systems (3rd ed.). Wiley.
[^3]: Zhu, G., et al. (2024). A simplified electrochemical model for lithium-ion batteries. Journal of Energy Chemistry, 90, 521-533.
[^4]: Li, Y., et al. (2022). A PDE Model Simplification Framework for All-Solid-State Batteries. Chalmers University.
[^5]: Moura, S. J., et al. (2015). Estimation and Control of Battery Electrochemistry Models. CDC Tutorial.
[^6]: Chen, Z., et al. (2022). Porous electrode modeling and its applications to Li-ion batteries. Physics of Fluids, 34(8).
[^7]: Manzie, C., et al. (2015). Simplification techniques for PDE-based Li-Ion battery models. Australian Control Conference.
[^8]: He, W., et al. (2024). An extended single-particle model of lithium-ion batteries. Journal of Energy Storage, 92, 112-129.
[^9]: Li, J., et al. (2017). A Single Particle Model for Lithium-Ion Batteries with Electrolyte Dynamics. Journal of the Electrochemical Society, 164(4), A755-A764.
[^10]: Perez, H. E., et al. (2016). Optimal charging of batteries via a single particle model. IEEE Transactions on Control Systems Technology, 24(3), 952-964.
[^11]: Brosa Planella, F., et al. (2022). A continuum of physics-based lithium-ion battery models. Journal of Physics: Energy, 4(2), 022001.
[^12]: Ali, H. A. A., et al. (2024). A comparison between physics-based Li-ion battery models. Computers & Chemical Engineering, 108, 108-125.
[^13]: Xue, C., et al. (2023). An Enhanced Single-Particle Model Using a Physics-Informed Neural Network. Batteries, 9(10), 511.
[^14]: Paten, I. B., et al. (2026). Dual-Continuum Models of Lithium-Ion Batteries are Fast and Accurate. Journal of the Electrochemical Society, 193(1), 011504.
[^15]: Xu, S., et al. (2025). Optimal convergence in finite element semidiscrete error analysis for the Doyle–Fuller–Newman model. IMA Journal of Numerical Analysis.
[^16]: FiPy Manual. National Institute of Standards and Technology. 2024.
[^17]: Gopalakrishnan, K., et al. (2020). FVbattpy: P2D Newman model using FiPy. GitHub.
[^18]: Guo, F., et al. (2026). Optimizing parameter estimation for electrochemical battery models. Journal of Power Sources, 625, 234-248.
[^19]: Kolluri, S., et al. (2022). A Tanks-in-Series Approach to Estimate Parameters for Battery Models. Journal of the Electrochemical Society, 169(4), 040553.
[^20]: Moura, S. J., et al. (2015). PDE Estimation Techniques for Advanced Battery Management Systems. American Control Conference.
[^21]: Sachsenweger, T., et al. (2026). ChargeFabrica: a Python-based finite difference tool for battery simulation. Journal of Physics: Materials, 9(1), 025009.
[^22]: HORIBA FuelCon (2007). Battery Technology Life Verification Testing.
[^23]: Foles, A., et al. (2022). Validation of a lithium-ion commercial battery pack model. Open Research Europe, 2, 15.
[^24]: PyBaMM Documentation. Python Battery Mathematical Modelling. 2025.