# sardakius/solar-thermodynamics architecture

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

- Interactive diagram: https://gitdiagram.com/sardakius/solar-thermodynamics
- Repository: https://github.com/sardakius/solar-thermodynamics

## Overview

Solar Thermodynamics simulates solar structure with Eddington Euler/RK4 methods and a standard solar model, exports shell profiles, and provides profile plots plus an interactive, property-colored solar cross-section. The main program owns simulation dispatch and CSV export; the Sun model owns numerical updates and calls the physics equations. The reader loads the exported datasets, uses shared utilities for plotting and argument selection, and renders the cross-section. The README documents the visualization options; unsampled profile assets are represented by their existing directory.

Main entry points: [`data/data_reader.py`](https://github.com/sardakius/solar-thermodynamics/blob/main/data/data_reader.py) (Data reader), [`src/main.cpp`](https://github.com/sardakius/solar-thermodynamics/blob/main/src/main.cpp) (Simulation entry), [`src/sun.cpp`](https://github.com/sardakius/solar-thermodynamics/blob/main/src/sun.cpp) (Sun models), [`data/data_reader_util.py`](https://github.com/sardakius/solar-thermodynamics/blob/main/data/data_reader_util.py) (Reader utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Solar simulation"]
  node_entry["Simulation entry<br/>[main.cpp]"]
  node_sun["Sun models<br/>[sun.cpp]"]
  node_physics["Physics equations<br/>[physics.c]"]
  node_shell["Shell state<br/>[shell.h]"]
  node_constants["Model constants<br/>[constants.h]"]
end

subgraph group_data["Profile data"]
  node_euler["Euler dataset<br/>[data_euler.csv]"]
  node_rk4["RK4 dataset<br/>[data_rk4.csv]"]
  node_ssm["SSM dataset<br/>[data_ssm.csv]"]
end

subgraph group_visualization["Visualization"]
  node_reader["Data reader<br/>[data_reader.py]"]
  node_readerutil["Reader utilities"]
  node_plots["Profile plots"]
  node_crosssection["Solar cross-section<br/>[data_reader.py]"]
end

node_user(("User"))

node_entry -->|"runs models"| node_sun
node_sun -->|"calls equations"| node_physics
node_sun -->|"updates shells"| node_shell
node_sun -->|"uses parameters"| node_constants
node_entry -->|"writes CSV"| node_euler
node_entry -->|"writes CSV"| node_rk4
node_entry -->|"writes CSV"| node_ssm
node_reader -->|"reads CSV"| node_euler
node_reader -->|"reads CSV"| node_rk4
node_reader -->|"reads CSV"| node_ssm
node_reader -->|"uses helpers"| node_readerutil
node_reader -->|"saves profiles"| node_plots
node_reader -->|"renders view"| node_crosssection
node_readerutil -->|"saves plots"| node_plots

click node_entry "https://github.com/sardakius/solar-thermodynamics/blob/main/src/main.cpp"
click node_sun "https://github.com/sardakius/solar-thermodynamics/blob/main/src/sun.cpp"
click node_physics "https://github.com/sardakius/solar-thermodynamics/blob/main/src/physics.c"
click node_shell "https://github.com/sardakius/solar-thermodynamics/blob/main/include/simulation/shell.h"
click node_constants "https://github.com/sardakius/solar-thermodynamics/blob/main/include/constants.h"
click node_euler "https://github.com/sardakius/solar-thermodynamics/blob/main/data/data_euler.csv"
click node_rk4 "https://github.com/sardakius/solar-thermodynamics/blob/main/data/data_rk4.csv"
click node_ssm "https://github.com/sardakius/solar-thermodynamics/blob/main/data/data_ssm.csv"
click node_reader "https://github.com/sardakius/solar-thermodynamics/blob/main/data/data_reader.py"
click node_readerutil "https://github.com/sardakius/solar-thermodynamics/blob/main/data/data_reader_util.py"
click node_plots "https://github.com/sardakius/solar-thermodynamics/tree/main/data/profiles"
click node_crosssection "https://github.com/sardakius/solar-thermodynamics/blob/main/data/data_reader.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_entry,node_sun,node_physics,node_shell,node_constants,node_user toneBlue
class node_euler,node_rk4,node_ssm toneAmber
class node_reader,node_readerutil,node_plots,node_crosssection toneMint
```

## Components

### Solar simulation

- [Simulation entry](https://github.com/sardakius/solar-thermodynamics/blob/main/src/main.cpp): `src/main.cpp`
- [Sun models](https://github.com/sardakius/solar-thermodynamics/blob/main/src/sun.cpp): `src/sun.cpp`
- [Physics equations](https://github.com/sardakius/solar-thermodynamics/blob/main/src/physics.c): `src/physics.c`
- [Shell state](https://github.com/sardakius/solar-thermodynamics/blob/main/include/simulation/shell.h): `include/simulation/shell.h`
- [Model constants](https://github.com/sardakius/solar-thermodynamics/blob/main/include/constants.h): `include/constants.h`

### Profile data

- [Euler dataset](https://github.com/sardakius/solar-thermodynamics/blob/main/data/data_euler.csv): `data/data_euler.csv`
- [RK4 dataset](https://github.com/sardakius/solar-thermodynamics/blob/main/data/data_rk4.csv): `data/data_rk4.csv`
- [SSM dataset](https://github.com/sardakius/solar-thermodynamics/blob/main/data/data_ssm.csv): `data/data_ssm.csv`

### Visualization

- [Data reader](https://github.com/sardakius/solar-thermodynamics/blob/main/data/data_reader.py): `data/data_reader.py`
- [Reader utilities](https://github.com/sardakius/solar-thermodynamics/blob/main/data/data_reader_util.py): `data/data_reader_util.py`
- [Profile plots](https://github.com/sardakius/solar-thermodynamics/tree/main/data/profiles): `data/profiles`
- [Solar cross-section](https://github.com/sardakius/solar-thermodynamics/blob/main/data/data_reader.py): `data/data_reader.py`

### Other components

- **User**

## Connections

- Simulation entry → Sun models: runs models (evidence: `src/main.cpp`)
- Sun models → Physics equations: calls equations (evidence: `src/sun.cpp`)
- Sun models → Shell state: updates shells (evidence: `src/sun.cpp`)
- Sun models → Model constants: uses parameters (evidence: `src/sun.cpp`)
- Simulation entry → Euler dataset: writes CSV (evidence: `src/main.cpp`)
- Simulation entry → RK4 dataset: writes CSV (evidence: `src/main.cpp`)
- Simulation entry → SSM dataset: writes CSV (evidence: `src/main.cpp`)
- Data reader → Euler dataset: reads CSV (evidence: `data/data_reader.py`)
- Data reader → RK4 dataset: reads CSV (evidence: `data/data_reader.py`)
- Data reader → SSM dataset: reads CSV (evidence: `data/data_reader.py`)
- Data reader → Reader utilities: uses helpers (evidence: `data/data_reader.py`)
- Data reader → Profile plots: saves profiles (evidence: `data/data_reader.py`)
- Data reader → Solar cross-section: renders view (evidence: `data/data_reader.py`)
- Reader utilities → Profile plots: saves plots (evidence: `data/data_reader_util.py`)
