# x7z9/flow-over-cylinder architecture

> Architecture diagram of the GitHub repository x7z9/flow-over-cylinder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/x7z9/flow-over-cylinder
- Repository: https://github.com/x7z9/flow-over-cylinder

## Overview

##### File structure
- Top-level:
- `34x18.msh` – original GAMBIT mesh file
- `constant/` – physical properties and mesh in OpenFOAM format
- `system/` – solver controls, discretization schemes, parallel settings
- `LICENSE.txt`, `README.md`
- Under `constant/polyMesh/`: boundary definitions, cell/face/point zones, mesh connectivity
- Under `constant`: `transportProperties` (viscosity, density), `turbulenceProperties`
- Under `system`:
- `controlDict` (time stepping, write intervals)
- `fvSchemes`, `fvSolution` (numerical schemes, solver tolerances)
- `decomposeParDict` (MPI decomposition)

##### README for additional insights
- Mesh created in GAMBIT → converted by `fluentMeshToFoam`
- Workflow: mesh conversion → mesh check & topology sets → solver run (serial & parallel) → reconstruction → vorticity post-processing → ParaView visualization
- Dependencies: OpenFOAM v10, ParaView

##### Main components
a. Mesh generator (GAMBIT 2.4.6)
b. Mesh conversion utility (`fluentMeshToFoam`)
c. OpenFOAM Case:
- `constant/polyMesh` (mesh data)
- `constant` (physical properties)
- `system` (solver settings)
d. Solver (`pisoFoam`)
e. Parallelization: `decomposePar` + `mpirun -np 8`
f. Reconstruction: `reconstructPar`
g. Post-processing: `postProcess -func vorticity`
h. Visualization: ParaView (`paraFoam`)

##### Relationships and data flow
- Start: GAMBIT mesh → `34x18.msh`
→ Mesh conversion (`fluentMeshToFoam`)
→ OpenFOAM `constant/polyMesh`
→ Mesh check (`checkMesh`) & topology set (`topoSet`)
→ Serial solver (`pisoFoam`)
→ Parallel decomposition (`decomposePar`)
→ MPI solver instances (`mpirun`)
→ Reconstructed field (`reconstructPar`)
→ Vorticity field (`postProcess`)
→ ParaView visualization

##### Architectural patterns or design principles
- File-based workflow: case directory drives everything
- Parallel decomposition for scalability

##### Detail every essential architectural element
- Boundary between serial and parallel execution (serial `pisoFoam` vs. `mpirun -np 8 pisoFoam`).
- Role of `decomposeParDict` in determining decomposition layout.
- `reconstructPar` as a merging step.
- Final output accessed by `paraFoam`.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Pre-processing
    MeshGen["GAMBIT Mesh\n34x18.msh"]:::data
    click MeshGen "https://github.com/x7z9/flow-over-cylinder/blob/main/34x18.msh"
    Converter["Mesh Conversion\nfluentMeshToFoam"]:::preprocess
    MeshDir((polyMesh\nconstant/polyMesh)):::data
    click MeshDir "https://github.com/x7z9/flow-over-cylinder/tree/main/constant/polyMesh"
    Transport((transportProperties)):::data
    click Transport "https://github.com/x7z9/flow-over-cylinder/tree/main/constant/transportProperties"
    Turbulence((turbulenceProperties)):::data
    click Turbulence "https://github.com/x7z9/flow-over-cylinder/tree/main/constant/turbulenceProperties"
    BoundaryU["Initial Field U\n0/U"]:::data
    click BoundaryU "https://github.com/x7z9/flow-over-cylinder/tree/main/0/U"
    BoundaryP["Initial Field p\n0/p"]:::data
    click BoundaryP "https://github.com/x7z9/flow-over-cylinder/tree/main/0/p"
    Check["Mesh Check & Topology\ncheckMesh & topoSet"]:::preprocess

    %% Solver Configuration
    Control((controlDict)):::data
    click Control "https://github.com/x7z9/flow-over-cylinder/tree/main/system/controlDict"
    Schemes((fvSchemes)):::data
    click Schemes "https://github.com/x7z9/flow-over-cylinder/tree/main/system/fvSchemes"
    Solution((fvSolution)):::data
    click Solution "https://github.com/x7z9/flow-over-cylinder/tree/main/system/fvSolution"
    DecomposeDict((decomposeParDict)):::data
    click DecomposeDict "https://github.com/x7z9/flow-over-cylinder/tree/main/system/decomposeParDict"

    %% Solver Execution
    SerialSolver["Serial Solver\npisoFoam"]:::solver
    ParallelDecompose["Decompose Case\nreconstructPar"]:::solver
    MPI["Parallel Solver\nmpirun -np 8 pisoFoam"]:::solver

    %% Post-processing
    Reconstruct["Reconstruct\nreconstructPar"]:::postprocess
    PostVort["Vorticity Post-Process\npostProcess -func vorticity"]:::postprocess
    VortField["Vorticity Field\n0/vorticity"]:::data
    click VortField "https://github.com/x7z9/flow-over-cylinder/tree/main/0/vorticity"

    %% Visualization
    Viz["Visualization\nparaFoam"]:::visualize

    %% Documentation
    README["README.md"]:::doc
    click README "https://github.com/x7z9/flow-over-cylinder/blob/main/README.md"
    License["LICENSE.txt"]:::doc
    click License "https://github.com/x7z9/flow-over-cylinder/blob/main/LICENSE.txt"

    %% Connections
    MeshGen -->|"34x18.msh"| Converter
    Converter -->|"OpenFOAM mesh"| MeshDir
    MeshDir --> BoundaryU
    MeshDir --> BoundaryP
    MeshDir --> Transport
    MeshDir --> Turbulence
    MeshDir --> Check

    Check --> SerialSolver
    Check --> DecomposeDict
    DecomposeDict --> ParallelDecompose
    ParallelDecompose --> MPI

    Control --> SerialSolver
    Schemes --> SerialSolver
    Solution --> SerialSolver

    Control --> MPI
    Schemes --> MPI
    Solution --> MPI

    MPI --> Reconstruct
    SerialSolver --> Reconstruct
    Reconstruct --> PostVort
    PostVort --> VortField
    VortField --> Viz

    README --> MeshGen
    License --> MeshGen

    %% Styles
    classDef preprocess fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef solver fill:#d4edda,stroke:#333,stroke-width:1px
    classDef postprocess fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef visualize fill:#e5ccff,stroke:#333,stroke-width:1px
    classDef data fill:#f0f0f0,stroke:#333,stroke-width:1px
    classDef doc fill:#f8f9fa,stroke:#333,stroke-width:1px
```
