# masaru-kogure/raytracing architecture

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

- Interactive diagram: https://gitdiagram.com/masaru-kogure/raytracing
- Repository: https://github.com/masaru-kogure/raytracing

## Overview

This repository is a scientific gravity-wave ray-tracing program. A researcher configures a case in the main script; it reads atmospheric fields, computes derived fields, integrates the ray path with RK4, evaluates instability diagnostics, and saves numerical and quicklook outputs. The main script’s imports and calls support the central links. The README is empty, and the plot_ql.py excerpt is GitHub HTML rather than module code, so plotting details and some internal wiring cannot be verified.

Main entry points: [`main_raytracing_rv2.py`](https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/main_raytracing_rv2.py) (Case runner), [`runge_kutta4_v2.py`](https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/runge_kutta4_v2.py) (RK4 integrator), [`meteo_para_v3.py`](https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/meteo_para_v3.py) (Meteorological parameters), [`derivation_v2.py`](https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/derivation_v2.py) (Numerical derivatives)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Ray workflow"]
  node_case_runner["Case runner"]
  node_jawara_data[("JAWARA NetCDF")]
  node_ray_integrator["RK4 integrator<br/>[runge_kutta4_v2.py]"]
  node_instability["Instability diagnostics<br/>[runge_kutta4_v2.py]"]
end

subgraph group_physics["Atmospheric physics"]
  node_meteo["Meteorological parameters<br/>[meteo_para_v3.py]"]
  node_derivatives["Numerical derivatives<br/>[derivation_v2.py]"]
  node_spectral_kernels["Spectral kernels<br/>[kernel_box.py]"]
end

subgraph group_outputs["Outputs and diagnostics"]
  node_ray_data["Ray data output"]
  node_quicklook["Quicklook plots<br/>[plot_ql.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"runs case"| node_case_runner
node_jawara_data -->|"provides fields"| node_case_runner
node_case_runner -->|"integrates rays"| node_ray_integrator
node_ray_integrator -->|"computes parameters"| node_meteo
node_case_runner -->|"builds window"| node_spectral_kernels
node_case_runner -.->|"uses derivatives"| node_derivatives
node_case_runner -->|"evaluates stability"| node_instability
node_case_runner -->|"saves arrays"| node_ray_data
node_case_runner -->|"creates quicklook"| node_quicklook

click node_case_runner "https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/main_raytracing_rv2.py"
click node_ray_integrator "https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/runge_kutta4_v2.py"
click node_meteo "https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/meteo_para_v3.py"
click node_derivatives "https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/derivation_v2.py"
click node_spectral_kernels "https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/kernel_box.py"
click node_instability "https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/runge_kutta4_v2.py"
click node_ray_data "https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/main_raytracing_rv2.py"
click node_quicklook "https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/plot_ql.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_case_runner,node_jawara_data,node_ray_integrator,node_instability toneBlue
class node_meteo,node_derivatives,node_spectral_kernels toneAmber
class node_ray_data,node_quicklook toneMint
class node_researcher toneIndigo
```

## Components

### Ray workflow

- [Case runner](https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/main_raytracing_rv2.py): `main_raytracing_rv2.py`
- **JAWARA NetCDF**
- [RK4 integrator](https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/runge_kutta4_v2.py): `runge_kutta4_v2.py`
- [Instability diagnostics](https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/runge_kutta4_v2.py): `runge_kutta4_v2.py`

### Atmospheric physics

- [Meteorological parameters](https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/meteo_para_v3.py): `meteo_para_v3.py`
- [Numerical derivatives](https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/derivation_v2.py): `derivation_v2.py`
- [Spectral kernels](https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/kernel_box.py): `kernel_box.py`

### Outputs and diagnostics

- [Ray data output](https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/main_raytracing_rv2.py): `main_raytracing_rv2.py`
- [Quicklook plots](https://github.com/masaru-kogure/raytracing/blob/main-upload-clean/plot_ql.py): `plot_ql.py`

### Other components

- **Researcher**

## Connections

- Researcher → Case runner: runs case (evidence: `main_raytracing_rv2.py`)
- JAWARA NetCDF → Case runner: provides fields (evidence: `main_raytracing_rv2.py`)
- Case runner → RK4 integrator: integrates rays (evidence: `main_raytracing_rv2.py`)
- RK4 integrator → Meteorological parameters: computes parameters (evidence: `runge_kutta4_v2.py`)
- Case runner → Spectral kernels: builds window (evidence: `main_raytracing_rv2.py`)
- Case runner → Numerical derivatives: uses derivatives (evidence: `main_raytracing_rv2.py`)
- Case runner → Instability diagnostics: evaluates stability (evidence: `main_raytracing_rv2.py`)
- Case runner → Ray data output: saves arrays (evidence: `main_raytracing_rv2.py`)
- Case runner → Quicklook plots: creates quicklook (evidence: `main_raytracing_rv2.py`)
