How achael/koral_lite works
Project type and purpose
• Koral_lite is a high-performance scientific simulation code for two-temperature, radiative general relativistic magnetohydrodynamics (GRMHD).
• Written in C, it uses MPI for parallelization, HDF5/SILO for I/O, and reads precomputed opacity tables.
File structure
• Top-level C sources implement core functionality:
• problem.c/h – problem definitions & dispatch
• finite.c, metric.c, physics.c, nonthermal.c, opacities.c – numerical & physics modules
• mpi.c – parallel decomposition & communication
• fileop.c, silo.c, dumps2hdf5.c, hdf52dumps.c – output drivers
• postproc.c, avg.c, outavg.c, frames.c, regrid.c – postprocessing & grid management
• utility scripts mpar.sh, mser.sh – job submission wrappers
• OPACITIES directory holds data tables (CHIANTI, Sutherland_Dopita_1993) consumed by the opacity module.
• PROBLEMS directory contains legacy problem setups (initial condition codelets), most removed or deprecated.
• Makefile orchestrates the build; LICENSE & .gitignore are ancillary.
README for additional insights
• “Lighter” version of KORAL, older problem definitions not tested.
• Core code focuses on a time-stepping loop for GRMHD with radiation, two fluid temperatures.
Elements
• Clear labels for each component block (Input, Physics, Solver, I/O, Postproc, Data).
• Config → Init → Solver Core
• Solver Core ↔ MPI Communication
• Solver Core → I/O Subsystem → Filesystem
• External Tables → Opacity Module
• I/O Files → Postprocessing Tools
• Blue rectangles for compute modules (Solver, Physics),
• Green for I/O (HDF5/SILO),
• Orange for data (OPACITIES),
• Diamond for control flow start/end,
Detailed flow chart of koral_lite
• Start (parameter & script invocation)
↓
• Read parameters & select problem (problem.c)
↓
• Load external tables (opacities.c reads OPACITIES/*)
↓
• Initialize grid & metric (regrid.c, metric.c)
↓
• Initialize physical fields (problem-specific init.c)
↓
• Enter time-stepping loop:
• Compute fluxes (finite.c, phiavg.c, phisli.c)
• Apply source terms (physics.c, nonthermal.c)
• MPI halo exchange (mpi.c)
• Update conserved variables (u2p.c, p2u.c, u2prad.c)
• Every N steps: invoke I/O
– dumps2hdf5.c → HDF5 file
– silo.c → SILO file
– fileop.c → ASCII dumps
• Check for end time or stopping criteria
↓
• Exit loop, finalize (close files, MPI_Finalize)
↓
• Optionally run postprocessing (postproc.c, avg.c, frames.c)
↓
• End