How afd-illinois/ebhlight works
Project Type and Purpose
• This is a high-performance scientific simulation code (“EBHLIGHT/BHLIGHT”) for general relativistic radiation magnetohydrodynamics (GRRMHD) using Monte Carlo radiation transport.
• Core is written in C99 with MPI/HDF5 parallel I/O; Python 3.6 is used for build configuration, machine-specific setup, analysis, and testing.
File-Structure Analysis
• Top-level:
• core/ – Simulation engine: physics modules (metric, fluid integration, radiation, interactions), I/O, MPI support, utilities, main driver.
• prob/ – Problem directories: each subfolder (e.g., sod, bondi, torus) has a build.py that assembles core + problem.c into a problem-specific executable.
• script/ – Python scripts:
– machine/ – Cluster/machine-specific compile settings.
– analysis/ – Post-processing (plots, diagnostics) of HDF5 outputs.
– bhlight.py, config.py, util.py – Glue for build & invocation.
• test/ – Python test harnesses for regressions; each test calls a problem run and compares to analytic/data.
• Build artifacts and config:
• build.py (per problem) invokes bhl.config to set compile-time & runtime parameters, writes makefile, calls make.
• VERSION, LICENSE, .gitignore at root.
• External dependencies spotted:
• GSL, MPI, Parallel HDF5 for core.
• Python libs: matplotlib, numpy, h5py for scripts.
Key Insights from README
• Separation of concerns: fluid solver (HARM), radiation solver (GRMONTY), operator-split coupling.
• Runtime: executable reads param.dat via -p flag, outputs HDF5 dumps/ and restarts/.
• Tests automate runs of various problems and plot results.
• Build scripts manage machine-specific flags and gather sources.
Detailed Notes
• For each problem, show “Problem Definition → Build Script → Linked into Core” as repeating pattern.
• Machine abstraction layer for compiler flag management.