Hello, I am creating radial profiles of the masses of dm,gas,bh,and stars. My counts add up perfectly for bh, and close for gas. However, I know that dm doesn't have a mass field, so I was using SubfindDensity, however, when I try to divide by the scale factor's I don't get the right numerical answer for the total dm mass content of the subhalo. What I wanted to do was to multiply by the volume to ensure that the units of the dm density are the same as those of gas, stars, and bh, but I don't know the volume of each dm unit cell.
The DM is treated purely as particles (as are the stars), and they have no concept of an associated volume.
The mass of all DM particles is constant, you can get the exact value from the MassTable entry of the snapshot Header, under entry 1 for PartType1.
So, in making a radial profile, if you just get a count of how many DM particles are within a radius or radial bin, then that count multiplied by their constant mass gives the total DM mass within that radius, or in that radial bin. You shouldn't use SubfindDensity for this, as it means something a little different.
Hello Dr. Nelson,
this makes sense. What I can do is use the coordinate dx to count the number of coordinates denoted in each sphere and then multiply the len of this coordinate count by the mass of each dark matter particle, and do the same procedure for the stars.
Thanks for your help.
While this is formally correct for the DM, it is only an approximation for the stars, since they do have individually variable masses (although roughly within a factor of plus/minus 2.0 times their mean, so the approximation should generally be ok). To be more precise for the stars, you'd want to do something e.g.
h = cosmo.load.snapshotHeader()
w_dm = np.where( (dm['rad'] > rad_min) & (dm['rad'] <= rad_max) )
dm_mass_inside = len(w_dm) * h['MassTable']
w_stars = np.where( (stars['rad'] > rad_min) & (stars['rad'] <= rad_max) )
stars_mass_inside = np.sum( stars['Masses'][w_stars] )
ok great, that's cleaner than my method of averaging over the star masses. Thanks for the script. Oh, one quick question. Is the cosmo function script on the script example page? I didn't see it there but then again I might have missed it.
Sorry, that was just meant to be an example. You just need to load the MassTable field from the Header group of any snapshot file.
Dear Dr. Nelson,
Sorry to barge into this 4 year old discussion, but I have a relevant question:
Is the DM particle mass independent of snapshot? Meaning, can I take it from here:
and it's equivalents for any different version of the simulation?
Thanks in advance.
Yes that's correct, unlike gas, stars, or BHs, the DM particle mass is constant (across particles and snapshots) for a given run. Those numbers should match to the table of runs.