README.md
| 1 | --- |
| 2 | tags: |
| 3 | - physics-informed |
| 4 | - surrogate-model |
| 5 | - thermal-management |
| 6 | - electric-vehicles |
| 7 | - particle-swarm-optimization |
| 8 | - nanofluid |
| 9 | - magnetohydrodynamics |
| 10 | - pytorch |
| 11 | license: apache-2.0 |
| 12 | library_name: pytorch |
| 13 | pipeline_tag: tabular-regression |
| 14 | --- |
| 15 | |
| 16 | # MHD Hybrid Nanofluid EV Battery Thermal Management — Neural Surrogate + PSO |
| 17 | |
| 18 | A **physics-calibrated neural network surrogate model** for predicting thermal performance of MHD hybrid nanofluid cooling systems in electric vehicle battery thermal management, coupled with **Particle Swarm Optimization (PSO)** for intelligent parameter optimization. |
| 19 | |
| 20 | ## 🔬 Overview |
| 21 | |
| 22 | This model replaces expensive CFD simulations with a fast neural network surrogate that predicts: |
| 23 | |
| 24 | | Output | Description | Units | |
| 25 | |--------|-------------|-------| |
| 26 | | `T_max` | Maximum battery surface temperature | °C | |
| 27 | | `Nu` | Nusselt number (heat transfer coefficient) | — | |
| 28 | | `S_gen` | Total entropy generation (normalized) | — | |
| 29 | | `delta_T` | Cell-to-cell temperature difference | °C | |
| 30 | | `BL_suppression` | Boundary layer suppression | % | |
| 31 | | `k_ratio` | Thermal conductivity ratio (k_hnf/k_bf) | — | |
| 32 | |
| 33 | From 3 input parameters: |
| 34 | |
| 35 | | Input | Range | Description | |
| 36 | |-------|-------|-------------| |
| 37 | | `Ha` | 0–60 | Hartmann number (magnetic field strength) | |
| 38 | | `phi` | 0.01–0.05 | Nanoparticle volume fraction | |
| 39 | | `u_in` | 0.05–0.30 m/s | Inlet flow velocity | |
| 40 | |
| 41 | ## 📊 Model Performance |
| 42 | |
| 43 | | Metric | R² Score | MAE | MAPE (%) | |
| 44 | |--------|----------|-----|----------| |
| 45 | | T_max | 0.979 | 0.76°C | 1.76 | |
| 46 | | Nu | 0.960 | 0.54 | 2.53 | |
| 47 | | S_gen | 0.991 | 0.012 | 3.27 | |
| 48 | | delta_T | 0.980 | 0.21°C | 1.67 | |
| 49 | | BL_suppression | 0.999 | 0.20% | 6.96 | |
| 50 | | k_ratio | 0.999 | 0.002 | 0.17 | |
| 51 | | **Overall** | **0.985** | — | — | |
| 52 | |
| 53 | ## 🏗️ Architecture |
| 54 | |
| 55 | - **Type**: Multi-output MLP with residual connections |
| 56 | - **Layers**: [64, 128, 128, 64] hidden units |
| 57 | - **Activation**: Tanh (physics-smooth) |
| 58 | - **Training**: 2000 epochs, Adam optimizer, physics-informed loss |
| 59 | - **Dataset**: 5000 Latin Hypercube samples from governing equations |
| 60 | |
| 61 | ## ⚡ PSO Optimization Results |
| 62 | |
| 63 | The PSO optimizer finds optimal cooling parameters: |
| 64 | |
| 65 | | Parameter | PSO Optimal | Paper Reference | |
| 66 | |-----------|-------------|-----------------| |
| 67 | | Ha | ~22–32 | 32.4 | |
| 68 | | φ | ~0.04–0.05 | 0.038 | |
| 69 | | u₀ | ~0.19–0.29 m/s | 0.187 m/s | |
| 70 | |
| 71 | **Key Results:** |
| 72 | - 🌡️ Peak temperature reduction: **25–35%** vs conventional cooling |
| 73 | - 📉 Entropy minimization: **~31.5%** reduction |
| 74 | - ✅ Battery temperature maintained within safe range (< 40°C) |
| 75 | |
| 76 | ## 🚀 Quick Start |
| 77 | |
| 78 | ```python |
| 79 | import torch |
| 80 | import numpy as np |
| 81 | import json |
| 82 | |
| 83 | # Load model |
| 84 | from model import ThermalSurrogateModel, DataNormalizer, get_model_config |
| 85 | |
| 86 | config = get_model_config() |
| 87 | model = ThermalSurrogateModel( |
| 88 | input_dim=3, hidden_dims=[64, 128, 128, 64], |
| 89 | output_dim=6, dropout=0.0 |
| 90 | ) |
| 91 | model.load_state_dict(torch.load('model.pt', weights_only=True)) |
| 92 | model.eval() |
| 93 | |
| 94 | normalizer = DataNormalizer.load('normalizer.json') |
| 95 | |
| 96 | # Predict: [Ha=32.4, phi=0.038, u_in=0.187] |
| 97 | X = np.array([[32.4, 0.038, 0.187]], dtype=np.float32) |
| 98 | X_norm = normalizer.transform_input(X) |
| 99 | with torch.no_grad(): |
| 100 | pred = model(torch.tensor(X_norm)).numpy() |
| 101 | result = normalizer.inverse_transform_output(pred) |
| 102 | print(f"T_max: {result[0,0]:.1f}°C, Nu: {result[0,1]:.1f}") |
| 103 | ``` |
| 104 | |
| 105 | ## 📂 Files |
| 106 | |
| 107 | | File | Description | |
| 108 | |------|-------------| |
| 109 | | `model.pt` | Trained PyTorch model weights | |
| 110 | | `normalizer.json` | Input/output normalization parameters | |
| 111 | | `config.json` | Model architecture configuration | |
| 112 | | `model.py` | Model class definition | |
| 113 | | `data_generator.py` | Physics-based synthetic data generator | |
| 114 | | `pso_optimizer.py` | PSO optimization module | |
| 115 | | `predict.py` | High-level prediction interface | |
| 116 | | `train.py` | Training script | |
| 117 | | `evaluation.json` | Evaluation metrics | |
| 118 | | `pso_results.json` | PSO optimization results + Pareto front | |
| 119 | |
| 120 | ## 📄 Based On |
| 121 | |
| 122 | **Paper**: "AI-Assisted Thermodynamic Optimization of MHD Hybrid Nanofluid Flow for Electric Vehicle Battery Thermal Management Using Particle Swarm Optimization" |
| 123 | |
| 124 | ### Governing Equations |
| 125 | |
| 126 | **Continuity**: ∂u/∂x + ∂v/∂y = 0 |
| 127 | |
| 128 | **Momentum (NS + MHD)**: ρ_hnf(u·∂u/∂x + v·∂u/∂y) = -∂p/∂x + μ_hnf·∇²u - σ_hnf·B₀²·u |
| 129 | |
| 130 | **Energy**: (ρCₚ)_hnf(u·∂T/∂x + v·∂T/∂y) = k_hnf·∇²T + μ_hnf·Φ + σ_hnf·B₀²·u² |
| 131 | |
| 132 | **Entropy**: S_gen = k_hnf/T₀²·|∇T|² + μ_hnf/T₀·Φ + σ_hnf·B₀²·u²/T₀ |
| 133 | |
| 134 | ## 📜 License |
| 135 | |
| 136 | Apache 2.0 |
| 137 | |