pynbody / genetIC

The GM initial conditions generator
GNU General Public License v3.0
21 stars 8 forks source link

Fix for issue #90 #91

Closed apontzen closed 3 years ago

apontzen commented 3 years ago

@Martin-Rey This attempts to fix your issue #90

Currently it does not pass all unit tests for reasons which I don't quite understand, and therefore shouldn't be used for production purposes yet. But I'd be interested to hear if it actually works to address the problem on your real-world example.

Martin-Rey commented 3 years ago

Running on this PR, I get a different assertion error after opening the first zoom level, coming from the newly coded logic added in a6c5ea9

genetIC v1.1.1, compiled: May  7 2021, 09:33:06
              runtime:  May 07 2021, 09:33:28

git HEAD:55fc01d
At the time of compilation, the following files had been modified:
  Makefile

 2021-05-07 09:33:28   
 2021-05-07 09:33:28   Limiting number of FFTW Threads to 8, because FFTW on Mac OS seems to become slow beyond this point.
 2021-05-07 09:33:28   To disable this behaviour, recompile with -DIGNORE_APPLE_FFTW_THREAD_LIMIT
 2021-05-07 09:33:28   OpenMP parts of the code will still run with 12 threads.
 2021-05-07 09:33:28   
 2021-05-07 09:33:28   Using post 2015 CAMB transfer function
 2021-05-07 09:33:28   Initialized the base grid:
 2021-05-07 09:33:28     Box length            = 67.32 Mpc/h
 2021-05-07 09:33:28     n                     = 256
 2021-05-07 09:33:28     dx                    = 0.262969
 2021-05-07 09:33:28   Adding real grid with resolution 256
 2021-05-07 09:33:28   Loading ../void/void.iords.txt
 2021-05-07 09:33:28     -> total number of particle IDs loaded is 119826
 2021-05-07 09:33:28        total number of accessible cells flagged is 119826
 2021-05-07 09:33:28   Centre of region is 17.8711588248 58.6582382854 25.0155118907
 2021-05-07 09:33:28   Initialized a zoom region:
 2021-05-07 09:33:28     Subbox length         = 33.66 Mpc/h
 2021-05-07 09:33:28     n                     = 256
 2021-05-07 09:33:28     dx                    = 0.131484375
 2021-05-07 09:33:28     Zoom factor           = 2
 2021-05-07 09:33:28     Num particles         = 119826
 2021-05-07 09:33:28     Low-left corner in parent grid = (3, 161, 35)
 2021-05-07 09:33:28     Low-left corner (h**-1 Mpc)    = 0.78890625, 42.33796875, 9.20390625
 2021-05-07 09:33:28   Adding real grid with resolution 256
 2021-05-07 09:33:28   Adding real grid with resolution 512
 2021-05-07 09:33:28     Total particles       = 33554432
Assertion failed: (moveDistance[dim]==0), function moveInto, file /Users/martinrey/Documents/genetIC/genetIC/src/simulation/window.hpp, line 257.
apontzen commented 3 years ago

Thanks! This is also the issue that the tests highlight so I will try to figure it out then ping you again.

apontzen commented 3 years ago

@Martin-Rey Tests are passing now - please give it another go!

Martin-Rey commented 3 years ago

The latest commit runs without problem! I don't have enough memory on my local setup to actually produce the ICs, but it goes through the previously failing part in #90, and successfully clips the problematic y-coordinate of the lower left corner to 0 when creating the last zoom (which I assume is the intended behaviour).

genetIC v1.1.1, compiled: May  7 2021, 13:05:36
              runtime:  May 07 2021, 13:05:58

