How sp-droid/fluidlearn works
1. Project shape
FluidLearn is a Python package centered on CFD data handling and visualization. The runtime package lives under fluidlearn/, while data/, models/, notebooks/, and results/ are workspace directories for inputs, artifacts, experiments, and outputs.
2. Primary entry point
init.py is the user-facing launcher. The README indicates it starts an interactive CLI rather than a batch pipeline, so the top-level control flow is menu-driven instead of service-based or notebook-driven.
3. CLI orchestration layer
fluidlearn/cli.py is the main coordinator. It uses an interactive menu system (the README says InquirerPy) to route the user into workflows such as visualization, with a loop-back behavior after each action. This is the main boundary between human interaction and the underlying package functions.
4. Data ingestion and dataset layout
fluidlearn/data/dataloader.py is the data-access boundary for HDF5-based CFD datasets. The repository’s on-disk format is explicit: data/01_raw/<dataset>/ contains mesh.h5, constants.json, and per-case .h5 files. This suggests a split between shared mesh/metadata and case-specific time-varying fields.
5. Raw case repository vs processed data
data/00_cases/ is a manual case-execution area for OpenFOAM-style simulations, while data/01_raw/ holds framework-consumable raw datasets. That separation implies the repository supports two phases: external simulation generation first, then Python-side ingestion/processing second.
6. Visualization subsystem
Visualization is a notable subsystem under fluidlearn/vis/ plus fluidlearn/visualization.py. The vis package includes GUI-oriented modules (GUIunstructured.py, UIpanel.py, mesh_highlighter.py), indicating interactive inspection of unstructured CFD meshes rather than only static plotting. The visualization.py module appears to be the CLI-accessible raw visualization entrypoint.
7. Numerical and geometry utilities
fluidlearn/utils/ contains shared computation helpers: gradient.py for field derivatives, topology.py for mesh/connectivity-related logic, colormap.py for visualization styling, and misc.py for general support. These utilities likely sit below both data processing and visualization, providing reusable domain math and presentation helpers.
8. Modeling layer
models/ is present as a repository-level artifact directory rather than a code package. Combined with the README’s “training” menu placeholder, this suggests model training/inference is planned or partially externalized, but the current repo emphasis is on data and visualization infrastructure.
9. Experiment and notebook boundary
fluidlearn/main.ipynb and the notebooks/ directory indicate exploratory analysis and prototyping happen in notebooks, separate from the CLI and package code. This is a common boundary in scientific Python projects: reproducible package logic in fluidlearn/, exploratory workflows in notebooks.
10. Configuration and packaging
pyproject.toml, requirements.txt, and editable install support (pip install -e .) show the project is a standard Python package, not a service deployment. The README’s CUDA/Torch install notes indicate the computational stack expects GPU-capable PyTorch for downstream ML work.
11. External scientific tooling
OpenFOAM is the key external simulation system implied by data/00_cases/README.md. That makes FluidLearn a bridge between CFD solver output and Python-based analysis/visualization rather than the simulator itself.
12. Artifact/output boundaries
results/ is reserved for generated outputs, while docs/ and .gitkeep files suggest scaffolding for future documentation and empty tracked directories. In an architecture diagram, these should be shown as non-runtime storage zones rather than active components.
13. Overall data flow
The main flow is: CFD case generation in data/00_cases/ or external OpenFOAM runs → raw HDF5/metadata under data/01_raw/ → loading through fluidlearn/data/dataloader.py → processing/math via fluidlearn/utils/ → visualization through fluidlearn/vis/ or fluidlearn/visualization.py, with CLI orchestration from init.py/fluidlearn/cli.py.
14. Notable repo mismatch
The README references a fluidlearn/visualize.py processed-visualization module, but the file tree does not include it. For an accurate diagram, treat “processed visualization” as intended/mentioned functionality, but only visualization.py and the vis/ package are present in the current codebase.
Main entry points: cli.py CLI · GUIunstructured.py GUI view · dataloader.py Loader · visualization.py Viz entry
Components 19
Runtime package
Installable Python code that coordinates CLI, data access, utilities, and visualization.
- Launcher · User-facing entry point that starts the interactive workflow.
init.py - CLI · Interactive coordinator that routes users into package workflows.
fluidlearn/cli.py - Viz entry · CLI-accessible visualization module for loading and inspecting data.
fluidlearn/visualization.py - Loader · Boundary for reading CFD datasets from raw HDF5 and metadata files.
fluidlearn/data/dataloader.py - GUI view · Unstructured-mesh visualization interface and interaction layer.
fluidlearn/vis/GUIunstructured.py - Panel UI · GUI controls and user interaction widgets for visualization.
fluidlearn/vis/UIpanel.py - Mesh highlight · Highlights and selection logic for mesh elements in the GUI.
fluidlearn/vis/mesh_highlighter.py - Gradients · Derivative and gradient computations for CFD fields.
fluidlearn/utils/gradient.py - Topology · Connectivity and mesh-structure helpers.
fluidlearn/utils/topology.py - Colormaps · Color mapping utilities for plots and mesh rendering.
fluidlearn/utils/colormap.py - Shared utils · General-purpose helpers used across the package.
fluidlearn/utils/misc.py
Workspace data
Repository directories for simulation cases, raw datasets, notebooks, models, and generated results.
- Case area · Manual OpenFOAM-style case repository used to produce simulations.
data/00_cases - Raw data · Framework-consumable HDF5 datasets with mesh, constants, and case files.
data/01_raw - Models · Repository-level model artifacts and future training outputs.
models - Notebooks · Interactive analysis and prototyping notebooks.
notebooks - Results · Generated outputs and experiment results.
results
External tooling
Outside systems used to generate CFD cases and supply data to the package.
- OpenFOAM · Upstream CFD solver used to generate case data.
Connections 20
- Launcher → CLI: starts · Launcher enters the interactive CLI loop.
- CLI → Viz entry: opens · Menu routes into visualization workflows.
- Viz entry → Loader: loads · Visualization consumes datasets through the data boundary.
- CLI → Loader: routes · CLI workflows can access dataset loading directly.
- Loader → Topology: uses · Loader relies on mesh/connectivity helpers.
- Loader → Gradients: uses · Field processing can depend on gradient logic.
- Viz entry → GUI view: renders · Visualization entry drives the interactive GUI.
- GUI view → Panel UI: contains · GUI includes control-panel interactions.
- GUI view → Mesh highlight: uses · GUI uses mesh highlighting for selection.
- GUI view → Colormaps: uses · Rendering uses colormap helpers.
- GUI view → Topology: uses · Interactive viewing depends on mesh topology logic.
- CLI → Shared utils: shares · Common helpers support multiple workflows.
- Case area → OpenFOAM: generated by · Simulation cases are produced externally by the CFD solver.
- OpenFOAM → Raw data: exports · Simulation output is converted into raw datasets.
- Raw data → Loader: ingested by · Raw HDF5 datasets are read into the package.
- Models → CLI: future use · Model artifacts are expected to participate in planned training workflows.
- Notebooks → Raw data: explores · Notebooks are used to inspect and prototype on datasets.
- Results → CLI: receives · CLI-driven workflows emit outputs to the results area.
- Packaging → CLI: packages · Project configuration defines the installable Python package.
- README → CLI: documents · README describes the interactive CLI-centered workflow.