luna-hydro 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. luna_hydro-0.1.0/CHANGELOG.md +64 -0
  2. luna_hydro-0.1.0/CITATION.cff +36 -0
  3. luna_hydro-0.1.0/LICENSE +29 -0
  4. luna_hydro-0.1.0/MANIFEST.in +6 -0
  5. luna_hydro-0.1.0/PKG-INFO +355 -0
  6. luna_hydro-0.1.0/README.md +303 -0
  7. luna_hydro-0.1.0/THIRD_PARTY.md +54 -0
  8. luna_hydro-0.1.0/pyproject.toml +105 -0
  9. luna_hydro-0.1.0/setup.cfg +4 -0
  10. luna_hydro-0.1.0/src/luna/__init__.py +34 -0
  11. luna_hydro-0.1.0/src/luna/amr/LICENSE-JAX-AMR +21 -0
  12. luna_hydro-0.1.0/src/luna/amr/__init__.py +8 -0
  13. luna_hydro-0.1.0/src/luna/amr/blocks.py +263 -0
  14. luna_hydro-0.1.0/src/luna/amr/config.py +108 -0
  15. luna_hydro-0.1.0/src/luna/amr/cosmo.py +92 -0
  16. luna_hydro-0.1.0/src/luna/amr/driver.py +790 -0
  17. luna_hydro-0.1.0/src/luna/amr/geometry.py +239 -0
  18. luna_hydro-0.1.0/src/luna/amr/halo.py +235 -0
  19. luna_hydro-0.1.0/src/luna/amr/hydro.py +322 -0
  20. luna_hydro-0.1.0/src/luna/amr/particles.py +339 -0
  21. luna_hydro-0.1.0/src/luna/amr/poisson.py +311 -0
  22. luna_hydro-0.1.0/src/luna/amr/reflux.py +206 -0
  23. luna_hydro-0.1.0/src/luna/amr/shard.py +1215 -0
  24. luna_hydro-0.1.0/src/luna/amr/shard_plans.py +140 -0
  25. luna_hydro-0.1.0/src/luna/amr/state.py +103 -0
  26. luna_hydro-0.1.0/src/luna/analysis/__init__.py +1 -0
  27. luna_hydro-0.1.0/src/luna/analysis/config.py +27 -0
  28. luna_hydro-0.1.0/src/luna/analysis/fields.py +49 -0
  29. luna_hydro-0.1.0/src/luna/analysis/insitu.py +162 -0
  30. luna_hydro-0.1.0/src/luna/analysis/pdfs.py +62 -0
  31. luna_hydro-0.1.0/src/luna/analysis/reduced.py +172 -0
  32. luna_hydro-0.1.0/src/luna/analysis/spectra.py +101 -0
  33. luna_hydro-0.1.0/src/luna/analysis/structure.py +56 -0
  34. luna_hydro-0.1.0/src/luna/autodiff/__init__.py +1 -0
  35. luna_hydro-0.1.0/src/luna/autodiff/rollout.py +130 -0
  36. luna_hydro-0.1.0/src/luna/autodiff/stability.py +175 -0
  37. luna_hydro-0.1.0/src/luna/chemistry/__init__.py +4 -0
  38. luna_hydro-0.1.0/src/luna/chemistry/cooling.py +499 -0
  39. luna_hydro-0.1.0/src/luna/chemistry/fused.py +215 -0
  40. luna_hydro-0.1.0/src/luna/chemistry/generated/__init__.py +65 -0
  41. luna_hydro-0.1.0/src/luna/chemistry/generated/lookups.py +190 -0
  42. luna_hydro-0.1.0/src/luna/chemistry/generated/net5_core.py +2081 -0
  43. luna_hydro-0.1.0/src/luna/chemistry/generated/net5_p1.py +2570 -0
  44. luna_hydro-0.1.0/src/luna/chemistry/generated/net5_p12.py +2836 -0
  45. luna_hydro-0.1.0/src/luna/chemistry/gow17.py +123 -0
  46. luna_hydro-0.1.0/src/luna/chemistry/networks.py +53 -0
  47. luna_hydro-0.1.0/src/luna/chemistry/photo.py +115 -0
  48. luna_hydro-0.1.0/src/luna/chemistry/rates_net17.py +403 -0
  49. luna_hydro-0.1.0/src/luna/chemistry/rates_net5.py +228 -0
  50. luna_hydro-0.1.0/src/luna/chemistry/tables.py +630 -0
  51. luna_hydro-0.1.0/src/luna/chemistry/thermo.py +184 -0
  52. luna_hydro-0.1.0/src/luna/cosmology/__init__.py +4 -0
  53. luna_hydro-0.1.0/src/luna/cosmology/background.py +81 -0
  54. luna_hydro-0.1.0/src/luna/cosmology/exact_tophat.py +58 -0
  55. luna_hydro-0.1.0/src/luna/cosmology/mesh_gas.py +63 -0
  56. luna_hydro-0.1.0/src/luna/cosmology/music_ic.py +244 -0
  57. luna_hydro-0.1.0/src/luna/eos/__init__.py +1 -0
  58. luna_hydro-0.1.0/src/luna/eos/helmholtz.py +249 -0
  59. luna_hydro-0.1.0/src/luna/eos/inversion.py +141 -0
  60. luna_hydro-0.1.0/src/luna/file_io/__init__.py +1 -0
  61. luna_hydro-0.1.0/src/luna/file_io/checkpoint_sets.py +82 -0
  62. luna_hydro-0.1.0/src/luna/file_io/checkpoint_utils.py +217 -0
  63. luna_hydro-0.1.0/src/luna/file_io/cosmo_checkpoint.py +173 -0
  64. luna_hydro-0.1.0/src/luna/file_io/cosmo_snapshot.py +59 -0
  65. luna_hydro-0.1.0/src/luna/file_io/radiation_checkpoint.py +112 -0
  66. luna_hydro-0.1.0/src/luna/file_io/read_checkpoint.py +162 -0
  67. luna_hydro-0.1.0/src/luna/file_io/read_snapshot.py +128 -0
  68. luna_hydro-0.1.0/src/luna/file_io/write_checkpoint.py +22 -0
  69. luna_hydro-0.1.0/src/luna/file_io/write_checkpoint_distributed.py +73 -0
  70. luna_hydro-0.1.0/src/luna/file_io/write_gadget.py +55 -0
  71. luna_hydro-0.1.0/src/luna/file_io/write_snapshot_distributed.py +109 -0
  72. luna_hydro-0.1.0/src/luna/gravity/__init__.py +8 -0
  73. luna_hydro-0.1.0/src/luna/gravity/backend.py +842 -0
  74. luna_hydro-0.1.0/src/luna/gravity/isolated.py +263 -0
  75. luna_hydro-0.1.0/src/luna/gravity/kdk.py +220 -0
  76. luna_hydro-0.1.0/src/luna/gravity/kick_pallas.py +218 -0
  77. luna_hydro-0.1.0/src/luna/gravity/particle_mesh.py +236 -0
  78. luna_hydro-0.1.0/src/luna/gravity/particle_mesh_blocks.py +565 -0
  79. luna_hydro-0.1.0/src/luna/gravity/particle_mesh_shardmap.py +275 -0
  80. luna_hydro-0.1.0/src/luna/gravity/poisson_bc.py +180 -0
  81. luna_hydro-0.1.0/src/luna/gravity/poisson_bc_shardmap.py +37 -0
  82. luna_hydro-0.1.0/src/luna/gravity/poisson_diff.py +101 -0
  83. luna_hydro-0.1.0/src/luna/gravity/poisson_multigrid.py +698 -0
  84. luna_hydro-0.1.0/src/luna/gravity/spherical_1d.py +144 -0
  85. luna_hydro-0.1.0/src/luna/hydro/__init__.py +1 -0
  86. luna_hydro-0.1.0/src/luna/hydro/advection.py +46 -0
  87. luna_hydro-0.1.0/src/luna/hydro/conversions.py +50 -0
  88. luna_hydro-0.1.0/src/luna/hydro/eos_fluxes.py +53 -0
  89. luna_hydro-0.1.0/src/luna/hydro/exact_guderley.py +174 -0
  90. luna_hydro-0.1.0/src/luna/hydro/exact_kh_linear.py +75 -0
  91. luna_hydro-0.1.0/src/luna/hydro/exact_riemann.py +132 -0
  92. luna_hydro-0.1.0/src/luna/hydro/exact_sedov.py +124 -0
  93. luna_hydro-0.1.0/src/luna/hydro/fluxes.py +178 -0
  94. luna_hydro-0.1.0/src/luna/hydro/jacobian.py +105 -0
  95. luna_hydro-0.1.0/src/luna/hydro/muscl_hancock.py +554 -0
  96. luna_hydro-0.1.0/src/luna/hydro/muscl_hancock_pallas.py +432 -0
  97. luna_hydro-0.1.0/src/luna/hydro/physics_checks.py +62 -0
  98. luna_hydro-0.1.0/src/luna/hydro/slopes.py +239 -0
  99. luna_hydro-0.1.0/src/luna/hydro/stellar_1d.py +260 -0
  100. luna_hydro-0.1.0/src/luna/hydro/turbulence.py +227 -0
  101. luna_hydro-0.1.0/src/luna/hydro/turbulence_pallas.py +89 -0
  102. luna_hydro-0.1.0/src/luna/ic_generation/__init__.py +1 -0
  103. luna_hydro-0.1.0/src/luna/ic_generation/_grid.py +6 -0
  104. luna_hydro-0.1.0/src/luna/ic_generation/advection_square.py +34 -0
  105. luna_hydro-0.1.0/src/luna/ic_generation/agertz_blob.py +58 -0
  106. luna_hydro-0.1.0/src/luna/ic_generation/bonnor_ebert3d.py +103 -0
  107. luna_hydro-0.1.0/src/luna/ic_generation/boss_bodenheimer3d.py +99 -0
  108. luna_hydro-0.1.0/src/luna/ic_generation/cc85_wind_3d.py +61 -0
  109. luna_hydro-0.1.0/src/luna/ic_generation/disc_planet_2d.py +73 -0
  110. luna_hydro-0.1.0/src/luna/ic_generation/driven_turbulence_3d.py +35 -0
  111. luna_hydro-0.1.0/src/luna/ic_generation/einfeldt.py +65 -0
  112. luna_hydro-0.1.0/src/luna/ic_generation/evrard3d.py +62 -0
  113. luna_hydro-0.1.0/src/luna/ic_generation/gresho_vortex.py +53 -0
  114. luna_hydro-0.1.0/src/luna/ic_generation/hii_region_3d.py +41 -0
  115. luna_hydro-0.1.0/src/luna/ic_generation/ic.py +170 -0
  116. luna_hydro-0.1.0/src/luna/ic_generation/ic_file.py +79 -0
  117. luna_hydro-0.1.0/src/luna/ic_generation/implosion.py +31 -0
  118. luna_hydro-0.1.0/src/luna/ic_generation/jeans3d.py +87 -0
  119. luna_hydro-0.1.0/src/luna/ic_generation/keplerian_disc_2d.py +77 -0
  120. luna_hydro-0.1.0/src/luna/ic_generation/kh.py +62 -0
  121. luna_hydro-0.1.0/src/luna/ic_generation/kh3d.py +75 -0
  122. luna_hydro-0.1.0/src/luna/ic_generation/kh_mcnally.py +59 -0
  123. luna_hydro-0.1.0/src/luna/ic_generation/kt_riemann_2d.py +67 -0
  124. luna_hydro-0.1.0/src/luna/ic_generation/lane_emden3d.py +93 -0
  125. luna_hydro-0.1.0/src/luna/ic_generation/leblanc.py +40 -0
  126. luna_hydro-0.1.0/src/luna/ic_generation/m82_disk_3d.py +147 -0
  127. luna_hydro-0.1.0/src/luna/ic_generation/maclaurin3d.py +89 -0
  128. luna_hydro-0.1.0/src/luna/ic_generation/planar_riemann_2d.py +52 -0
  129. luna_hydro-0.1.0/src/luna/ic_generation/pulsating_polytrope3d.py +76 -0
  130. luna_hydro-0.1.0/src/luna/ic_generation/rotation_slotted_disk.py +42 -0
  131. luna_hydro-0.1.0/src/luna/ic_generation/sedov3d.py +126 -0
  132. luna_hydro-0.1.0/src/luna/ic_generation/shu_osher.py +52 -0
  133. luna_hydro-0.1.0/src/luna/ic_generation/sod.py +33 -0
  134. luna_hydro-0.1.0/src/luna/ic_generation/sod3d.py +81 -0
  135. luna_hydro-0.1.0/src/luna/ic_generation/soundwave.py +47 -0
  136. luna_hydro-0.1.0/src/luna/ic_generation/soundwave3d.py +47 -0
  137. luna_hydro-0.1.0/src/luna/ic_generation/soundwave_advected.py +30 -0
  138. luna_hydro-0.1.0/src/luna/ic_generation/soundwave_advected2d.py +35 -0
  139. luna_hydro-0.1.0/src/luna/ic_generation/spectral.py +21 -0
  140. luna_hydro-0.1.0/src/luna/ic_generation/titarev_toro.py +29 -0
  141. luna_hydro-0.1.0/src/luna/ic_generation/turbulent_sphere_3d.py +240 -0
  142. luna_hydro-0.1.0/src/luna/ic_generation/user_ic.py +97 -0
  143. luna_hydro-0.1.0/src/luna/ic_generation/white_dwarf_1d.py +103 -0
  144. luna_hydro-0.1.0/src/luna/ic_generation/woodward_colella.py +27 -0
  145. luna_hydro-0.1.0/src/luna/ic_generation/zeldovich.py +74 -0
  146. luna_hydro-0.1.0/src/luna/main.py +108 -0
  147. luna_hydro-0.1.0/src/luna/nuclear/__init__.py +1 -0
  148. luna_hydro-0.1.0/src/luna/nuclear/_neutrino_coefficients.py +93 -0
  149. luna_hydro-0.1.0/src/luna/nuclear/alpha_rates.py +163 -0
  150. luna_hydro-0.1.0/src/luna/nuclear/aprox13.py +238 -0
  151. luna_hydro-0.1.0/src/luna/nuclear/burn.py +90 -0
  152. luna_hydro-0.1.0/src/luna/nuclear/coupling.py +163 -0
  153. luna_hydro-0.1.0/src/luna/nuclear/detonation.py +251 -0
  154. luna_hydro-0.1.0/src/luna/nuclear/light_rates.py +99 -0
  155. luna_hydro-0.1.0/src/luna/nuclear/neutrinos.py +206 -0
  156. luna_hydro-0.1.0/src/luna/nuclear/screening.py +135 -0
  157. luna_hydro-0.1.0/src/luna/ode/__init__.py +1 -0
  158. luna_hydro-0.1.0/src/luna/ode/rodas3.py +660 -0
  159. luna_hydro-0.1.0/src/luna/radiation/__init__.py +1 -0
  160. luna_hydro-0.1.0/src/luna/radiation/coupling.py +81 -0
  161. luna_hydro-0.1.0/src/luna/radiation/ionization.py +276 -0
  162. luna_hydro-0.1.0/src/luna/radiation/m1.py +282 -0
  163. luna_hydro-0.1.0/src/luna/radiation/m1_pallas.py +417 -0
  164. luna_hydro-0.1.0/src/luna/radiation/m2.py +152 -0
  165. luna_hydro-0.1.0/src/luna/radiation/m2_3d.py +260 -0
  166. luna_hydro-0.1.0/src/luna/radiation/m2_closure_w32.npz +0 -0
  167. luna_hydro-0.1.0/src/luna/radiation/m2_learned.py +130 -0
  168. luna_hydro-0.1.0/src/luna/radiation/m2_learned_3d.py +127 -0
  169. luna_hydro-0.1.0/src/luna/radiation/m2_pallas.py +239 -0
  170. luna_hydro-0.1.0/src/luna/radiation/m2_split.py +232 -0
  171. luna_hydro-0.1.0/src/luna/radiation/m2_stage.py +66 -0
  172. luna_hydro-0.1.0/src/luna/reference_data.py +78 -0
  173. luna_hydro-0.1.0/src/luna/setup/__init__.py +19 -0
  174. luna_hydro-0.1.0/src/luna/setup/assemble.py +238 -0
  175. luna_hydro-0.1.0/src/luna/setup/cli.py +391 -0
  176. luna_hydro-0.1.0/src/luna/setup/clock.py +96 -0
  177. luna_hydro-0.1.0/src/luna/setup/cosmo_common.py +61 -0
  178. luna_hydro-0.1.0/src/luna/setup/diagnostics.py +30 -0
  179. luna_hydro-0.1.0/src/luna/setup/evolve.py +181 -0
  180. luna_hydro-0.1.0/src/luna/setup/face_report.py +135 -0
  181. luna_hydro-0.1.0/src/luna/setup/finalize_distributed.py +84 -0
  182. luna_hydro-0.1.0/src/luna/setup/gravity_energy.py +41 -0
  183. luna_hydro-0.1.0/src/luna/setup/hydro.py +203 -0
  184. luna_hydro-0.1.0/src/luna/setup/ics.py +263 -0
  185. luna_hydro-0.1.0/src/luna/setup/jax_init.py +169 -0
  186. luna_hydro-0.1.0/src/luna/setup/mesh.py +141 -0
  187. luna_hydro-0.1.0/src/luna/setup/output_dir.py +26 -0
  188. luna_hydro-0.1.0/src/luna/setup/outputs.py +389 -0
  189. luna_hydro-0.1.0/src/luna/setup/run_kind.py +40 -0
  190. luna_hydro-0.1.0/src/luna/setup/run_report.py +107 -0
  191. luna_hydro-0.1.0/src/luna/setup/runner_amr.py +910 -0
  192. luna_hydro-0.1.0/src/luna/setup/state.py +69 -0
  193. luna_hydro-0.1.0/src/luna/setup/step_timing.py +212 -0
  194. luna_hydro-0.1.0/src/luna/setup/user_config.py +132 -0
  195. luna_hydro-0.1.0/src/luna/sources/__init__.py +1 -0
  196. luna_hydro-0.1.0/src/luna/sources/cc85.py +94 -0
  197. luna_hydro-0.1.0/src/luna/sources/chemistry.py +255 -0
  198. luna_hydro-0.1.0/src/luna/sources/comoving_energy.py +28 -0
  199. luna_hydro-0.1.0/src/luna/sources/cooling.py +353 -0
  200. luna_hydro-0.1.0/src/luna/sources/cosmo_floors.py +192 -0
  201. luna_hydro-0.1.0/src/luna/sources/eos_projection.py +62 -0
  202. luna_hydro-0.1.0/src/luna/sources/external_gravity.py +210 -0
  203. luna_hydro-0.1.0/src/luna/sources/feedback.py +397 -0
  204. luna_hydro-0.1.0/src/luna/sources/ml_corrector.py +209 -0
  205. luna_hydro-0.1.0/src/luna/sources/ou_forcing.py +80 -0
  206. luna_hydro-0.1.0/src/luna/sources/particles.py +139 -0
  207. luna_hydro-0.1.0/src/luna/sources/radiation.py +408 -0
  208. luna_hydro-0.1.0/src/luna/sources/stages.py +199 -0
  209. luna_hydro-0.1.0/src/luna/species/__init__.py +4 -0
  210. luna_hydro-0.1.0/src/luna/species/dm.py +190 -0
  211. luna_hydro-0.1.0/src/luna/species/imf.py +80 -0
  212. luna_hydro-0.1.0/src/luna/species/sinks.py +827 -0
  213. luna_hydro-0.1.0/src/luna/species/sinks_sharded.py +323 -0
  214. luna_hydro-0.1.0/src/luna/stellar.py +416 -0
  215. luna_hydro-0.1.0/src/luna/stellar_diagnostics.py +91 -0
  216. luna_hydro-0.1.0/src/luna/template_config.py +513 -0
  217. luna_hydro-0.1.0/src/luna/time_integration/__init__.py +1 -0
  218. luna_hydro-0.1.0/src/luna/time_integration/integrators.py +317 -0
  219. luna_hydro-0.1.0/src/luna/time_integration/revolve.py +230 -0
  220. luna_hydro-0.1.0/src/luna/units.py +236 -0
  221. luna_hydro-0.1.0/src/luna/utils/__init__.py +1 -0
  222. luna_hydro-0.1.0/src/luna/utils/distributed.py +191 -0
  223. luna_hydro-0.1.0/src/luna/utils/figstyle.py +75 -0
  224. luna_hydro-0.1.0/src/luna/utils/flop_counter.py +61 -0
  225. luna_hydro-0.1.0/src/luna/utils/grid_params.py +71 -0
  226. luna_hydro-0.1.0/src/luna/utils/grid_scatter.py +122 -0
  227. luna_hydro-0.1.0/src/luna/utils/halo_exchange_shardmap.py +145 -0
  228. luna_hydro-0.1.0/src/luna/utils/halo_local.py +32 -0
  229. luna_hydro-0.1.0/src/luna/utils/logo.py +27 -0
  230. luna_hydro-0.1.0/src/luna/utils/memory_utils.py +54 -0
  231. luna_hydro-0.1.0/src/luna/utils/mesh_reduce.py +57 -0
  232. luna_hydro-0.1.0/src/luna/utils/plot_1d_fluid_quants.py +86 -0
  233. luna_hydro-0.1.0/src/luna/utils/plot_density2d.py +181 -0
  234. luna_hydro-0.1.0/src/luna/utils/shmap.py +32 -0
  235. luna_hydro-0.1.0/src/luna/utils/sorting.py +61 -0
  236. luna_hydro-0.1.0/src/luna_hydro.egg-info/PKG-INFO +355 -0
  237. luna_hydro-0.1.0/src/luna_hydro.egg-info/SOURCES.txt +239 -0
  238. luna_hydro-0.1.0/src/luna_hydro.egg-info/dependency_links.txt +1 -0
  239. luna_hydro-0.1.0/src/luna_hydro.egg-info/entry_points.txt +2 -0
  240. luna_hydro-0.1.0/src/luna_hydro.egg-info/requires.txt +28 -0
  241. luna_hydro-0.1.0/src/luna_hydro.egg-info/top_level.txt +1 -0
