# g25ait1184-pixel/battery-thermal-cuda architecture

> Architecture diagram of the GitHub repository g25ait1184-pixel/battery-thermal-cuda, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/g25ait1184-pixel/battery-thermal-cuda
- Repository: https://github.com/g25ait1184-pixel/battery-thermal-cuda

## Overview

This repository implements a GPU-accelerated battery thermal digital twin: an operator supplies operating conditions, and the application produces thermal predictions or simulation results. The documented model-development path uses physics-generated data to train a base neural model and residual correction; runtime inference can use AI inside its validated domain and physics otherwise. The physics solver also has global, tiled, halo, and stream execution variants, with CPU/GPU validation and performance metrics. Runtime relationships below follow the README and shown headers/inference code; main.cu and several implementation files were not sampled, so their internal call details are not asserted.

Main entry points: [`include/battery_thermal_twin.h`](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/battery_thermal_twin.h) (Digital Twin), [`src/ai_inference.cpp`](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/src/ai_inference.cpp) (AI Inference), [`include/battery_model.h`](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/battery_model.h) (Battery Physics Model), [`src/main.cu`](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/src/main.cu) (Interactive Application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Twin Runtime"]
  node_application["Interactive Application<br/>[main.cu]"]
  node_twin["Digital Twin"]
  node_twin_state["Twin State<br/>[twin_state.h]"]
  node_twin_config["Twin Configuration<br/>[twin_config.h]"]
  node_battery_config["Solver Configuration<br/>[config.h]"]
end

subgraph group_physics["Thermal Physics"]
  node_battery_model["Battery Physics Model<br/>[battery_model.h]"]
  node_cpu_solver["CPU Reference<br/>[battery_model.h]"]
end

subgraph group_ai["Physics-AI Models"]
  node_inference["AI Inference<br/>[ai_inference.cpp]"]
  node_model_params["Model Parameters"]
end

subgraph group_compute["CUDA Execution"]
  node_gpu_solver["Global GPU Solver<br/>[kernels.h]"]
  node_tiled_solver["Tiled GPU Solver<br/>[kernels.h]"]
  node_halo_solver["Halo GPU Solver<br/>[kernels.h]"]
  node_stream_solver["CUDA Streams<br/>[stream_solver.h]"]
  node_metrics["Performance Metrics<br/>[metrics.h]"]
end

subgraph group_development["Training and Evaluation"]
  node_dataset_generation["Physics Dataset Generation"]
  node_training["Base and Residual Training<br/>[train_v5_mlp.py]"]
  node_validation["AI Validation<br/>[validate_v5_mlp.py]"]
  node_benchmarking["Benchmark and Analysis"]
  node_dataset[("Generated Cases")]
end

node_operator(("Operator"))

node_operator -->|"selects mode"| node_application
node_application -->|"runs twin"| node_twin
node_application -->|"benchmarks V5"| node_gpu_solver
node_twin -->|"updates state"| node_twin_state
node_twin -->|"uses settings"| node_twin_config
node_twin -->|"uses settings"| node_battery_config
node_twin -.->|"uses predictions"| node_inference
node_twin -.->|"runs physics"| node_gpu_solver
node_inference -->|"loads weights"| node_model_params
node_inference -->|"checks AI domain"| node_inference
node_cpu_solver -.->|"uses physics"| node_battery_model
node_gpu_solver -->|"uses physics"| node_battery_model
node_tiled_solver -->|"uses physics"| node_battery_model
node_halo_solver -->|"uses physics"| node_battery_model
node_stream_solver -->|"uses physics"| node_battery_model
node_dataset_generation -->|"uses V5 solver"| node_gpu_solver
node_dataset_generation -->|"generates cases"| node_dataset
node_dataset -->|"trains from data"| node_training
node_training -.->|"evaluated by"| node_validation
node_training -.->|"exports model"| node_inference
node_benchmarking -.->|"benchmarks inference"| node_inference
node_benchmarking -.->|"reports performance"| node_metrics
node_application -->|"reports benchmarks"| node_metrics

click node_application "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/src/main.cu"
click node_twin "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/battery_thermal_twin.h"
click node_twin_state "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/twin_state.h"
click node_twin_config "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/twin_config.h"
click node_battery_config "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/config.h"
click node_inference "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/src/ai_inference.cpp"
click node_model_params "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/ai_model_params.json"
click node_battery_model "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/battery_model.h"
click node_cpu_solver "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/battery_model.h"
click node_gpu_solver "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/kernels.h"
click node_tiled_solver "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/kernels.h"
click node_halo_solver "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/kernels.h"
click node_stream_solver "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/stream_solver.h"
click node_metrics "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/metrics.h"
click node_dataset_generation "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/generate_v5_dataset.h"
click node_training "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/ai/train_v5_mlp.py"
click node_validation "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/ai/validate_v5_mlp.py"
click node_benchmarking "https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/ai/benchmark_end_to_end.py"
click node_dataset "https://github.com/g25ait1184-pixel/battery-thermal-cuda/tree/main/dataset/v5_1000"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_application,node_twin,node_twin_state,node_twin_config,node_battery_config toneBlue
class node_battery_model,node_cpu_solver toneAmber
class node_inference,node_model_params toneMint
class node_gpu_solver,node_tiled_solver,node_halo_solver,node_stream_solver,node_metrics toneRose
class node_dataset_generation,node_training,node_validation,node_benchmarking,node_dataset,node_operator toneIndigo
```

## Components

### Twin Runtime

- [Interactive Application](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/src/main.cu): `src/main.cu`
- [Digital Twin](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/battery_thermal_twin.h): `include/battery_thermal_twin.h`
- [Twin State](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/twin_state.h): `include/twin_state.h`
- [Twin Configuration](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/twin_config.h): `include/twin_config.h`
- [Solver Configuration](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/config.h): `include/config.h`

### Thermal Physics

- [Battery Physics Model](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/battery_model.h): `include/battery_model.h`
- [CPU Reference](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/battery_model.h): `include/battery_model.h`

### Physics-AI Models

- [AI Inference](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/src/ai_inference.cpp): `src/ai_inference.cpp`
- [Model Parameters](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/ai_model_params.json): `ai_model_params.json`

### CUDA Execution

- [Global GPU Solver](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/kernels.h): `include/kernels.h`
- [Tiled GPU Solver](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/kernels.h): `include/kernels.h`
- [Halo GPU Solver](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/kernels.h): `include/kernels.h`
- [CUDA Streams](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/stream_solver.h): `include/stream_solver.h`
- [Performance Metrics](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/metrics.h): `include/metrics.h`

### Training and Evaluation

- [Physics Dataset Generation](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/include/generate_v5_dataset.h): `include/generate_v5_dataset.h`
- [Base and Residual Training](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/ai/train_v5_mlp.py): `ai/train_v5_mlp.py`
- [AI Validation](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/ai/validate_v5_mlp.py): `ai/validate_v5_mlp.py`
- [Benchmark and Analysis](https://github.com/g25ait1184-pixel/battery-thermal-cuda/blob/main/ai/benchmark_end_to_end.py): `ai/benchmark_end_to_end.py`
- [Generated Cases](https://github.com/g25ait1184-pixel/battery-thermal-cuda/tree/main/dataset/v5_1000): `dataset/v5_1000`

### Other components

- **Operator**

## Connections

- Operator → Interactive Application: selects mode (evidence: `README.md`)
- Interactive Application → Digital Twin: runs twin (evidence: `README.md`)
- Interactive Application → Global GPU Solver: benchmarks V5 (evidence: `README.md`)
- Digital Twin → Twin State: updates state (evidence: `include/battery_thermal_twin.h`)
- Digital Twin → Twin Configuration: uses settings (evidence: `include/battery_thermal_twin.h`)
- Digital Twin → Solver Configuration: uses settings (evidence: `include/battery_thermal_twin.h`)
- Digital Twin → AI Inference: uses predictions
- Digital Twin → Global GPU Solver: runs physics
- AI Inference → Model Parameters: loads weights (evidence: `src/ai_inference.cpp`)
- AI Inference → AI Inference: checks AI domain (evidence: `src/ai_inference.cpp`)
- CPU Reference → Battery Physics Model: uses physics (evidence: `include/battery_model.h`)
- Global GPU Solver → Battery Physics Model: uses physics (evidence: `include/kernels.h`)
- Tiled GPU Solver → Battery Physics Model: uses physics (evidence: `include/kernels.h`)
- Halo GPU Solver → Battery Physics Model: uses physics (evidence: `include/kernels.h`)
- CUDA Streams → Battery Physics Model: uses physics (evidence: `include/stream_solver.h`)
- Physics Dataset Generation → Global GPU Solver: uses V5 solver (evidence: `README.md`)
- Physics Dataset Generation → Generated Cases: generates cases (evidence: `README.md`)
- Generated Cases → Base and Residual Training: trains from data (evidence: `README.md`)
- Base and Residual Training → AI Validation: evaluated by
- Base and Residual Training → AI Inference: exports model
- Benchmark and Analysis → AI Inference: benchmarks inference
- Benchmark and Analysis → Performance Metrics: reports performance
- Interactive Application → Performance Metrics: reports benchmarks (evidence: `README.md`)
