# qyx268/meraxes-devs architecture

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

- Interactive diagram: https://gitdiagram.com/qyx268/meraxes-devs
- Repository: https://github.com/qyx268/meraxes-devs

## Overview

Meraxes is a semi-analytic galaxy-formation and reionization simulation. Its principal workflow loads halo trees and simulation grids, evolves galaxy populations through physical models, computes reionization and related observables, and saves simulation products for analysis. The graph also shows the documented AGN and minihalo capabilities and the Python result-analysis tools. Some implementation wiring is inferred from module responsibilities and paths; sampled excerpts directly confirm reionization’s bubble-finding call and analysis reads of saved data.

Main entry points: [`src/core/meraxes.c`](https://github.com/qyx268/meraxes-devs/blob/master/src/core/meraxes.c) (Meraxes runner), [`src/physics/evolve.c`](https://github.com/qyx268/meraxes-devs/blob/master/src/physics/evolve.c) (Galaxy evolution), [`src/core/save.c`](https://github.com/qyx268/meraxes-devs/blob/master/src/core/save.c) (Simulation results), [`src/core/reionization.c`](https://github.com/qyx268/meraxes-devs/blob/master/src/core/reionization.c) (Reionization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Simulation inputs"]
  node_halo_data["Halo trees"]
  node_grid_data["Simulation grids"]
  node_halo_reader["Halo readers<br/>[read_halos.c]"]
  node_grid_reader["Grid readers<br/>[read_grids.c]"]
end

subgraph group_model["Galaxy evolution"]
  node_entry["Meraxes runner<br/>[meraxes.c]"]
  node_initialization["Initialization<br/>[init.c]"]
  node_evolution["Galaxy evolution<br/>[evolve.c]"]
  node_infall["Gas infall<br/>[infall.c]"]
  node_starformation["Star formation<br/>[star_formation.c]"]
  node_feedback["Stellar feedback"]
  node_agn["AGN feedback"]
  node_mergers["Galaxy mergers<br/>[mergers.c]"]
end

subgraph group_observables["Reionization observables"]
  node_reionization["Reionization<br/>[reionization.c]"]
  node_bubble_finding["Ionized bubbles<br/>[find_HII_bubbles.c]"]
  node_brightness["21cm brightness"]
  node_power_spectrum["Power spectrum"]
  node_lightcone["Lightcone builder"]
end

subgraph group_analysis["Saved results analysis"]
  node_saved_results[("Simulation results<br/>[save.c]")]
  node_result_tools["Result analyses"]
  node_merger_plot["Merger-tree plot<br/>[merger_tree.py]"]
  node_slice_plot["Grid-slice plot<br/>[show_xH_slice.py]"]
  node_diagnostics["Model diagnostics"]
end

node_researcher(("Researcher"))

node_researcher -->|"runs simulation"| node_entry
node_halo_data -->|"provides trees"| node_halo_reader
node_grid_data -->|"provides grids"| node_grid_reader
node_entry -->|"initializes"| node_initialization
node_entry -->|"loads halos"| node_halo_reader
node_entry -->|"loads grids"| node_grid_reader
node_entry -->|"advances model"| node_evolution
node_evolution -->|"models infall"| node_infall
node_evolution -->|"models star formation"| node_starformation
node_evolution -->|"models supernova feedback"| node_feedback
node_evolution -.->|"models black holes"| node_agn
node_evolution -->|"processes mergers"| node_mergers
node_entry -->|"computes reionization"| node_reionization
node_reionization -->|"finds bubbles"| node_bubble_finding
node_entry -->|"computes brightness"| node_brightness
node_entry -->|"computes spectrum"| node_power_spectrum
node_entry -->|"constructs lightcone"| node_lightcone
node_entry -->|"saves products"| node_saved_results
node_saved_results -->|"read results"| node_result_tools
node_saved_results -->|"reads tree data"| node_merger_plot
node_saved_results -->|"reads grid data"| node_slice_plot
node_saved_results -->|"reads results"| node_diagnostics
node_researcher -->|"analyzes outputs"| node_result_tools

click node_halo_reader "https://github.com/qyx268/meraxes-devs/blob/master/src/core/read_halos.c"
click node_grid_reader "https://github.com/qyx268/meraxes-devs/blob/master/src/core/read_grids.c"
click node_entry "https://github.com/qyx268/meraxes-devs/blob/master/src/core/meraxes.c"
click node_initialization "https://github.com/qyx268/meraxes-devs/blob/master/src/core/init.c"
click node_evolution "https://github.com/qyx268/meraxes-devs/blob/master/src/physics/evolve.c"
click node_infall "https://github.com/qyx268/meraxes-devs/blob/master/src/physics/infall.c"
click node_starformation "https://github.com/qyx268/meraxes-devs/blob/master/src/physics/star_formation.c"
click node_feedback "https://github.com/qyx268/meraxes-devs/blob/master/src/physics/supernova_feedback.c"
click node_agn "https://github.com/qyx268/meraxes-devs/blob/master/src/physics/blackhole_feedback.c"
click node_mergers "https://github.com/qyx268/meraxes-devs/blob/master/src/physics/mergers.c"
click node_reionization "https://github.com/qyx268/meraxes-devs/blob/master/src/core/reionization.c"
click node_bubble_finding "https://github.com/qyx268/meraxes-devs/blob/master/src/core/find_HII_bubbles.c"
click node_brightness "https://github.com/qyx268/meraxes-devs/blob/master/src/core/BrightnessTemperature.c"
click node_power_spectrum "https://github.com/qyx268/meraxes-devs/blob/master/src/core/ComputePowerSpectrum.c"
click node_lightcone "https://github.com/qyx268/meraxes-devs/blob/master/src/core/ConstructLightcone.c"
click node_saved_results "https://github.com/qyx268/meraxes-devs/blob/master/src/core/save.c"
click node_result_tools "https://github.com/qyx268/meraxes-devs/tree/master/output/results"
click node_merger_plot "https://github.com/qyx268/meraxes-devs/blob/master/output/merger_tree.py"
click node_slice_plot "https://github.com/qyx268/meraxes-devs/blob/master/output/show_xH_slice.py"
click node_diagnostics "https://github.com/qyx268/meraxes-devs/tree/master/output/results/diagnostics"

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_halo_data,node_grid_data,node_halo_reader,node_grid_reader toneBlue
class node_entry,node_initialization,node_evolution,node_infall,node_starformation,node_feedback,node_agn,node_mergers toneAmber
class node_reionization,node_bubble_finding,node_brightness,node_power_spectrum,node_lightcone toneMint
class node_saved_results,node_result_tools,node_merger_plot,node_slice_plot,node_diagnostics toneRose
class node_researcher toneIndigo
```

## Components

### Simulation inputs

- **Halo trees**
- **Simulation grids**
- [Halo readers](https://github.com/qyx268/meraxes-devs/blob/master/src/core/read_halos.c): `src/core/read_halos.c`
- [Grid readers](https://github.com/qyx268/meraxes-devs/blob/master/src/core/read_grids.c): `src/core/read_grids.c`

### Galaxy evolution

- [Meraxes runner](https://github.com/qyx268/meraxes-devs/blob/master/src/core/meraxes.c): `src/core/meraxes.c`
- [Initialization](https://github.com/qyx268/meraxes-devs/blob/master/src/core/init.c): `src/core/init.c`
- [Galaxy evolution](https://github.com/qyx268/meraxes-devs/blob/master/src/physics/evolve.c): `src/physics/evolve.c`
- [Gas infall](https://github.com/qyx268/meraxes-devs/blob/master/src/physics/infall.c): `src/physics/infall.c`
- [Star formation](https://github.com/qyx268/meraxes-devs/blob/master/src/physics/star_formation.c): `src/physics/star_formation.c`
- [Stellar feedback](https://github.com/qyx268/meraxes-devs/blob/master/src/physics/supernova_feedback.c): `src/physics/supernova_feedback.c`
- [AGN feedback](https://github.com/qyx268/meraxes-devs/blob/master/src/physics/blackhole_feedback.c): `src/physics/blackhole_feedback.c`
- [Galaxy mergers](https://github.com/qyx268/meraxes-devs/blob/master/src/physics/mergers.c): `src/physics/mergers.c`

### Reionization observables

- [Reionization](https://github.com/qyx268/meraxes-devs/blob/master/src/core/reionization.c): `src/core/reionization.c`
- [Ionized bubbles](https://github.com/qyx268/meraxes-devs/blob/master/src/core/find_HII_bubbles.c): `src/core/find_HII_bubbles.c`
- [21cm brightness](https://github.com/qyx268/meraxes-devs/blob/master/src/core/BrightnessTemperature.c): `src/core/BrightnessTemperature.c`
- [Power spectrum](https://github.com/qyx268/meraxes-devs/blob/master/src/core/ComputePowerSpectrum.c): `src/core/ComputePowerSpectrum.c`
- [Lightcone builder](https://github.com/qyx268/meraxes-devs/blob/master/src/core/ConstructLightcone.c): `src/core/ConstructLightcone.c`

### Saved results analysis

- [Simulation results](https://github.com/qyx268/meraxes-devs/blob/master/src/core/save.c): `src/core/save.c`
- [Result analyses](https://github.com/qyx268/meraxes-devs/tree/master/output/results): `output/results`
- [Merger-tree plot](https://github.com/qyx268/meraxes-devs/blob/master/output/merger_tree.py): `output/merger_tree.py`
- [Grid-slice plot](https://github.com/qyx268/meraxes-devs/blob/master/output/show_xH_slice.py): `output/show_xH_slice.py`
- [Model diagnostics](https://github.com/qyx268/meraxes-devs/tree/master/output/results/diagnostics): `output/results/diagnostics`

### Other components

- **Researcher**

## Connections

- Researcher → Meraxes runner: runs simulation
- Halo trees → Halo readers: provides trees
- Simulation grids → Grid readers: provides grids
- Meraxes runner → Initialization: initializes
- Meraxes runner → Halo readers: loads halos
- Meraxes runner → Grid readers: loads grids
- Meraxes runner → Galaxy evolution: advances model
- Galaxy evolution → Gas infall: models infall
- Galaxy evolution → Star formation: models star formation
- Galaxy evolution → Stellar feedback: models supernova feedback
- Galaxy evolution → AGN feedback: models black holes
- Galaxy evolution → Galaxy mergers: processes mergers
- Meraxes runner → Reionization: computes reionization
- Reionization → Ionized bubbles: finds bubbles
- Meraxes runner → 21cm brightness: computes brightness
- Meraxes runner → Power spectrum: computes spectrum
- Meraxes runner → Lightcone builder: constructs lightcone
- Meraxes runner → Simulation results: saves products
- Simulation results → Result analyses: read results
- Simulation results → Merger-tree plot: reads tree data
- Simulation results → Grid-slice plot: reads grid data
- Simulation results → Model diagnostics: reads results
- Researcher → Result analyses: analyzes outputs