@@ -0,0 +1,64 @@
1
+ # Changelog
2
+
3
+ All notable changes to LUNA. Versions follow [Semantic Versioning](https://semver.org); while
4
+ the version is 0.x, minor releases may change the configuration and the Python API.
5
+
6
+ ## 0.1.0 (2026-11-02)
7
+
8
+ The first public release. Status words as in the README: validated (asserted by a test
9
+ against an independent reference), shown (runs and figures, no asserting test), experimental
10
+ (under development). Details and tests: docs/CLAIMS.md.
11
+
12
+ ### Hydrodynamics
13
+ - Euler equations in 1D, 2D and 3D: unsplit MUSCL-Hancock, PLM reconstruction (minmod, MC,
14
+ van Leer), HLLC and HLL Riemann solvers; FP32 by default, FP64 with `enable_x64=True`. Validated.
15
+ - Non-physical Hancock face states are refused with the face named; a first-order face
16
+ fallback exists only as an opt-in (`allow_first_order_faces=True`) and is counted and reported.
17
+ - XLA kernel (default, differentiable reference) and an opt-in Pallas GPU kernel
18
+ (`hydro_kernel="pallas"`), bitwise equal to the XLA kernel on an A100.
19
+ - Known open bug: HLLC carbuncle at grid-aligned strong shocks (strict xfail tests); HLL is
20
+ the user's choice there, never switched automatically.
21
+
22
+ ### Parallel runs
23
+ - Domain decomposition over many devices and processes (`MESH_SHAPE`); a sharded run
24
+ reproduces the single-device run (bitwise in the Sedov and Kelvin-Helmholtz tests). Validated.
25
+ - Weak scaling measured to 4096 NVIDIA GH200 GPUs on JUPITER (FP32); runs on A100, GH200 and
26
+ MI300A. Shown (measurements, not tests).
27
+
28
+ ### Physics modules
29
+ - Self-gravity with periodic and isolated boundaries, energy-conserving coupling. Validated.
30
+ - Comoving cosmological integration (adiabatic expansion, top-hat collapse validated); dark
31
+ matter particles with particle-mesh gravity (power spectrum compared with Arepo: shown).
32
+ - Radiative cooling from tables (tables validated against published equilibria; cooling in the
33
+ step shown).
34
+ - Chemistry networks (chemcool networks 5 and 17 ported to JAX), radiation transport (M1 and
35
+ M2 closures), sink particles and star formation coupled to Torch/AMUSE, block AMR, Helmholtz
36
+ EOS and aprox13 nuclear network (standalone). Experimental.
37
+ - Starburst-driven wind (M82 disk, CC85 injection) and driven turbulence setups. Shown.
38
+
39
+ ### Differentiation
40
+ - Reverse-mode gradients through the solver, checked against finite differences; known gaps
41
+ listed in docs/AUTODIFF.md. Shown.
42
+
43
+ ### Running and packaging
44
+ - One command line for every run: `luna run_file.py field=value ...` (or `python main.py` in a
45
+ clone); every setting is a field of one `Config` (docs/CONFIG.md); unknown fields are errors.
46
+ - `pip install` extras `cuda12`, `rocm`, `plot`, `test`, `notebooks`; `luna.__version__`; run
47
+ provenance (settings, command line, code revision or installed version) in `run.json`.
48
+ - Snapshots as HDF5 directories, checkpoints and restarts, `history.csv`.
49
+
50
+ ### Tests
51
+ - Fast tier on every push, the full CPU suite (12 shards, 8 virtual devices), the 2-device
52
+ files and the Torch/AMUSE coupling tests (AMUSE v2026.3.0 built from source) in public CI; GPU and multi-node tiers on the
53
+ author's clusters. Reference solutions (AthenaK, Arepo, RAMSES, Pencil Code digitisations,
54
+ AMReX Microphysics, spectral runs, LUNA's own regression outputs) in the separate,
55
+ checksummed luna-reference-solutions repository; a missing or altered file fails, never skips.
56
+
57
+ ### Known issues in 0.1.0
58
+ - Some full-suite CI tests fail at this release; fixes are under review for 0.1.1: AMR
59
+ sharded vs single-device ghost cells, the MC-limiter accretion shocks in the coupled cosmology
60
+ test, round-off differences between CPUs in the sink field and the stellar golden, the
61
+ isolated-gravity multipole sum order, and outdated test stubs.
62
+ - The chemistry tests need the chemcool references, which move into luna-reference-solutions
63
+ for 0.1.1; until then they run only where `$LUNA_DATA` holds them.
64
+
@@ -0,0 +1,36 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software in your research, please cite it as below."
3
+ title: "LUNA: A Differentiable Astrophysical Hydrodynamics Code"
4
+ abstract: >-
5
+ LUNA is a differentiable astrophysical hydrodynamics code written in JAX, with hand-written
6
+ Pallas kernels as a fast path on GPUs. It solves the Euler equations in one, two and three
7
+ dimensions with an unsplit, second-order MUSCL-Hancock scheme and HLLC or HLL Riemann solvers,
8
+ and runs on CPUs and on many NVIDIA or AMD GPUs, with the domain split over devices.
9
+ Self-gravity is solved with periodic or isolated boundaries and couples to the gas conserving
10
+ energy; comoving cosmology evolves gas together with dark-matter particles; radiative cooling,
11
+ driven turbulence and starburst energy and mass injection are built in. Examples of what it
12
+ does: shock tubes, blast waves and Kelvin-Helmholtz, Rayleigh-Taylor and Richtmyer-Meshkov
13
+ instabilities; Jeans collapse and collapsing self-gravitating clouds; the cosmic web of gas and
14
+ dark matter from cosmological initial conditions; driven supersonic turbulence; galactic winds
15
+ blown out of a starburst disk; and inverse problems, such as optimising initial conditions with
16
+ gradients taken through the solver. Non-equilibrium chemistry and cooling networks, radiation
17
+ transport, sink particles and star formation with stellar dynamics and feedback through
18
+ Torch/AMUSE, and block-based adaptive mesh refinement are included as experimental modules.
19
+ Validated capabilities are tested against exact solutions or other codes (AthenaK, Arepo,
20
+ RAMSES), whose reference solutions are published with the code.
21
+ type: software
22
+ authors:
23
+ - family-names: Steinwandel
24
+ given-names: Ulrich Philipp
25
+ version: 0.1.0
26
+ date-released: 2026-11-02
27
+ license: BSD-3-Clause
28
+ repository-code: "https://github.com/Ulli1991/LUNA"
29
+ url: "https://github.com/Ulli1991/LUNA"
30
+ keywords:
31
+ - hydrodynamics
32
+ - JAX
33
+ - GPU
34
+ - astrophysics
35
+ - ISM
36
+ - differentiable programming
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Ulrich Philipp Steinwandel, Max Planck Institute for Astrophysics
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,6 @@
1
+ # The sdist is the library and its metadata; tests, tools and scripts need the full clone
2
+ # (conftest.py, tools/run_tests.py, luna-reference-solutions), so they are not in it.
3
+ include LICENSE README.md CITATION.cff CHANGELOG.md THIRD_PARTY.md
4
+ include src/luna/amr/LICENSE-JAX-AMR src/luna/radiation/*.npz
5
+ prune tests
6
+ global-exclude CLAUDE.md DESIGN.md __pycache__ *.py[cod]
@@ -0,0 +1,355 @@
1
+ Metadata-Version: 2.4
2
+ Name: luna-hydro
3
+ Version: 0.1.0
4
+ Summary: Differentiable astrophysical hydrodynamics in JAX, from one CPU to many GPUs
5
+ Author: Ulrich Philipp Steinwandel
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Homepage, https://github.com/Ulli1991/LUNA
8
+ Project-URL: Source, https://github.com/Ulli1991/LUNA
9
+ Project-URL: Documentation, https://github.com/Ulli1991/LUNA/tree/main/docs
10
+ Project-URL: Issues, https://github.com/Ulli1991/LUNA/issues
11
+ Project-URL: Changelog, https://github.com/Ulli1991/LUNA/blob/main/CHANGELOG.md
12
+ Project-URL: Reference data, https://github.com/Ulli1991/luna-reference-solutions
13
+ Keywords: hydrodynamics,JAX,GPU,astrophysics,cosmology,differentiable,Euler equations
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
17
+ Classifier: Topic :: Scientific/Engineering :: Physics
18
+ Classifier: Environment :: GPU :: NVIDIA CUDA :: 12
19
+ Classifier: Operating System :: POSIX :: Linux
20
+ Classifier: Operating System :: MacOS
21
+ Classifier: Programming Language :: Python :: 3 :: Only
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Requires-Python: >=3.11
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ License-File: src/luna/amr/LICENSE-JAX-AMR
29
+ Requires-Dist: jax<0.11,>=0.10.0
30
+ Requires-Dist: jaxlib<0.11,>=0.10.0
31
+ Requires-Dist: h5py>=3.0
32
+ Requires-Dist: numpy>=1.23
33
+ Requires-Dist: scipy>=1.9
34
+ Provides-Extra: cuda12
35
+ Requires-Dist: jax[cuda12]<0.11,>=0.10.0; extra == "cuda12"
36
+ Provides-Extra: rocm
37
+ Requires-Dist: jax[rocm7-local]<0.11,>=0.10.0; extra == "rocm"
38
+ Provides-Extra: plot
39
+ Requires-Dist: matplotlib>=3.5; extra == "plot"
40
+ Provides-Extra: test
41
+ Requires-Dist: pytest>=7.0; extra == "test"
42
+ Provides-Extra: notebooks
43
+ Requires-Dist: jupyter; extra == "notebooks"
44
+ Requires-Dist: matplotlib>=3.5; extra == "notebooks"
45
+ Requires-Dist: scipy>=1.9; extra == "notebooks"
46
+ Provides-Extra: dev
47
+ Requires-Dist: black>=24.0; extra == "dev"
48
+ Requires-Dist: ruff>=0.16; extra == "dev"
49
+ Requires-Dist: build; extra == "dev"
50
+ Requires-Dist: twine; extra == "dev"
51
+ Dynamic: license-file
52
+
53
+ # LUNA
54
+
55
+ LUNA is a differentiable astrophysical hydrodynamics code written in
56
+ [JAX](https://docs.jax.dev), with hand-written
57
+ [Pallas](https://docs.jax.dev/en/latest/pallas/index.html) kernels as a fast path on
58
+ GPUs. It solves the Euler equations in one, two and three dimensions with an unsplit,
59
+ second-order MUSCL-Hancock scheme and HLLC or HLL Riemann solvers, and runs on CPUs and
60
+ on many NVIDIA or AMD GPUs, with the domain split over devices. Self-gravity is solved
61
+ with periodic or isolated boundaries and couples to the gas conserving energy; comoving
62
+ cosmology evolves gas together with dark-matter particles; radiative cooling, driven
63
+ turbulence and starburst energy and mass injection are built in. Examples of what it
64
+ does: shock tubes, blast waves and Kelvin-Helmholtz, Rayleigh-Taylor and
65
+ Richtmyer-Meshkov instabilities; Jeans collapse and collapsing self-gravitating clouds;
66
+ the cosmic web of gas and dark matter from cosmological initial conditions; driven
67
+ supersonic turbulence; galactic winds blown out of a starburst disk; and inverse
68
+ problems, such as optimising initial conditions with gradients taken through the solver.
69
+ Non-equilibrium chemistry and cooling networks, radiation transport, sink particles and
70
+ star formation with stellar dynamics and feedback through Torch/AMUSE, and block-based
71
+ adaptive mesh refinement are included as experimental modules. Validated capabilities
72
+ are tested against exact solutions or other codes (AthenaK, Arepo, RAMSES), whose
73
+ reference solutions are published with the code.
74
+
75
+ Defaults on `main`: FP32
76
+ (`enable_x64=False`), minmod limiter, HLLC, CFL 0.8, and the XLA kernel
77
+ (`hydro_kernel="xla"`), which is the reference path. A Pallas kernel is an opt-in path
78
+ for GPUs (`hydro_kernel="pallas"`); it refuses configurations it cannot run.
79
+
80
+ The reference solutions the tests compare against (AthenaK, Arepo, RAMSES, the Pencil
81
+ Code, AMReX Microphysics and others, with their sources) are public in
82
+ [luna-reference-solutions](https://github.com/Ulli1991/luna-reference-solutions).
83
+
84
+ ## What LUNA can do
85
+
86
+ Status: **validated** = asserted by a test against an independent reference;
87
+ **shown** = real runs, shown in figures, not yet asserted by a test; **experimental** =
88
+ under development, not finalised. Each row's tests and details are in
89
+ [docs/CLAIMS.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/CLAIMS.md).
90
+
91
+ | capability | status |
92
+ |---|---|
93
+ | Euler hydrodynamics in 1D, 2D, 3D: unsplit MUSCL-Hancock, PLM (minmod, MC, van Leer), HLLC | validated |
94
+ | `riemann_solver="hll"`: the robust fallback where HLLC carbuncles at grid-aligned strong shocks; chosen by the user, never switched automatically | validated |
95
+ | Multi-GPU domain decomposition; a sharded run reproduces the single-device run | validated |
96
+ | Weak scaling to 4096 NVIDIA GH200 GPUs on JUPITER (FP32, 88.9 % efficiency) | shown (measurement) |
97
+ | NVIDIA and AMD GPUs (runs on A100, GH200, MI300A; public CI is CPU only) | shown |
98
+ | Pallas GPU kernels (`hydro_kernel="pallas"`, opt-in), bitwise equal to the XLA kernel on A100 | validated |
99
+ | Self-gravity, periodic and isolated boundaries; energy-conserving coupling | validated |
100
+ | Comoving cosmology: adiabatic expansion, top-hat collapse | validated |
101
+ | Cosmic web with dark-matter particles and gas; DM power spectrum compared with Arepo | shown |
102
+ | Radiative cooling (tables validated against published equilibria; cooling in the step not yet asserted) | shown |
103
+ | Chemistry networks | experimental |
104
+ | Radiation transport, M1 and M2 closures | experimental |
105
+ | Sink particles and star formation coupled to Torch/AMUSE | experimental |
106
+ | Block AMR | experimental |
107
+ | Starburst-driven wind (M82 disk, CC85 injection) | shown |
108
+ | Driven turbulence | shown |
109
+ | Differentiation through the solver (gradients checked against finite differences; known gaps in [docs/AUTODIFF.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/AUTODIFF.md)) | shown |
110
+
111
+ <table>
112
+ <tr>
113
+ <td width="50%"><img src="https://raw.githubusercontent.com/Ulli1991/LUNA/v0.1.0/code_paper_figs/kh_8192_luna_vs_athenak.png" alt="Kelvin-Helmholtz at 8192², LUNA and AthenaK"><br>
114
+ <sub><b>Kelvin-Helmholtz at 8192²</b>, density at t = 0 to 5: LUNA (top, second order) and AthenaK (bottom, fourth-order WENOZ) as the reference. Shown: an accuracy comparison by eye, not an asserted test.</sub></td>
115
+ <td width="50%"><img src="https://raw.githubusercontent.com/Ulli1991/LUNA/v0.1.0/code_paper_figs/sedov3d_Nx1024.png" alt="3D Sedov-Taylor blast wave"><br>
116
+ <sub><b>3D Sedov-Taylor blast</b> in an ISM-like medium: shock radius against the self-similar solution, and column density. The Sedov solution is asserted in the 2D off-axis tests (validated); this 3D run is shown.</sub></td>
117
+ </tr>
118
+ <tr>
119
+ <td><img src="https://raw.githubusercontent.com/Ulli1991/LUNA/v0.1.0/code_paper_figs/cosmic_web_512_z0.png" alt="Cosmic web at z=0, dark matter and gas"><br>
120
+ <sub><b>Cosmic web at z = 0</b>: 512³ gas cells and 512³ dark-matter particles, 25 Mpc/h box; dark matter (left), gas (right). Shown.</sub></td>
121
+ <td><img src="https://raw.githubusercontent.com/Ulli1991/LUNA/v0.1.0/code_paper_figs/fig33_dm_powerspec_arepo_vs_luna.png" alt="Dark-matter power spectrum, LUNA PM and Arepo TreePM"><br>
122
+ <sub><b>Dark-matter power spectrum</b>, LUNA (particle-mesh) and Arepo (TreePM) from identical 512³ initial conditions: equal on large scales, LUNA lower above k ≈ 5 h/Mpc where the grid softens the force. Shown: compared in a figure; no test gates it yet.</sub></td>
123
+ </tr>
124
+ <tr>
125
+ <td><img src="https://raw.githubusercontent.com/Ulli1991/LUNA/v0.1.0/code_paper_figs/coupled_collapse_512.png" alt="Molecular cloud collapse with sinks and stars"><br>
126
+ <sub><b>Collapsing molecular cloud</b> (2000 M⊙, 512³) to one free-fall time, with sink particles; stars and their N-body dynamics through Torch/AMUSE. Experimental.</sub></td>
127
+ <td><img src="https://raw.githubusercontent.com/Ulli1991/LUNA/v0.1.0/code_paper_figs/m82_wind_density.png" alt="M82-like starburst wind"><br>
128
+ <sub><b>M82-like starburst wind</b> leaving a rotating disk (CC85 injection, Schneider et al. 2018 setup), log n_H at 60 Myr. Shown.</sub></td>
129
+ </tr>
130
+ <tr>
131
+ <td><img src="https://raw.githubusercontent.com/Ulli1991/LUNA/v0.1.0/code_paper_figs/amr_sedov3d_evolution.png" alt="3D Sedov with block AMR"><br>
132
+ <sub><b>Block AMR</b>: 3D Sedov on a fixed 64³ grid and with block refinement, refinement mesh overlaid. Experimental.</sub></td>
133
+ <td><img src="https://raw.githubusercontent.com/Ulli1991/LUNA/v0.1.0/code_paper_figs/autodiff_LUNA_emergence_Nx256.png" alt="Initial conditions optimised so that the word LUNA emerges"><br>
134
+ <sub><b>Differentiating through the solver</b>: initial conditions optimised with reverse-mode gradients so that the word LUNA emerges from an explosion (top) and from turbulence (bottom). A demonstration, shown.</sub></td>
135
+ </tr>
136
+ </table>
137
+
138
+ More figures: [docs/GALLERY.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/GALLERY.md).
139
+
140
+ ## What is validated
141
+
142
+ Only results that a test asserts against an independent reference (exact or analytic
143
+ solution, published data, or another code's output) with a stated bound; the test for
144
+ each is in [docs/CLAIMS.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/CLAIMS.md), and the other codes' outputs are in
145
+ [luna-reference-solutions](https://github.com/Ulli1991/luna-reference-solutions).
146
+
147
+ - Second-order convergence on smooth flows and linear waves; HLLC and HLL fluxes against
148
+ Toro's tests; shock tubes against the exact Riemann solution.
149
+ - Sedov-Taylor, Noh and Guderley against exact solutions; linear growth of
150
+ Kelvin-Helmholtz, Rayleigh-Taylor and Richtmyer-Meshkov against linear theory;
151
+ nonlinear Kelvin-Helmholtz against McNally et al. (2012).
152
+ - HLL keeps grid-aligned strong shocks planar where HLLC carbuncles (the HLLC case is a
153
+ known open bug, kept as a strict xfail test).
154
+ - A run split over several devices reproduces the single-device run (bitwise in the
155
+ Sedov and Kelvin-Helmholtz tests, to 1e-12 in the shard-seam test); the Pallas hydro
156
+ kernel equals the XLA kernel bitwise on an A100.
157
+ - Self-gravity with periodic and isolated boundaries (Jeans waves, direct sums, energy
158
+ conservation in the Evrard collapse); comoving expansion and the spherical top-hat
159
+ collapse against exact solutions; cooling tables against published equilibria.
160
+
161
+ White-dwarf detonations are in development and not on `main`.
162
+
163
+ ## Install
164
+
165
+ Python 3.11, 3.12 or 3.13. The package is `luna-hydro`; it installs the library `luna`
166
+ and the command `luna` (the same as `python main.py` in a clone), and pins
167
+ `jax>=0.10.0,<0.11`. Until LUNA is on PyPI, install from a clone; the commands in
168
+ brackets are the PyPI form for once it is published.
169
+
170
+ **CPU** (laptop, workstation, login node):
171
+
172
+ ```bash
173
+ git clone https://github.com/Ulli1991/LUNA.git
174
+ pip install "./LUNA[plot]" # (once published: pip install "luna-hydro[plot]")
175
+ ```
176
+
177
+ **NVIDIA GPUs**: the `[cuda12]` extra installs JAX's CUDA 12 build of the same version,
178
+ with the CUDA libraries as pip wheels; the machine needs only an NVIDIA driver, no CUDA
179
+ module.
180
+
181
+ ```bash
182
+ pip install "./LUNA[cuda12,plot]" # (once published: pip install "luna-hydro[cuda12,plot]")
183
+ python -c "import jax; print(jax.devices())" # [CudaDevice(id=0), ...]
184
+ ```
185
+
186
+ **AMD GPUs**: `pip install "./LUNA[rocm,plot]"` installs JAX's ROCm 7 plugin of the
187
+ same version (`jax[rocm7-local]`), which needs ROCm 7 installed on the machine (module
188
+ or system). This route is not tested by LUNA's CI.
189
+
190
+ **No JAX 0.10 wheel for your platform** (for example an Intel Mac): use the CPU image in
191
+ [tools/docker/Dockerfile](https://github.com/Ulli1991/LUNA/blob/v0.1.0/tools/docker/Dockerfile); its header has the build and run
192
+ commands.
193
+
194
+ For development, install the clone editable with the test tools:
195
+
196
+ ```bash
197
+ cd LUNA
198
+ pip install -e ".[plot,test]"
199
+ ```
200
+
201
+ Extras: `plot` (matplotlib; the default run plots its result at the end,
202
+ `PLOT_AFTER_SIM=True`, and fails there without it, so set `PLOT_AFTER_SIM=False` if you
203
+ leave it out), `test` (pytest), `notebooks` (Jupyter and matplotlib), `cuda12`, `rocm`.
204
+ The installed package is the library and the `luna` command. The run scripts in
205
+ `scripts/`, the autodiff example tasks (`scripts/examples/autodiff/`), the tests and
206
+ `tools/`, the SLURM templates in `submit/` and the Torch/AMUSE coupling (`src/amuse_luna`)
207
+ need the clone.
208
+
209
+ ## Quick start
210
+
211
+ A run is a config file (a copy of the template, which holds every setting) plus
212
+ `field=value` overrides on the command line:
213
+
214
+ ```bash
215
+ cp LUNA/src/luna/template_config.py my_run.py # every setting; docs/CONFIG.md explains them
216
+ luna my_run.py Nx=256 # Sod shock tube, 1D (the template's problem)
217
+ luna my_run.py test_problem=Kelvin-Helmholtz SPATIAL_DIMENSION=2 BOUNDARY=0 \
218
+ Nx=128 Ny=128 Lx=2 Ly=2 t_end=1.0 output_dir=snapshots/kh128
219
+ luna my_run.py test_problem=Sedov-Blast-3D SPATIAL_DIMENSION=3 \
220
+ Nx=32 Ny=32 Nz=32 output_dir=snapshots/sedov32
221
+ ```
222
+
223
+ Without a clone, copy the template from the installed package:
224
+ `python -c "import luna.template_config as t, shutil; shutil.copy(t.__file__, 'my_run.py')"`.
225
+ In a clone, `python main.py` is the same command as `luna`.
226
+
227
+ On four cores of a shared login node (`JAX_PLATFORMS=cpu`) each took under three
228
+ minutes. The first one ends with
229
+
230
+ ```
231
+ [gas] done: 195 steps, t=2.45000e-01, 14.5s
232
+
233
+ ============================================================
234
+ SIMULATION COMPLETED
235
+ ============================================================
236
+ ✓ Total runtime: 14.50 seconds
237
+ ✓ Total steps: 195
238
+ ✓ Final time: 0.24500
239
+ ```
240
+
241
+ Snapshots are written to `output_dir` (default `snapshots/`) as `snapdir_NNN/` HDF5
242
+ directories, together with `history.csv` and `run.json` (the settings, the command line
243
+ and the code revision). An unknown field name is an error, not a warning. Problem
244
+ parameters are set as `problem.<name>=value`. [docs/TUTORIAL.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/TUTORIAL.md) walks
245
+ through a first run, and [docs/RUNNING.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/RUNNING.md) covers production runs.
246
+
247
+ ## Clusters and GPUs
248
+
249
+ Start one process per GPU with `srun`; JAX's distributed runtime picks up the SLURM
250
+ environment, and `MESH_SHAPE` chooses how the grid is split across the processes:
251
+
252
+ ```bash
253
+ srun luna my_run.py test_problem=Sedov-Blast-3D SPATIAL_DIMENSION=3 \
254
+ Nx=1024 Ny=1024 Nz=1024 MESH_SHAPE=2,4,4
255
+ ```
256
+
257
+ SLURM templates for NVIDIA and AMD nodes are in [submit/examples/](https://github.com/Ulli1991/LUNA/tree/v0.1.0/submit/examples/).
258
+
259
+ Measured weak scaling (not a test; method, job ids and the strong-scaling data are in
260
+ [docs/GALLERY.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/GALLERY.md)): 3D Sedov blast, 512³ cells per GPU, FP32, on
261
+ JUPITER's NVIDIA GH200 nodes, from 2.19 Gcell-updates/s on one GPU to 7.99 Tcell-updates/s
262
+ on 4096 GPUs (8192³ cells), 88.9 % weak-scaling efficiency. No FP64 run was made at 4096 GPUs.
263
+
264
+ <img src="https://raw.githubusercontent.com/Ulli1991/LUNA/v0.1.0/code_paper_figs/scaling_jupiter.png" alt="LUNA weak and strong scaling on JUPITER GH200">
265
+
266
+ ## Interactive use (Jupyter)
267
+
268
+ [examples/notebooks/](https://github.com/Ulli1991/LUNA/tree/v0.1.0/examples/notebooks/) has small CPU notebooks that go through the same
269
+ path as `main.py` (`luna.launch(Config)`, which starts JAX and calls `luna.main.run`). Each runs
270
+ in a few minutes on four CPU cores, FP64, on grids far smaller than the tests' (the test file is
271
+ named in each), and compares with an exact or published solution:
272
+
273
+ | notebook | what it compares | status (docs/CLAIMS.md) |
274
+ |---|---|---|
275
+ | 01_sod_shock_tube | Sod tube against the exact Riemann solution | validated |
276
+ | 02_kelvin_helmholtz | 2D KH run (a demonstration, no reference) | - |
277
+ | 03_shock_tubes | Toro tests 1-5, HLLC and HLL, against the exact Riemann solution | validated |
278
+ | 04_sedov_taylor | 2D off-axis and 3D Sedov-Taylor against the exact solution | 2D validated, 3D shown |
279
+ | 05_noh | planar and cylindrical Noh against Noh (1987) | validated |
280
+ | 06_linear_waves | sound, entropy and shear waves: convergence order | validated |
281
+ | 07_gresho_vortex | Gresho vortex: velocity error and kinetic-energy loss vs resolution | validated |
282
+ | 08_kelvin_helmholtz_validation | KH linear growth vs linear theory; McNally et al. (2012) vs the Pencil Code | validated |
283
+ | 09_jeans_waves | Jeans waves against the linear dispersion relation | validated |
284
+ | 10_cosmology_tophat | comoving top-hat collapse against the closed-FRW solution | validated |
285
+ | 11_autodiff_gradients | gradients of a Sedov run: forward-mode AD vs finite differences and Sedov scaling | validated (AD vs FD), shown (whole runs) |
286
+ | 12_custom_problem | your own initial state through `launch(cfg, ic=...)` (a demonstration) | - |
287
+
288
+ They need `pip install -e ".[plot,notebooks]"`; 08 also needs the reference solutions
289
+ (below). How to add a problem of your own, from a run file to a registered, tested problem:
290
+ [docs/ADDING_A_PROBLEM.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/ADDING_A_PROBLEM.md). From Python:
291
+
292
+ ```python
293
+ from dataclasses import replace
294
+ from luna import Config, launch
295
+
296
+ res = launch(replace(Config(), test_problem="Sedov-Blast-3D", SPATIAL_DIMENSION=3,
297
+ Nx=32, Ny=32, Nz=32, output_dir="snapshots/sedov32"))
298
+ print(res.t, res.n_steps) # final state in res.extra["U"]
299
+ ```
300
+
301
+ ## Tests and reference data
302
+
303
+ ```bash
304
+ pip install -e ".[plot,test]" # in the clone
305
+ python tools/run_tests.py # the fast tier on CPU, as CI runs it
306
+ ```
307
+
308
+ The tests need the clone and the reference solutions below; how to run them and the
309
+ rules for new tests are in [CONTRIBUTING.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/CONTRIBUTING.md).
310
+
311
+ Reference solutions (outputs of AthenaK, Arepo, RAMSES, the Pencil Code and AMReX
312
+ Microphysics, spectral solutions, and LUNA's own high-resolution runs for the
313
+ regression-only tests) live in a separate repository,
314
+ [luna-reference-solutions](https://github.com/Ulli1991/luna-reference-solutions). Tests
315
+ look for it in `$LUNA_REFERENCE_SOLUTIONS`, then next to the LUNA checkout
316
+ (`../luna-reference-solutions`), then in `~/luna-reference-solutions`, and check every
317
+ file's sha256 against its `MANIFEST.json`; a missing or altered file is an error, not a
318
+ skip. Other codes are used only as accuracy references.
319
+
320
+ ```bash
321
+ git clone https://github.com/Ulli1991/luna-reference-solutions.git ../luna-reference-solutions
322
+ ```
323
+
324
+ Public CI runs the fast tier on CPU, once on one device and once on two virtual devices
325
+ (`--devices 2`, which exercises the halo exchange), plus `ruff check`. The GPU and
326
+ multi-node tiers run on the author's clusters ([docs/TESTING.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/TESTING.md)).
327
+
328
+ ## Documentation
329
+
330
+ | | |
331
+ |---|---|
332
+ | [docs/CLAIMS.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/CLAIMS.md) | every claim, the test that asserts it, its status |
333
+ | [docs/TUTORIAL.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/TUTORIAL.md) | a first run, step by step |
334
+ | [docs/RUNNING.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/RUNNING.md) | configuration, multi-GPU and production runs |
335
+ | [docs/CONFIG.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/CONFIG.md) | every field of `Config` |
336
+ | [docs/ARCHITECTURE.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/ARCHITECTURE.md) | how the code fits together |
337
+ | [docs/TESTING.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/TESTING.md) | the test suite and its tiers |
338
+ | [docs/GALLERY.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/docs/GALLERY.md) | figures and the scaling measurements |
339
+
340
+ ## Citation
341
+
342
+ Please cite LUNA through [`CITATION.cff`](https://github.com/Ulli1991/LUNA/blob/v0.1.0/CITATION.cff) (GitHub shows it under "Cite this
343
+ repository").
344
+
345
+ ## License
346
+
347
+ BSD 3-Clause; see [LICENSE](https://github.com/Ulli1991/LUNA/blob/v0.1.0/LICENSE). The AMR layer derives from JAX-AMR (MIT;
348
+ [src/luna/amr/LICENSE-JAX-AMR](https://github.com/Ulli1991/LUNA/blob/v0.1.0/src/luna/amr/LICENSE-JAX-AMR)).
349
+
350
+ ## Contributing
351
+
352
+ Bug reports and questions: GitHub issues. Pull requests are welcome; see
353
+ [CONTRIBUTING.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/Ulli1991/LUNA/blob/v0.1.0/CODE_OF_CONDUCT.md).
354
+ Changes are listed in [CHANGELOG.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/CHANGELOG.md); third-party code and data, with
355
+ their licences, in [THIRD_PARTY.md](https://github.com/Ulli1991/LUNA/blob/v0.1.0/THIRD_PARTY.md).