# howardho-cfd/collocated_simple architecture

> Architecture diagram of the GitHub repository howardho-cfd/collocated_simple, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/howardho-cfd/collocated_simple
- Repository: https://github.com/howardho-cfd/collocated_simple

## Overview

This repository is a Python implementation of the SIMPLE algorithm for a lid-driven cavity flow, with a central-difference momentum solver. The principal workflow in `simple.py` initializes a uniform mesh, boundary conditions, and flow fields; iterates momentum and pressure-correction solves and field corrections until a pressure-correction threshold is met; then plots the results. The graph distinguishes orchestration, discretization and solving, and visualization. Edges are based on the shown `simple.py` and `functions.py` excerpts and the README; unsampled code is not used to infer additional links.

Main entry points: [`simple.py`](https://github.com/howardho-cfd/collocated_simple/blob/main/simple.py) (SIMPLE iteration), [`functions.py`](https://github.com/howardho-cfd/collocated_simple/blob/main/functions.py) (Velocity solve wrappers), [`class_mods/solver.py`](https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/solver.py) (Sparse linear solver), [`class_mods/pre_processing.py`](https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/pre_processing.py) (Uniform mesh)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Simulation workflow"]
  node_driver["SIMPLE iteration<br/>[simple.py]"]
  node_mesh["Uniform mesh<br/>[pre_processing.py]"]
  node_fields["Initial velocity fields<br/>[pre_processing.py]"]
  node_coordinates["Cell-center coordinates<br/>[functions.py]"]
  node_meshdata["Mesh data<br/>[storage.py]"]
  node_boundarydata["Boundary data<br/>[storage.py]"]
end

subgraph group_numerics["Numerical methods"]
  node_flux["Face fluxes<br/>[functions.py]"]
  node_momentum["Momentum assembly<br/>[u_solver.py]"]
  node_pressure["Pressure correction assembly<br/>[p_solver.py]"]
  node_linear["Sparse linear solver<br/>[solver.py]"]
  node_velocitysolve["Velocity solve wrappers<br/>[functions.py]"]
  node_pressuresolve["Pressure solve wrapper<br/>[functions.py]"]
  node_correction["Field correction<br/>[functions.py]"]
  node_pressurefaces["Pressure face values<br/>[functions.py]"]
end

subgraph group_results["Results and plotting"]
  node_postproc["Plotting<br/>[post_processing.py]"]
end

node_user(("Engineer"))

node_user -->|"runs"| node_driver
node_driver -->|"creates"| node_mesh
node_driver -->|"stores mesh"| node_meshdata
node_driver -->|"sets boundaries"| node_boundarydata
node_driver -->|"initializes"| node_fields
node_driver -->|"computes"| node_coordinates
node_driver -->|"updates fluxes"| node_flux
node_driver -->|"solves velocity"| node_velocitysolve
node_velocitysolve -->|"assembles"| node_momentum
node_driver -->|"solves correction"| node_pressuresolve
node_pressuresolve -->|"assembles"| node_pressure
node_velocitysolve -->|"solves system"| node_linear
node_pressuresolve -->|"solves system"| node_linear
node_driver -->|"corrects fields"| node_correction
node_driver -->|"updates faces"| node_pressurefaces
node_driver -->|"plots results"| node_postproc

click node_driver "https://github.com/howardho-cfd/collocated_simple/blob/main/simple.py"
click node_mesh "https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/pre_processing.py"
click node_fields "https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/pre_processing.py"
click node_coordinates "https://github.com/howardho-cfd/collocated_simple/blob/main/functions.py"
click node_meshdata "https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/storage.py"
click node_boundarydata "https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/storage.py"
click node_flux "https://github.com/howardho-cfd/collocated_simple/blob/main/functions.py"
click node_momentum "https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/u_solver.py"
click node_pressure "https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/p_solver.py"
click node_linear "https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/solver.py"
click node_velocitysolve "https://github.com/howardho-cfd/collocated_simple/blob/main/functions.py"
click node_pressuresolve "https://github.com/howardho-cfd/collocated_simple/blob/main/functions.py"
click node_correction "https://github.com/howardho-cfd/collocated_simple/blob/main/functions.py"
click node_pressurefaces "https://github.com/howardho-cfd/collocated_simple/blob/main/functions.py"
click node_postproc "https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/post_processing.py"

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_driver,node_mesh,node_fields,node_coordinates,node_meshdata,node_boundarydata toneBlue
class node_flux,node_momentum,node_pressure,node_linear,node_velocitysolve,node_pressuresolve,node_correction,node_pressurefaces toneAmber
class node_postproc toneMint
class node_user toneIndigo
```

## Components

### Simulation workflow

- [SIMPLE iteration](https://github.com/howardho-cfd/collocated_simple/blob/main/simple.py): `simple.py`
- [Uniform mesh](https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/pre_processing.py): `class_mods/pre_processing.py`
- [Initial velocity fields](https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/pre_processing.py): `class_mods/pre_processing.py`
- [Cell-center coordinates](https://github.com/howardho-cfd/collocated_simple/blob/main/functions.py): `functions.py`
- [Mesh data](https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/storage.py): `class_mods/storage.py`
- [Boundary data](https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/storage.py): `class_mods/storage.py`

### Numerical methods

- [Face fluxes](https://github.com/howardho-cfd/collocated_simple/blob/main/functions.py): `functions.py`
- [Momentum assembly](https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/u_solver.py): `class_mods/u_solver.py`
- [Pressure correction assembly](https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/p_solver.py): `class_mods/p_solver.py`
- [Sparse linear solver](https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/solver.py): `class_mods/solver.py`
- [Velocity solve wrappers](https://github.com/howardho-cfd/collocated_simple/blob/main/functions.py): `functions.py`
- [Pressure solve wrapper](https://github.com/howardho-cfd/collocated_simple/blob/main/functions.py): `functions.py`
- [Field correction](https://github.com/howardho-cfd/collocated_simple/blob/main/functions.py): `functions.py`
- [Pressure face values](https://github.com/howardho-cfd/collocated_simple/blob/main/functions.py): `functions.py`

### Results and plotting

- [Plotting](https://github.com/howardho-cfd/collocated_simple/blob/main/class_mods/post_processing.py): `class_mods/post_processing.py`

### Other components

- **Engineer**

## Connections

- Engineer → SIMPLE iteration: runs (evidence: `README.md`)
- SIMPLE iteration → Uniform mesh: creates (evidence: `simple.py`)
- SIMPLE iteration → Mesh data: stores mesh (evidence: `simple.py`)
- SIMPLE iteration → Boundary data: sets boundaries (evidence: `simple.py`)
- SIMPLE iteration → Initial velocity fields: initializes (evidence: `simple.py`)
- SIMPLE iteration → Cell-center coordinates: computes (evidence: `simple.py`)
- SIMPLE iteration → Face fluxes: updates fluxes (evidence: `simple.py`)
- SIMPLE iteration → Velocity solve wrappers: solves velocity (evidence: `simple.py`)
- Velocity solve wrappers → Momentum assembly: assembles (evidence: `functions.py`)
- SIMPLE iteration → Pressure solve wrapper: solves correction (evidence: `simple.py`)
- Pressure solve wrapper → Pressure correction assembly: assembles (evidence: `functions.py`)
- Velocity solve wrappers → Sparse linear solver: solves system (evidence: `functions.py`)
- Pressure solve wrapper → Sparse linear solver: solves system (evidence: `functions.py`)
- SIMPLE iteration → Field correction: corrects fields (evidence: `simple.py`)
- SIMPLE iteration → Pressure face values: updates faces (evidence: `simple.py`)
- SIMPLE iteration → Plotting: plots results (evidence: `simple.py`)
