# gafusion/gacode architecture

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

- Interactive diagram: https://gitdiagram.com/gafusion/gacode
- Repository: https://github.com/gafusion/gacode

## Overview

GACODE is a suite of scientific plasma-physics codes: CGYRO and GYRO model gyrokinetic behavior, NEO models neoclassical transport, TGLF provides a transport model, and TGYRO evolves profiles. A typical user prepares code inputs, runs a physics code, then examines its outputs with Python readers and plotting tools; the README documents the codes, while the supplied excerpts mainly show input handling and analysis rather than the simulation engines. The graph also includes profile-generation tools and XGYRO’s multi-directory setup. Edges are limited to excerpted references, visible calls, or README statements; unsampled engine links are not inferred.

Main entry points: [`tglf/bin/gacodeinput.py`](https://github.com/gafusion/gacode/blob/master/tglf/bin/gacodeinput.py) (Shared input parser), [`f2py/pygacode/gacodefuncs.py`](https://github.com/gafusion/gacode/blob/master/f2py/pygacode/gacodefuncs.py) (Shared analysis functions), [`tglf/bin/tglf_input_gene.py`](https://github.com/gafusion/gacode/blob/master/tglf/bin/tglf_input_gene.py) (TGLF conversion), [`f2py/pygacode/tgyro/plot_notebook.py`](https://github.com/gafusion/gacode/blob/master/f2py/pygacode/tgyro/plot_notebook.py) (TGYRO notebook plots)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_physics["Physics codes"]
  node_cgyro["CGYRO simulation"]
  node_gyro["GYRO simulation"]
  node_neo["NEO simulation"]
  node_tglf["TGLF transport"]
  node_tgyro["TGYRO evolution"]
end

subgraph group_inputs["Inputs and coordination"]
  node_input_parser["Shared input parser<br/>[gacodeinput.py]"]
  node_cgyro_parse["CGYRO input<br/>[cgyro_parse.py]"]
  node_gyro_parse["GYRO input<br/>[gyro_parse.py]"]
  node_neo_parse["NEO input<br/>[neo_parse.py]"]
  node_tgyro_parse["TGYRO input<br/>[tgyro_parse.py]"]
  node_tglf_input["TGLF conversion<br/>[tglf_input_gene.py]"]
  node_xgyro["XGYRO coordination<br/>[xgyro_parse.py]"]
  node_restart_lib["Restart handling<br/>[libcgyrorestart.py]"]
  node_restart_dims["Restart dimensions"]
  node_restart_species["Restart species"]
end

subgraph group_analysis["Analysis and visualization"]
  node_cgyro_data["CGYRO data reader<br/>[data.py]"]
  node_cgyro_plot["CGYRO plotting<br/>[data_plot.py]"]
  node_gyro_data["GYRO data reader<br/>[data.py]"]
  node_gyro_plot["GYRO plotting<br/>[data_plot.py]"]
  node_neo_data["NEO data reader<br/>[data.py]"]
  node_tgyro_plot["TGYRO notebook plots<br/>[plot_notebook.py]"]
  node_shared_funcs["Shared analysis functions<br/>[gacodefuncs.py]"]
end

subgraph group_profiles["Profiles and utilities"]
  node_profile_tools["Profile generation"]
  node_profile_plot["Profile plotting<br/>[plot_profile.py]"]
end

node_user(("Researcher"))
node_outputs["Simulation outputs"]

node_user -->|"configures"| node_cgyro_parse
node_user -->|"configures"| node_gyro_parse
node_user -->|"configures"| node_neo_parse
node_user -->|"configures"| node_tgyro_parse
node_user -->|"prepares inputs"| node_tglf_input
node_cgyro_parse -.->|"uses parser"| node_input_parser
node_gyro_parse -->|"uses parser"| node_input_parser
node_neo_parse -->|"uses parser"| node_input_parser
node_tgyro_parse -->|"uses parser"| node_input_parser
node_tglf_input -->|"uses parser"| node_input_parser
node_tglf_input -->|"configures"| node_tglf
node_xgyro -->|"uses parser"| node_input_parser
node_user -->|"runs"| node_cgyro
node_user -->|"runs"| node_gyro
node_user -->|"runs"| node_neo
node_user -->|"runs"| node_tglf
node_user -->|"runs"| node_tgyro
node_cgyro -.->|"produces"| node_outputs
node_gyro -.->|"produces"| node_outputs
node_neo -.->|"produces"| node_outputs
node_outputs -.->|"reads"| node_cgyro_data
node_outputs -.->|"reads"| node_gyro_data
node_cgyro_data -->|"supplies data"| node_cgyro_plot
node_gyro_data -->|"supplies data"| node_gyro_plot
node_cgyro_plot -->|"uses helpers"| node_shared_funcs
node_gyro_plot -->|"uses helpers"| node_shared_funcs
node_tgyro_plot -->|"uses helpers"| node_shared_funcs
node_tgyro_plot -->|"reads data"| node_neo_data
node_user -->|"adjusts restart"| node_restart_dims
node_user -->|"adjusts restart"| node_restart_species
node_restart_dims -->|"uses restart API"| node_restart_lib
node_restart_species -->|"uses restart API"| node_restart_lib
node_user -->|"generates profiles"| node_profile_tools
node_profile_plot -->|"uses helpers"| node_shared_funcs

click node_cgyro "https://github.com/gafusion/gacode/tree/master/cgyro"
click node_gyro "https://github.com/gafusion/gacode/tree/master/gyro"
click node_neo "https://github.com/gafusion/gacode/tree/master/neo"
click node_tglf "https://github.com/gafusion/gacode/tree/master/tglf"
click node_tgyro "https://github.com/gafusion/gacode/tree/master/tgyro"
click node_input_parser "https://github.com/gafusion/gacode/blob/master/tglf/bin/gacodeinput.py"
click node_cgyro_parse "https://github.com/gafusion/gacode/blob/master/cgyro/bin/cgyro_parse.py"
click node_gyro_parse "https://github.com/gafusion/gacode/blob/master/gyro/bin/gyro_parse.py"
click node_neo_parse "https://github.com/gafusion/gacode/blob/master/neo/bin/neo_parse.py"
click node_tgyro_parse "https://github.com/gafusion/gacode/blob/master/tgyro/bin/tgyro_parse.py"
click node_tglf_input "https://github.com/gafusion/gacode/blob/master/tglf/bin/tglf_input_gene.py"
click node_xgyro "https://github.com/gafusion/gacode/blob/master/xgyro/bin/xgyro_parse.py"
click node_restart_lib "https://github.com/gafusion/gacode/blob/master/cgyro/bin/libcgyrorestart.py"
click node_restart_dims "https://github.com/gafusion/gacode/blob/master/cgyro/bin/restart_add_dims.py"
click node_restart_species "https://github.com/gafusion/gacode/blob/master/cgyro/bin/restart_add_species.py"
click node_cgyro_data "https://github.com/gafusion/gacode/blob/master/f2py/pygacode/cgyro/data.py"
click node_cgyro_plot "https://github.com/gafusion/gacode/blob/master/f2py/pygacode/cgyro/data_plot.py"
click node_gyro_data "https://github.com/gafusion/gacode/blob/master/f2py/pygacode/gyro/data.py"
click node_gyro_plot "https://github.com/gafusion/gacode/blob/master/f2py/pygacode/gyro/data_plot.py"
click node_neo_data "https://github.com/gafusion/gacode/blob/master/f2py/pygacode/neo/data.py"
click node_tgyro_plot "https://github.com/gafusion/gacode/blob/master/f2py/pygacode/tgyro/plot_notebook.py"
click node_shared_funcs "https://github.com/gafusion/gacode/blob/master/f2py/pygacode/gacodefuncs.py"
click node_profile_tools "https://github.com/gafusion/gacode/tree/master/profiles_gen"
click node_profile_plot "https://github.com/gafusion/gacode/blob/master/f2py/pygacode/profiles_gen/plot_profile.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_cgyro,node_gyro,node_neo,node_tglf,node_tgyro toneBlue
class node_input_parser,node_cgyro_parse,node_gyro_parse,node_neo_parse,node_tgyro_parse,node_tglf_input,node_xgyro,node_restart_lib,node_restart_dims,node_restart_species toneAmber
class node_cgyro_data,node_cgyro_plot,node_gyro_data,node_gyro_plot,node_neo_data,node_tgyro_plot,node_shared_funcs toneMint
class node_profile_tools,node_profile_plot toneRose
class node_user,node_outputs toneIndigo
```

## Components

### Physics codes

- [CGYRO simulation](https://github.com/gafusion/gacode/tree/master/cgyro): `cgyro`
- [GYRO simulation](https://github.com/gafusion/gacode/tree/master/gyro): `gyro`
- [NEO simulation](https://github.com/gafusion/gacode/tree/master/neo): `neo`
- [TGLF transport](https://github.com/gafusion/gacode/tree/master/tglf): `tglf`
- [TGYRO evolution](https://github.com/gafusion/gacode/tree/master/tgyro): `tgyro`

### Inputs and coordination

- [Shared input parser](https://github.com/gafusion/gacode/blob/master/tglf/bin/gacodeinput.py): `tglf/bin/gacodeinput.py`
- [CGYRO input](https://github.com/gafusion/gacode/blob/master/cgyro/bin/cgyro_parse.py): `cgyro/bin/cgyro_parse.py`
- [GYRO input](https://github.com/gafusion/gacode/blob/master/gyro/bin/gyro_parse.py): `gyro/bin/gyro_parse.py`
- [NEO input](https://github.com/gafusion/gacode/blob/master/neo/bin/neo_parse.py): `neo/bin/neo_parse.py`
- [TGYRO input](https://github.com/gafusion/gacode/blob/master/tgyro/bin/tgyro_parse.py): `tgyro/bin/tgyro_parse.py`
- [TGLF conversion](https://github.com/gafusion/gacode/blob/master/tglf/bin/tglf_input_gene.py): `tglf/bin/tglf_input_gene.py`
- [XGYRO coordination](https://github.com/gafusion/gacode/blob/master/xgyro/bin/xgyro_parse.py): `xgyro/bin/xgyro_parse.py`
- [Restart handling](https://github.com/gafusion/gacode/blob/master/cgyro/bin/libcgyrorestart.py): `cgyro/bin/libcgyrorestart.py`
- [Restart dimensions](https://github.com/gafusion/gacode/blob/master/cgyro/bin/restart_add_dims.py): `cgyro/bin/restart_add_dims.py`
- [Restart species](https://github.com/gafusion/gacode/blob/master/cgyro/bin/restart_add_species.py): `cgyro/bin/restart_add_species.py`

### Analysis and visualization

- [CGYRO data reader](https://github.com/gafusion/gacode/blob/master/f2py/pygacode/cgyro/data.py): `f2py/pygacode/cgyro/data.py`
- [CGYRO plotting](https://github.com/gafusion/gacode/blob/master/f2py/pygacode/cgyro/data_plot.py): `f2py/pygacode/cgyro/data_plot.py`
- [GYRO data reader](https://github.com/gafusion/gacode/blob/master/f2py/pygacode/gyro/data.py): `f2py/pygacode/gyro/data.py`
- [GYRO plotting](https://github.com/gafusion/gacode/blob/master/f2py/pygacode/gyro/data_plot.py): `f2py/pygacode/gyro/data_plot.py`
- [NEO data reader](https://github.com/gafusion/gacode/blob/master/f2py/pygacode/neo/data.py): `f2py/pygacode/neo/data.py`
- [TGYRO notebook plots](https://github.com/gafusion/gacode/blob/master/f2py/pygacode/tgyro/plot_notebook.py): `f2py/pygacode/tgyro/plot_notebook.py`
- [Shared analysis functions](https://github.com/gafusion/gacode/blob/master/f2py/pygacode/gacodefuncs.py): `f2py/pygacode/gacodefuncs.py`

### Profiles and utilities

- [Profile generation](https://github.com/gafusion/gacode/tree/master/profiles_gen): `profiles_gen`
- [Profile plotting](https://github.com/gafusion/gacode/blob/master/f2py/pygacode/profiles_gen/plot_profile.py): `f2py/pygacode/profiles_gen/plot_profile.py`

### Other components

- **Researcher**
- **Simulation outputs**

## Connections

- Researcher → CGYRO input: configures
- Researcher → GYRO input: configures (evidence: `gyro/bin/gyro_parse.py`)
- Researcher → NEO input: configures (evidence: `neo/bin/neo_parse.py`)
- Researcher → TGYRO input: configures (evidence: `tgyro/bin/tgyro_parse.py`)
- Researcher → TGLF conversion: prepares inputs (evidence: `tglf/bin/tglf_input_gene.py`)
- CGYRO input → Shared input parser: uses parser
- GYRO input → Shared input parser: uses parser (evidence: `gyro/bin/gyro_parse.py`)
- NEO input → Shared input parser: uses parser (evidence: `neo/bin/neo_parse.py`)
- TGYRO input → Shared input parser: uses parser (evidence: `tgyro/bin/tgyro_parse.py`)
- TGLF conversion → Shared input parser: uses parser (evidence: `tglf/bin/tglf_input_gene.py`)
- TGLF conversion → TGLF transport: configures (evidence: `tglf/bin/tglf_input_gene.py`)
- XGYRO coordination → Shared input parser: uses parser (evidence: `xgyro/bin/xgyro_parse.py`)
- Researcher → CGYRO simulation: runs
- Researcher → GYRO simulation: runs
- Researcher → NEO simulation: runs
- Researcher → TGLF transport: runs
- Researcher → TGYRO evolution: runs
- CGYRO simulation → Simulation outputs: produces
- GYRO simulation → Simulation outputs: produces
- NEO simulation → Simulation outputs: produces
- Simulation outputs → CGYRO data reader: reads
- Simulation outputs → GYRO data reader: reads
- CGYRO data reader → CGYRO plotting: supplies data (evidence: `f2py/pygacode/cgyro/data_plot.py`)
- GYRO data reader → GYRO plotting: supplies data (evidence: `f2py/pygacode/gyro/data_plot.py`)
- CGYRO plotting → Shared analysis functions: uses helpers (evidence: `f2py/pygacode/cgyro/data_plot.py`)
- GYRO plotting → Shared analysis functions: uses helpers (evidence: `f2py/pygacode/gyro/data_plot.py`)
- TGYRO notebook plots → Shared analysis functions: uses helpers (evidence: `f2py/pygacode/tgyro/plot_notebook.py`)
- TGYRO notebook plots → NEO data reader: reads data (evidence: `f2py/pygacode/tgyro/plot_notebook.py`)
- Researcher → Restart dimensions: adjusts restart (evidence: `cgyro/bin/restart_add_dims.py`)
- Researcher → Restart species: adjusts restart (evidence: `cgyro/bin/restart_add_species.py`)
- Restart dimensions → Restart handling: uses restart API (evidence: `cgyro/bin/restart_add_dims.py`)
- Restart species → Restart handling: uses restart API (evidence: `cgyro/bin/restart_add_species.py`)
- Researcher → Profile generation: generates profiles
- Profile plotting → Shared analysis functions: uses helpers