git HEAD:4c97b12
At the time of compilation, the following files had been modified:
  Makefile

 2021-05-07 13:05:58   
 2021-05-07 13:05:58   Limiting number of FFTW Threads to 8, because FFTW on Mac OS seems to become slow beyond this point.
 2021-05-07 13:05:58   To disable this behaviour, recompile with -DIGNORE_APPLE_FFTW_THREAD_LIMIT
 2021-05-07 13:05:58   OpenMP parts of the code will still run with 12 threads.
 2021-05-07 13:05:58   
 2021-05-07 13:05:58   Initialized the base grid:
 2021-05-07 13:05:58     Box length            = 67.32 Mpc/h
 2021-05-07 13:05:58     n                     = 256
 2021-05-07 13:05:58     dx                    = 0.262969
 2021-05-07 13:05:58   Adding real grid with resolution 256
 2021-05-07 13:05:58   Centre of region is 17.8711588248 58.6582382854 25.0155118907
 2021-05-07 13:05:58   Initialized a zoom region:
 2021-05-07 13:05:58     Subbox length         = 33.66 Mpc/h
 2021-05-07 13:05:58     n                     = 256
 2021-05-07 13:05:58     dx                    = 0.131484375
 2021-05-07 13:05:58     Zoom factor           = 2
 2021-05-07 13:05:58     Num particles         = 119826
 2021-05-07 13:05:58     Low-left corner in parent grid = (3, 161, 35)
 2021-05-07 13:05:58     Low-left corner (h**-1 Mpc)    = 0.78890625, 42.33796875, 9.20390625
 2021-05-07 13:05:58   Adding real grid with resolution 256
 2021-05-07 13:05:58   Adding real grid with resolution 512
 2021-05-07 13:05:58     Total particles       = 33554432
 2021-05-07 13:06:11   Initialized a zoom region:
 2021-05-07 13:06:11     Subbox length         = 16.83 Mpc/h
 2021-05-07 13:06:11     n                     = 256
 2021-05-07 13:06:11     dx                    = 0.0657421875
 2021-05-07 13:06:11     Zoom factor           = 2
 2021-05-07 13:06:11     Num particles         = 1481544
 2021-05-07 13:06:11     Low-left corner in parent grid = (65, 59, 55)
 2021-05-07 13:06:11     Low-left corner (h**-1 Mpc)    = 9.335390625, 50.095546875, 16.435546875
 2021-05-07 13:06:11   Adding real grid with resolution 256
 2021-05-07 13:06:11   Adding real grid with resolution 512
 2021-05-07 13:06:11   Adding real grid with resolution 1024
 2021-05-07 13:06:11     Total particles       = 50331648
 2021-05-07 13:06:40   Initialized a zoom region:
 2021-05-07 13:06:40     Subbox length         = 8.415 Mpc/h
 2021-05-07 13:06:40     n                     = 512
 2021-05-07 13:06:40     dx                    = 0.016435546875
 2021-05-07 13:06:40     Zoom factor           = 2
 2021-05-07 13:06:40     Num particles         = 1670998
 2021-05-07 13:06:40     Low-left corner in parent grid = (65, 66, 66)
 2021-05-07 13:06:40     Low-left corner (h**-1 Mpc)    = 13.6086328125, 54.43453125, 20.77453125
 2021-05-07 13:06:40   Adding real grid with resolution 256
 2021-05-07 13:06:40   Adding real grid with resolution 512
 2021-05-07 13:06:40   Adding real grid with resolution 1024
 2021-05-07 13:06:40   Adding virtual grid with effective resolution 2048
 2021-05-07 13:06:40   Adding real grid with resolution 4096
 2021-05-07 13:06:40     Total particles       = 201326592
 2021-05-07 13:08:27   Centre of region is 20.5155946842 55.0619393569 25.4002363884
 2021-05-07 13:08:27   Initialized a zoom region:
 2021-05-07 13:08:27     Subbox length         = 2.10375 Mpc/h
 2021-05-07 13:08:27     n                     = 512
 2021-05-07 13:08:27     dx                    = 0.00410888671875
 2021-05-07 13:08:27     Zoom factor           = 4
 2021-05-07 13:08:27     Num particles         = 19767
 2021-05-07 13:08:27     Low-left corner in parent grid = (355, 0, 217)
 2021-05-07 13:08:27     Low-left corner (h**-1 Mpc)    = 19.4432519531, 54.43453125, 24.3410449219
 2021-05-07 13:08:27   Adding real grid with resolution 256
 2021-05-07 13:08:27   Adding real grid with resolution 512
 2021-05-07 13:08:27   Adding real grid with resolution 1024
 2021-05-07 13:08:27   Adding virtual grid with effective resolution 2048
 2021-05-07 13:08:27   Adding real grid with resolution 4096
 2021-05-07 13:08:27   Adding virtual grid with effective resolution 8192
 2021-05-07 13:08:27   Adding real grid with resolution 16384
 2021-05-07 13:08:27     Total particles       = 352321536
 2021-05-07 13:08:28   Adding real grid with resolution 256
 2021-05-07 13:08:28   Adding real grid with resolution 512
 2021-05-07 13:08:28   Adding real grid with resolution 1024
 2021-05-07 13:08:28   Adding virtual grid with effective resolution 2048
 2021-05-07 13:08:28   Adding real grid with resolution 4096
 2021-05-07 13:08:28   Adding virtual grid with effective resolution 8192
 2021-05-07 13:08:28   Adding real grid with resolution 16384
 2021-05-07 13:08:28   Adding virtual grid with effective resolution 32768
 2021-05-07 13:08:28   Adding virtual grid with effective resolution 65536
 2021-05-07 13:08:29   Drawing random numbers (base grid)
  100% |---------------------------------------------------------------------------------------------------------------------------|                     
 2021-05-07 13:08:30   Drawing random numbers (zoom level 1)
  100% |---------------------------------------------------------------------------------------------------------------------------|                     
 2021-05-07 13:08:31   Drawing random numbers (zoom level 2)
  100% |---------------------------------------------------------------------------------------------------------------------------|                     
 2021-05-07 13:08:31   Drawing random numbers (zoom level 3)
  100% |---------------------------------------------------------------------------------------------------------------------------|                     
 2021-05-07 13:08:35   Drawing random numbers (zoom level 4)
  100% |---------------------------------------------------------------------------------------------------------------------------|