Utilities and interface for visualizing Cactus simulation data using the Unity Game Engine. Originally derived from Sebastian Lague's Marching Cubes project. Check out his video and code.
The script for preprocessing 3D Carpet HDF5 data can be found in Utils/save_resampled_grid_data.py. This relies on kuibit.
Run the script by using:
python save_resampled_grid_data.py --datadir (sim directory) --pickle-file (optional kuibit pickle file) --variable (grid variable to export) --iteration (iteration to export) --dataout (name of output files) -x0 (origin of export domain; x, y, z) -x1 (corner of export domain; x, y, z) --numchunks (chunk configuration; x, y, z)
The script essentially interpolates 3D data to x0 and x1 set the size of the region to be exported, and numchunks sets the resolution of export data. For example:
python save_resampled_grid_data.py --datadir myBNSRun --variable rho --iteration 102400 --dataout bns_MR -x0 -100 -100 -50 -x1 100 100 50 --numchunks 2 2 1
exports rho at iteration 102400 and stores exported data in a directory named bns_MR. Exported data will divide a domain of
After running save_resampled_grid_data, move the directory containing generated files to Assets/SimData. To render this data, enter the dataout name in the "Sim Name" text input field in the game Options menu.
You can add point masses that interact with the player in game. This information is provided in the (dataout)/(dataout)_pars.txt file generated by the script. For each neutron star, add a line
NSInfo: (Mass) (x) (y) (z)
where x, y, and z are the coordinates of the point mass in code units. The mass can be given in code units, although the "gravitational force" is currently a bit ad hoc, taking the player's mass to be 0.01 M. For a black hole, you can also set an "event horizon" radius, which will just be a black sphere generated in game:
BHInfo: (Mass) (Horizon radius) (x) (y) (z)