OneFLOW
An open-source CFD codebase for mesh generation, flow simulation, and reproducible engineering workflows.
OneFLOW is an actively developed computational fluid dynamics (CFD) project. Its goal is not only to run flow cases, but also to make the surrounding engineering work clearer and more reproducible: define a mesh or case, run it in a controlled workspace, inspect generated artifacts, validate results, and connect cases when one calculation depends on another.
This repository is evolving. This README describes the code and tools that exist today, distinguishes working features from longer-term direction, and provides build and test instructions for the current CMake project. OneFLOW is the open-source CFD and scientific-computing project in this repository; it is unrelated to similarly named commercial contract-lifecycle-management products.
简体中文 · Online documentation · Source code · Issues
Project vision
OneFLOW is developed as a general-purpose, unstructured-mesh CFD code and a scientific-computing engine for broader multidisciplinary research. Its scope includes PDE computation across one, two, and three dimensions, learning and validating numerical methods, solving engineering flow cases, and providing a modular codebase that researchers can inspect and extend. The equations, mesh types, and physical models available in practice depend on the solver and case implemented in the current revision. The longer-term vision is to make the scientific-computing workflow more programmable and automated: from defining a problem and running a case to checking results, recording evidence, and composing dependent tasks. The phrase scientific-computing operating system describes this long-term direction, not a claim that a complete operating-system-like platform already exists.
The repository contains capabilities at different maturity levels. Build options or names for MPI, CUDA, HIP, or other backends do not by themselves establish production readiness, scalability to a particular core count, or validated performance on a given device. Check the implementation, configuration output, and matching test evidence before relying on such capabilities.
What is in the project?
- CFD runtime: a C++20 application with solver, task, data, geometry, and I/O code organized into modules.
- Mesh and grid workflows: mesh conversion and grid-generation cases, structured and unstructured mesh work, boundary and connectivity handling, and tools for inspecting mesh metadata.
- Case-based verification: GoogleTest/CTest unit tests, existing CFD regression cases, and grid-conversion checks. A successful process exit alone is not sufficient evidence for every regression case.
- Engineering workbench: an optional Python/PySide6 desktop application for opening projects, running cases, editing mesh layouts, managing multi-case workflows, and reviewing logs and run history.
- Incremental backend work: a configurable compute-backend boundary, with CPU as the practical baseline. Accelerator integrations have different levels of readiness; do not assume every backend is production-ready.
Design principles
Keep the solver independent of the workbench
The C++ runtime is the authority for executing OneFLOW cases. Python tools and the desktop workbench orchestrate that runtime; they should not become hidden prerequisites for the solver or duplicate its numerical implementation.
Treat cases as projects and runs as artifacts
Inputs and case definitions belong in the source repository. Generated grids, reports, logs, and flow results should live in a run workspace. The workbench stages built-in cases away from the source tree to avoid accidentally overwriting checked-in inputs.
Separate data extraction, representation, and presentation
Mesh and geometry work is moving toward small, independently testable interfaces: extract a summary from a runtime mesh, represent the snapshot without depending on a GUI, then serialize or visualize it. A mesh summary is metadata (for example, dimensions, counts, and bounds), not a replacement for the mesh itself.
Make dependencies explicit
Some cases are independent; others consume a grid or artifact produced by an earlier case. The workflow model records execution mode and dependency edges so orchestration can validate and order work instead of relying on undocumented manual steps. Some workbench paths are still being integrated; consult its dedicated guide for current behavior.
Prefer evidence over assumptions
CTest, unit tests, mesh expectations, and CFD regression baselines provide different kinds of evidence. They are not interchangeable. Hardware-dependent accelerator validation is separate from the normal CPU build and should be reported as such.
Architecture at a glance
OneFLOW is best understood as a layered engineering codebase rather than a solver executable surrounded by unrelated scripts.
- Numerical runtime: C++ owns the actual case execution and numerical work. Command-line use remains possible without starting the desktop workbench.
- Mesh data pipeline: distinguish the live runtime mesh from a stable, independently testable snapshot and from output formats such as JSON. A summary describes metadata such as dimension, entity counts, and bounds; it is not the mesh itself. Geometry, topology, connectivity, and boundary information should be inspectable through focused interfaces rather than one all-purpose exporter.
- Case and artifact boundary: case definitions and reference inputs are versioned; generated meshes, flow results, logs, and reports belong to a run workspace. Explicit input/output roots allow a producer case and a consumer case to exchange artifacts without relying on accidental working-directory state.
- Workflow orchestration: a case may run alone, in a sequence, independently alongside other cases, or as part of a dependency graph. Dependencies should name the artifact-producing relationship and be validated before execution, rather than being hidden in manual steps.
- Tooling and presentation: CLI utilities, Python services, and the optional PySide6 workbench discover and orchestrate work, inspect outputs, and present results. They should reuse shared case/workflow contracts where practical, not duplicate solver behavior or make the runtime depend on GUI code.
- Testable evolution: unit tests, mesh invariants, and numerical regression tests cover different contracts. Refactoring should follow real call paths, make ownership and interface boundaries clearer, and preserve compatibility where required; tests are evidence for behavior, not a reason to rewrite code without a concrete need.
These are architectural boundaries and an ongoing direction, not a claim that every workflow or mesh interface has already reached its final form. The case catalog and profiles, for example, are not yet the authoritative source for every legacy runtime parameter; see the grid guide for current migration boundaries. For a code-backed map of runtime entry points, configuration layers, task dispatch, and refactoring rules, see the runtime architecture and development guide.
Repository map
| Path |
Purpose |
| codes/ |
C++ runtime, solver, geometry, mesh, and I/O implementation |
| ThirdParty/ |
Vendored dependencies used by the build, including GoogleTest and JSON libraries |
| tests/ |
C++ unit tests registered with CTest |
| grid/ |
Mesh-generation and mesh-conversion cases, profiles, and case catalog |
| test/ |
CFD/grid regression runners, suite manifests, and numerical baselines |
| tools/ |
Case validation, mesh utilities, and the optional desktop workbench |
| docs/ |
Official documentation root: architecture, plans, runbooks, evidence, reports, and Sphinx sources |
| cmake/ |
CMake helper functions |
Start with the online documentation. For repository-specific details, see the grid case guide, regression test guide, OneFLOW Workbench guide, and documentation organization plan. For AI-assisted development or a fast handoff between sessions, start with the AI project context and current refactoring state, then follow its links to architecture notes, acceptance criteria, tests, and CI evidence.
Build from source
Requirements
- CMake 3.30 or newer.
- A C++20-capable compiler.
- Git.
- MPI, METIS, and CGNS development libraries for the default build configuration.
- HDF5 is normally required by CGNS packages.
- Python 3 is useful for case tools, regression tests, and the optional desktop workbench.
Dependency discovery differs by platform. The current build does not use a single universal package-manager configuration, so verify the include and library paths that CMake reports when configuring.
Windows: Visual Studio 2022
Install Visual Studio 2022 with the Desktop development with C++ workload, CMake, and Git. Install compatible MPI, METIS, and CGNS libraries. The current CMake defaults expect MS-MPI under its standard SDK location, METIS under C:/dev/METIS/METIS-VS2022-STATIC, and CGNS under C:/dev/cgns/4.4.0. Override these paths for your installation.
From PowerShell at the repository root:
cmake -S . -B build `
-G "Visual Studio 17 2022" -A x64 `
-D CMAKE_INSTALL_PREFIX="C:/dev/OneFLOW" `
-D METIS_ROOT="C:/dev/METIS/METIS-VS2022-STATIC" `
-D CGNS_ROOT="C:/dev/cgns/4.4.0"
cmake --build build --config Debug --parallel
ctest --test-dir build -C Debug --output-on-failure
For Release, use --config Release for both build and test commands. Visual Studio is a multi-configuration generator; select Debug or Release at build/test time rather than relying on CMAKE_BUILD_TYPE.
The executable is typically under build/bin/Debug/ or build/bin/Release/, depending on the selected configuration.
Windows: Visual Studio 2026
Install Visual Studio 2026 with the Desktop development with C++ workload, the MSVC C++ Build Tools (v145), a Windows SDK, CMake tools, and Git. Install compatible x64 MPI, METIS, and CGNS development libraries as described in the Visual Studio 2022 section above.
The Visual Studio 2026 CMake generator is Visual Studio 18 2026 and requires CMake 4.2 or newer. The Visual Studio 2026 generator selects the v145 toolset by default. Check your CMake version before configuring:
cmake --version
Use a separate build directory for Visual Studio 2026. Do not reuse the VS 2022 build directory because CMake build trees are tied to their original generator and toolchain.
From PowerShell at the repository root:
cmake -S . -B build-vs2026 `
-G "Visual Studio 18 2026" -A x64 `
-D CMAKE_INSTALL_PREFIX="C:/dev/OneFLOW" `
-D METIS_ROOT="C:/dev/METIS/METIS-VS2022-STATIC" `
-D CGNS_ROOT="C:/dev/cgns/4.4.0"
cmake --build build-vs2026 --config Debug --parallel
ctest --test-dir build-vs2026 -C Debug --output-on-failure
For a Release build, replace Debug with Release in both the build and CTest commands. Open build-vs2026/OneFLOW.sln in Visual Studio 2026 if you prefer to build or debug from the IDE.
The example dependency paths are the same as the VS 2022 example and must be adjusted to your local installation. Confirm that the MPI, METIS, and CGNS libraries are x64 and compatible with the selected MSVC toolset. If a prebuilt third-party library causes linker or runtime incompatibilities, rebuild that dependency with the VS 2026 v145 toolset and point CMake to the rebuilt installation.
The executable is typically under build-vs2026/bin/Debug/ or build-vs2026/bin/Release/, depending on the selected configuration.
For generator and toolset details, see the CMake Visual Studio 18 2026 generator documentation and Microsoft's MSVC compiler version information.
Windows: Ninja / single-configuration build
If Ninja and the MSVC developer environment are available, a single-configuration build can be convenient:
cmake -S . -B build-ninja -G Ninja `
-D CMAKE_BUILD_TYPE=Debug `
-D CMAKE_INSTALL_PREFIX="C:/dev/OneFLOW" `
-D METIS_ROOT="C:/dev/METIS/METIS-VS2022-STATIC" `
-D CGNS_ROOT="C:/dev/cgns/4.4.0"
cmake --build build-ninja --parallel
ctest --test-dir build-ninja --output-on-failure
Use a separate build directory when changing generators or compilers. CMake does not support switching the generator in an existing build tree.
Linux: GCC and system libraries
On Debian/Ubuntu, install the compiler and common development packages:
sudo apt update
sudo apt install build-essential cmake git \
libhdf5-dev libcgns-dev libmetis-dev libmpich-dev
The current CMake configuration accepts explicit library paths through environment variables. The following paths match a common Ubuntu/MPICH layout; adjust them for your distribution: