# hsraktu/major_project architecture

> Architecture diagram of the GitHub repository hsraktu/major_project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hsraktu/major_project
- Repository: https://github.com/hsraktu/major_project

## Overview

##### Project Type and Purpose
- This is an open-source Python ML pipeline for predicting CFD (computational fluid dynamics) fields.
- Key functionality: ingest raw CFD data, preprocess into slices/masks, train 3D-CNN/PointNet models, test/infer, and demo results.

##### File Structure and Map to Architectural Components
- Top-level scripts:
- data_prepare.py – initial data‐preparation orchestration.
- run_demo.ipynb – end‐to‐end demo notebook.
- preprocessing/ – module that slices, pads, and visualizes CFD data.
- training/ – dataset loader and training orchestration (train.py).
- models/ – model definitions (cd_predictor_3dcnn.py) and experimental notebooks.
- testing/ – test data, test harness scripts, and validation notebooks.
- requirements*.txt – lists Python dependencies (e.g., Paddle or PyTorch, NumPy, etc.).

##### README
- Confirms the goal: build and evaluate a learning-based CFD predictor.

##### Sketch the Main Components and Their Interactions
a. Data Sources
- Raw CFD simulation outputs (e.g., CSV or binary files under testing/).
b. Preprocessing Module
- Scripts in preprocessing/ and data_prepare.py
- Tasks: slice generation, padding/masking, visualization.
c. Storage Layer
- Temporary file store for processed slices (on-disk folders).
d. Training Module
- training/dataset_loader.py loads processed slices.
- training/train.py runs model training, emits trained model artifacts.
e. Model Definitions
- models/cd_predictor_3dcnn.py (3D-CNN architecture)
- Experiment notebooks for PointNet2D.
f. Testing/Inference Module
- testing/test.py, model_setup.ipynb, test notebooks
- Loads trained model, runs inference on new CFD inputs, outputs paddle_tensor files or metrics.
g. Demo/Visualization
- run_demo.ipynb – ties together preprocessing, model loading, and downstream visualization.

##### Architectural Patterns and Design Principles
- Pipeline Pattern: clear staging from raw data → preprocessing → training → inference.
- Modularity: separate directories per concern (preprocessing, models, training, testing).
- Extensibility: drop-in new model definitions under models/, new preprocessing scripts under preprocessing/.
- Reproducibility: notebooks (run_demo, model experiments, tests) document end-to-end flows.

##### Technologies and Frameworks to Annotate
- Python 3.x
- ML frameworks: Paddle or PyTorch (as per requirements.txt)
- Data libraries: NumPy, pandas (possibly)
- Visualization: Matplotlib or custom scripts in preprocessing/visualize_slices.py
- Jupyter Notebooks for experiments and demos.

##### Final Advice
- Pipeline sequence and data handoffs between modules.
- The result should clearly reflect the file structure under these categories, making the architecture self‐explanatory.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Ingestion Layer
    subgraph "Data Ingestion"
        Raw1["DrivAer_F_D_WM_WW_0001.paddle_tensor"]:::dataStore
        Raw2["DrivAer_F_D_WM_WW_0636.paddle_tensor"]:::dataStore
    end

    %% Preprocessing Layer
    subgraph "Preprocessing"
        DP["data_prepare.py"]:::codeModule
        SG["slice_generator.py"]:::codeModule
        PM["pad_and_mask_slices.py"]:::codeModule
        VS["visualize_slices.py"]:::codeModule
    end

    %% Storage Layer
    Processed["Processed Slices Store"]:::dataStore

    %% Training & Model Layer
    subgraph "Training & Model"
        DL["dataset_loader.py"]:::codeModule
        TR["train.py"]:::codeModule
        CNN["cd_predictor_3dcnn.py"]:::codeModule
        PN["pointnet2d_experiment.ipynb"]:::notebooks
    end

    %% Testing / Inference Layer
    subgraph "Testing / Inference"
        TH["test.py"]:::codeModule
        TH1["test1.py"]:::codeModule
        CL["clean.py"]:::codeModule
        MS["model_setup.ipynb"]:::notebooks
        VB["test.ipynb"]:::notebooks
    end

    %% Demo Layer
    DEMO["run_demo.ipynb"]:::notebooks

    %% Dependency Management
    subgraph "Dependencies"
        Req["requirements.txt"]:::external
        Lock["requirements.lock.txt"]:::external
    end

    %% Data Flow
    Raw1 --> DP
    Raw2 --> DP
    DP --> SG
    SG --> PM
    PM --> VS
    VS --> Processed
    Processed --> DL
    DL --> TR
    TR --> CNN
    TR --> PN
    CNN --> TH
    PN --> TH
    TR --> TH1
    TH --> DEMO
    TH1 --> DEMO
    CL --> DEMO
    MS --> DEMO
    VB --> DEMO

    %% Dependencies flow
    Req -.-> DP
    Lock -.-> DP
    Req -.-> DL
    Lock -.-> DL

    %% Click Events
    click Raw1 "https://github.com/hsraktu/major_project/blob/main/testing/DrivAer_F_D_WM_WW_0001.paddle_tensor"
    click Raw2 "https://github.com/hsraktu/major_project/blob/main/testing/DrivAer_F_D_WM_WW_0636.paddle_tensor"
    click DP "https://github.com/hsraktu/major_project/blob/main/data_prepare.py"
    click SG "https://github.com/hsraktu/major_project/blob/main/preprocessing/slice_generator.py"
    click PM "https://github.com/hsraktu/major_project/blob/main/preprocessing/pad_and_mask_slices.py"
    click VS "https://github.com/hsraktu/major_project/blob/main/preprocessing/visualize_slices.py"
    click DL "https://github.com/hsraktu/major_project/blob/main/training/dataset_loader.py"
    click TR "https://github.com/hsraktu/major_project/blob/main/training/train.py"
    click CNN "https://github.com/hsraktu/major_project/blob/main/models/cd_predictor_3dcnn.py"
    click PN "https://github.com/hsraktu/major_project/blob/main/models/pointnet2d_experiment.ipynb"
    click TH "https://github.com/hsraktu/major_project/blob/main/testing/test.py"
    click TH1 "https://github.com/hsraktu/major_project/blob/main/testing/test1.py"
    click CL "https://github.com/hsraktu/major_project/blob/main/testing/clean.py"
    click MS "https://github.com/hsraktu/major_project/blob/main/testing/model_setup.ipynb"
    click VB "https://github.com/hsraktu/major_project/blob/main/testing/test.ipynb"
    click DEMO "https://github.com/hsraktu/major_project/blob/main/run_demo.ipynb"

    %% Styles
    classDef codeModule fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef notebooks fill:#FFA500,stroke:#000,stroke-width:1px;
    classDef dataStore fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px;
```
