Skip to content

A Python script for simulating and visualizing temperature distribution in a lithium-ion battery using the finite difference method. Features include thermal property definitions, heat generation modeling, boundary conditions, and 3D visualization. Ideal for researchers and engineers in battery thermal management.

Notifications You must be signed in to change notification settings

reyabsaluja/battery-heat-transfer-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Battery Thermal Simulation

This repository contains a comprehensive Python script for simulating and visualizing the temperature distribution within a lithium-ion battery using a finite difference method. The code integrates various thermal properties, battery dimensions, initial and boundary conditions, and models the heat transfer processes over time, making it an excellent tool for understanding battery thermal behavior and management.

Features

  • Thermal Properties: Defines battery density, specific heat, and thermal conductivity.
  • Battery Dimensions: Specifies the length, height, and depth of the battery.
  • Grid Points: Creates a non-uniform mesh grid for 3D space discretization.
  • Initial and Boundary Conditions: Sets initial temperature and boundary conditions for the battery.
  • Heat Generation Function: Models internal heat generation within the battery, incorporating sinusoidal fluctuations to simulate driving conditions.
  • Time Stepping: Implements time-stepping for the simulation with stability checks.
  • Convergence Criterion: Monitors the convergence of the simulation to ensure accurate results.
  • Finite Difference Solution: Utilizes finite difference equations to calculate temperature distribution over time.
  • Progress Tracking: Provides iterative updates on the simulation's progress and elapsed time.
  • 3D Visualization: Generates 3D plots to visualize the temperature distribution at mid-depth of the battery.

Governing Equations

The thermal behavior of the lithium-ion battery is governed by the heat diffusion equation, a partial differential equation (PDE) describing how heat propagates through a medium over time:

$$ \frac{\partial T}{\partial t} = \alpha \left( \frac{\partial^2 T}{\partial x^2} + \frac{\partial^2 T}{\partial y^2} + \frac{\partial^2 T}{\partial z^2} \right) + \frac{q_{dot}}{\rho \cdot c_p} $$

where:

  • $T(x, y, z, t)$ is the temperature distribution.
  • $\alpha$ is the thermal diffusivity.
  • $q_{dot}(t)$ is the volumetric heat generation rate.
  • $\rho$ is the density.
  • $c_p$ is the specific heat capacity.

Sinusoidal Heat Generation Model

To simulate dynamic driving conditions, the heat generation rate $q_{dot}(t)$ is modeled as:

$$ q_{dot}(t) = q_{base} + q_{peak} \cdot \sin^2\left( \frac{2 \pi t}{t_{cycle}} \right) $$

where:

  • $q_{base}$ is the baseline heat generation rate.
  • $q_{peak}$ is the peak heat generation rate.
  • $t_{cycle}$ is the period of the charge/discharge cycle.

Boundary Conditions

  • Bottom Face (Coolant Inlet): Linear temperature gradient.
  • Top, Sides, Front, & Back: Convective heat transfer to ambient air.

Numerical Solution and Stability

  • Spatial Discretization: Central difference approximations for spatial derivatives.
  • Temporal Discretization: Crank-Nicolson method for time derivatives.
  • Meshing: Non-uniform mesh with refined spacing near boundaries.
  • Stability: Time step chosen to satisfy the Courant-Friedrichs-Lewy (CFL) condition.

Usage

  1. Install Dependencies: Ensure you have numpy and matplotlib installed.
    pip install numpy matplotlib
    

Final Results

Figure1

About

A Python script for simulating and visualizing temperature distribution in a lithium-ion battery using the finite difference method. Features include thermal property definitions, heat generation modeling, boundary conditions, and 3D visualization. Ideal for researchers and engineers in battery thermal management.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages