pelahi / VELOCIraptor-STF

Galaxy/(sub)Halo finder for N-body simulations
MIT License
19 stars 27 forks source link

Running on Zooms #39

Closed JBorrow closed 5 years ago

JBorrow commented 5 years ago

Describe the bug Code seems to be attemping to read particle types that do not exist when running in post-processing, causing a segfault.

To Reproduce

Seems that it's trying to load stars and black holes despite them being explicitly turned off in the parameter file? What am I doing wrong here?

Thanks!

MatthieuSchaller commented 5 years ago

What if you don't tell VR that this is a zoom? Will the code still attempt to read stars and BHs? Could be a non-zoom thing where everytime you switch on SWIFT-like input, the code looks for everything.

JBorrow commented 5 years ago

Could be this, yeah. Even when I turned off the -DVR_ZOOM_SIM=ON at configure time it still segfaults with the same message.

pelahi commented 5 years ago

Hi Josh, sorry for the late reply. I have analysed nifty with VR and had no issues. I used the following configuration:

HDF_name_convention=6 #HDF SWIFT naming convention Input_includes_dm_particle=1 #include dark matter particles in hydro input Input_includes_gas_particle=1 #include gas particles in hydro input Input_includes_star_particle=0 #include star particles in hydro input Input_includes_bh_particle=0 #include bh particles in hydro input Input_includes_wind_particle=0 #include wind particles in hydro input Input_includes_tracer_particle=0 #include tracer particles in hydro input (used by Illustris). Input_includes_extradm_particle=1 #include extra dm particles stored in particle type 2 and type 3, useful for zooms

JBorrow commented 5 years ago

Hi Pascal, those are the same options that I've been running with, unfortunately. I've also been attempting to run on regular SWIFT data and it seems that I also segfault there. I think the problem is that the code, even though it's told that it should not 'expect' e.g. PartType5, by setting Input_includes_bh_particle=0, still goes looking for it. Happy to provide parameter files and test data if this is of use. I'm using the master (as of today) for this.

JBorrow commented 5 years ago

Ok, I have isolated this bug to line 321 of hdfio.cxx. It appears that when running with SWIFT, this gets handed an array of 3 doubles, not a double, and this freaks the code out. I'll take a deeper look and try and post a fix.

JBorrow commented 5 years ago

Hi, so now the code doesn't crash when running but it seems to not be able to find any substructures. I'm using the feature/chemistry branch, running on here: http://virgodb.cosma.dur.ac.uk/swift-webstorage/nifty_new_0_structures.hdf5 with this parameter file:

#runs 6DFOF + substructure algorithm, demands subhalos and FOF halos be self-bound, calculates many properties
#Units currently set to take in as input, Mpc, 1e10 solar masses, km/s, output in same units
#To set temporally unique halo ids, alter Snapshot_value=SNAP to appropriate value. Ie: for snapshot 12, change SNAP to 12

################################
#unit options, should always be provided
################################
#EDIT THIS SECTION!!!!

#naming convention is EAGLE Hydro. This config will be generalised to allow specific naming conventions to be implemented besides predefined ones
HDF_name_convention=6
Input_includes_dm_particle=1
Input_includes_star_particle=0 #include star particles in hydro input
Input_includes_bh_particle=0 #include bh particles in hydro input
Input_includes_wind_particle=0 #include wind particles in hydro input (used by Illustris and moves particle type 0 to particle type 3 when decoupled from hydro forces). Here shown as example
Input_includes_tracer_particle=0 #include tracer particles in hydro input (used by Illustris). Here shown as example
Input_includes_extradm_particle=1 #include extra dm particles stored in particle type 2 and type 3, useful for zooms

#units conversion from input input to desired internal unit
Length_unit=1.0 #default code unit,
Velocity_unit=1.0 #default velocity unit,
Mass_unit=1.0 #default mass unit,
#assumes input is in 1e10 msun, Mpc and km/s and output units are the same
Gravity=43.0211349 #for 1e10 Msun, km/s and Mpc
Hubble_unit=100.0 # assuming units are km/s and Mpc, then value of Hubble in km/s/Mpc

#conversion of output length units to kpc
Length_unit_to_kpc=1.0
#conversion of output velocity units to km/s
Velocity_to_kms=1.0
#conversion of output mass units to solar masses
Mass_to_solarmass=1.0e10

################################
#input related
################################
#input is from a cosmological so can use parameters like box size, h, Omega_m to calculate length and density scales
Cosmological_input=1
#sets the total buffer size in bytes used to store temporary particle information
#of mpi read threads before they are broadcast to the appropriate waiting non-read threads
#if not set, default value is equivalent to 1e6 particles per mpi process, quite large
#but significantly minimises the number of send/receives
#in this example the buffer size is roughly that for a send/receive of 10000 particles
#for 100 mpi processes
MPI_particle_total_buf_size=100000000

################################
#search related options
################################

#how to search a simulation
Particle_search_type=1 #search dark matter particles only
#for baryon search
Baryon_searchflag=2 #if 1 search for baryons separately using phase-space search when identifying substructures, 2 allows special treatment in field FOF linking and phase-space substructure search, 0 treat the same as dark matter particles
#for search for substruture
Search_for_substructure=1 #if 0, end search once field objects are found
#also useful for zoom simulations or simulations of individual objects, setting this flag means no field structure search is run
Singlehalo_search=0 #if file is single halo in which one wishes to search for substructure. Here disabled.
#additional option for field haloes
Keep_FOF=0 #if field 6DFOF search is done, allows to keep structures found in 3DFOF (can be interpreted as the inter halo stellar mass when only stellar search is used).\n

#minimum size for structures
Minimum_size=20 #min particles
Minimum_halo_size=32 #if field halos have different minimum sizes, otherwise set to -1.

#for field fof halo search
FoF_Field_search_type=3 #5 3DFOF search for field halos, 4 for 6DFOF clean up of field halos, 3 for 6DFOF with velocity scale distinct for each initial 3D FOF candidate
Halo_3D_linking_length=0.20

#for mean field estimates and local velocity density distribution funciton estimator related quantiites, rarely need to change this
Local_velocity_density_approximate_calculation=1 #calculates velocity density using approximative (and quicker) near neighbour search
Cell_fraction = 0.01 #fraction of field fof halo used to determine mean velocity distribution function. Typical values are ~0.005-0.02
Grid_type=1 #normal entropy based grid, shouldn't have to change
Nsearch_velocity=32 #number of velocity neighbours used to calculate local velocity distribution function. Typial values are ~32
Nsearch_physical=256 #numerof physical neighbours from which the nearest velocity neighbour set is based. Typical values are 128-512

#for substructure search, rarely ever need to change this
FoF_search_type=1 #default phase-space FOF search. Don't really need to change
Iterative_searchflag=1 #iterative substructure search, for substructure find initial candidate substructures with smaller linking lengths then expand search region
Outlier_threshold=2.5 #outlier threshold for a particle to be considered residing in substructure, that is how dynamically distinct a particle is. Typical values are >2
Substructure_physical_linking_length=0.10
Velocity_ratio=2.0 #ratio of speeds used in phase-space FOF
Velocity_opening_angle=0.10 #angle between velocities. 18 degrees here, typical values are ~10-30
Velocity_linking_length=0.20 #where scaled by structure dispersion
Significance_level=1.0 #how significant a substructure is relative to Poisson noise. Values >= 1 are fine.

#for iterative substructure search, rarely ever need to change this
Iterative_threshold_factor=1.0 #change in threshold value when using iterative search. Here no increase in threshold if iterative or not
Iterative_linking_length_factor=2.0 #increase in final linking final iterative substructure search 
Iterative_Vratio_factor=1.0 #change in Vratio when using iterative search. no change in vratio
Iterative_ThetaOp_factor=1.0 #change in velocity opening angle. no change in velocity opening angle

#for checking for halo merger remnants, which are defined as large, well separated phase-space density maxima
Halo_core_search=2 # searches for separate 6dfof cores in field haloes, and then more than just flags halo as merging, assigns particles to each merging "halo". 2 is full separation, 1 is flagging, 0 is off
#if searching for cores, linking lengths. likely does not need to change much
Use_adaptive_core_search=0 #calculate dispersions in configuration & vel space to determine linking lengths
Use_phase_tensor_core_growth=2 #use full stepped phase-space tensor assignment
Halo_core_ellx_fac=0.7 #how linking lengths are changed when searching for local 6DFOF cores,
Halo_core_ellv_fac=2.0 #how velocity lengths based on dispersions are changed when searching for local 6DFOF cores
Halo_core_ncellfac=0.005 #fraction of total halo particle number setting min size of a local 6DFOF core
Halo_core_num_loops=8 #number of loops to iteratively search for cores
Halo_core_loop_ellx_fac=0.75 #how much to change the configuration space linking per iteration
Halo_core_loop_ellv_fac=1.0 #how much to change the velocity space linking per iteration
Halo_core_loop_elln_fac=1.2 #how much to change the min number of particles per iteration
Halo_core_phase_significance=2.0 #how significant a core must be in terms of dispersions (sigma) significance

################################
#Unbinding options (VELOCIraptor is able to accurately identify tidal debris so particles need not be bound to a structure)
################################
#unbinding related items
Unbind_flag=1 #run unbinding
#objects must have particles that meet the allowed kinetic to potential ratio AND also have some total fraction that are completely bound.
Unbinding_type=0
#run unbinding of field structures, aka halos. This is useful for sams and 6DFOF halos but may not be useful if interested in 3DFOF mass functions.
Bound_halos=0
#alpha factor used to determine whether particle is "bound" alaph*T+W<0. For standard subhalo catalogues use >0.9 but if interested in tidal debris 0.2-0.5
Allowed_kinetic_potential_ratio=0.95
Min_bound_mass_frac=0.65 #minimum bound mass fraction
#don't keep background potential when unbinding, faster than recalculating
Keep_background_potential=1
Softening_length=0.0
Frac_pot_ref=1.0
Min_npot_ref=20
Kinetic_reference_frame_type=0
#extra options in new unbinding optimisation
Unbinding_max_unbound_removal_fraction_per_iteration=0.5
Unbinding_max_unbound_fraction=0.95
Unbinding_max_unbound_fraction_allowed=0.025

################################
#Calculation of properties related options
################################
Virial_density=500 #user defined virial overdensity. Note that 200 rho_c, 200 rho_m and BN98 are already calculated.
#when calculating properties, for field objects calculate inclusive masses
Inclusive_halo_masses=3 #calculate inclusive masses for halos using full Spherical overdensity apertures
#ensures that output is physical and not comoving distances per little h
Comoving_units=0
#calculate more (sub)halo properties (like angular momentum in spherical overdensity apertures, both inclusive and exclusive)
Extensive_halo_properties_output=1
#calculate aperture masses
Calculate_aperture_quantities=1 
Number_of_apertures=5
Aperture_values_in_kpc=5,10,30,50,100,
Number_of_projected_apertures=5
Projected_aperture_values_in_kpc=5,10,30,50,100,
#calculate radial profiles
Calculate_radial_profiles=1
Number_of_radial_profile_bin_edges=20
#default radial normalisation log rad bins, normed by R200crit, Integer flag of 0 is log bins and R200crit norm. 
Radial_profile_norm=0
Radial_profile_bin_edges=-2.,-1.87379263,-1.74758526,-1.62137789,-1.49517052,-1.36896316,-1.24275579,-1.11654842,-0.99034105,-0.86413368,-0.73792631,-0.61171894,-0.48551157,-0.3593042,-0.23309684,-0.10688947,0.0193179,0.14552527,0.27173264,0.39794001,
Iterate_cm_flag=0 #do not interate to determine centre-of-mass
Sort_by_binding_energy=1 #sort particles by binding energy
Reference_frame_for_properties=2 #use the minimum potential as reference frame about which to calculate properties 

################################
#output related
################################

Write_group_array_file=0 #do not write a group array file
Separate_output_files=0 #do not separate output into field and substructure files similar to subfind
Binary_output=2 #Use HDF5 output (binary output 1, ascii 0, and HDF 2)
#output particles residing in the spherical overdensity apertures of halos, only the particles exclusively belonging to halos
Spherical_overdensity_halo_particle_list_output=1

#halo ids are adjusted by this value * 1000000000000 (or 1000000 if code compiled with the LONGINTS option turned off)
#to ensure that halo ids are temporally unique. So if you had 100 snapshots, for snap 100 set this to 100 and 100*1000000000000 will
#be added to the halo id as set for this snapshot, so halo 1 becomes halo 100*1000000000000+1 and halo 1 of snap 0 would just have ID=1

#ALTER THIS as part of a script to get temporally unique ids
Snapshot_value=SNAP

################################
#other options
################################
Verbose=1 #how talkative do you want the code to be, 0 not much, 1 a lot, 2 chatterbox

Metallicity_to_solarmetallicity=1.0 #conversion of output to solarmetallicity
Star_formation_rate_to_solarmassperyear=1.0 #similar but for star formation rates
Stellar_age_to_yr=1.0 #similar but for stellar ages
Stellar_age_input_is_cosmological_scalefactor=1 #indicates stars store formation scalefactor 
Metallicity_input_unit_conversion_to_output_unit=1.0 
Stellar_age_input_unit_conversion_to_output_unit=1.0
Star_formation_rate_input_unit_conversion_to_output_unit=1.0

Invoking with


./stf -I 2 -i nifty_new_0_structures.hdf5 -C vrconfig_6dfofbound_subhalos_SO_hydro.cfg -o ./halo/nifty_0292

Compiling with

cmake .. -DCMAKE_CXX_FLAGS="-O3 -march=native" -DVR_ZOOM_SIM=on -DVR_USE_GAS=ON
pelahi commented 5 years ago

Hi Josh, I just ran the code with the chemistry branch and there is lots of substructure. I think the issue is that the units are incorrect and all the substructure is considered unbound. ` Length_unit=1.0 #default code unit, Velocity_unit=1.0 #default velocity unit, Mass_unit=1.0 #default mass unit,

assumes input is in 1e10 msun, Mpc and km/s and output units are the same

Gravity=43.0211349 #for 1e10 Msun, km/s and Mpc Hubble_unit=100.0 # assuming units are km/s and Mpc, then value of Hubble in km/s/Mpc

conversion of output length units to kpc

Length_unit_to_kpc=1.0

conversion of output velocity units to km/s

Velocity_to_kms=1.0

conversion of output mass units to solar masses

Mass_to_solarmass=1.0e10 ` The above assumes that the input is Mpc but the input file is kpc. So the gravitational unit is too small by a factor of 1e3. The above values should be

` Length_unit=1.0 #default code unit, Velocity_unit=1.0 #default velocity unit, Mass_unit=1.0 #default mass unit,

assumes input is in 1e10 msun, kpc and km/s and output units are the same

Gravity=43.0211349e3 #for 1e10 Msun, km/s and kpc Hubble_unit=0.1 # assuming units are km/s and kpc, then value of Hubble in km/s/kpc

conversion of output length units to kpc

Length_unit_to_kpc=1.0

conversion of output velocity units to km/s

Velocity_to_kms=1.0

conversion of output mass units to solar masses

Mass_to_solarmass=1.0e10 `

I plan on updating the code to make use of the extra information in swift snapshots to set the units.

JBorrow commented 5 years ago

Thanks, that fixed it.