Magnetic field evolution of a selected galaxy cluster

Yoan Rappaz
  • 1
  • 25 Apr


I want to "follow the magnetic field evolution" (as well as other plasma parameters) of a galaxy cluster, ideally with a mass greater than 10^14 Msol. I first wrote a code to target a cluster in the catalog and then extract sub-halo indices from its merger tree. Then I want to extract the magnetic field data (and other parameters) of the corresponding sub-halos.

However, every time I try to extract such data, I get an error message telling me that they don't exist, especially the magnetic field (other data are available, such as temperature and star formation rate).

In addition, the limited 10Gb cache memory in the Jupyter workspace doesn't allow me to extract all the required data.

Any help would be precious!
Thanks in advance!

My (short) code looks like that:

basePath = 'sims.TNG/TNG100-1/output/'
GroupFirstSub = il.groupcat.loadHalos(basePath,99,fields=['GroupFirstSub'])
w = np.where(GroupFirstSub >= 0)
central_subhalo_ids = GroupFirstSub[w]

fields = ['SubhaloMass','SubfindID','SnapNum','GroupPos']
tree = il.sublink.loadTree(basePath, 99, central_subhalo_ids[i], fields=fields, onlyMPB=True)
mass_sun = tree['SubhaloMass'] * 1e10 / 0.6774
snap_number = tree['SnapNum']
subhalo_ID = tree['SubfindID']

all_z = np.array([])
all_mean_bfield = np.array([])

for j in range(0, len(mass_sun)):
    halo_snap = il.snapshot.loadSubhalo(basePath, snap_number[j], subhalo_ID[j], 'gas',  fields=['MagneticField', 'Coordinates'])
Dylan Nelson
  • 28 Apr

The MagneticField is stored only for full snapshots (see the related column in the documentation for PartType0 fields). So you should loop only over full snapshots if you want to load this field.

Loading these two fields for a single subhalo shouldn't be a problem, even for a big cluster. You will eventually run out of memory, if you don't let it be freed as you loop. That is, for each snapshot you should probably calculate what you want, then delete/reuse "halo_snap". You may also want to load just the Coordinates, do what you want with them, and then load the MagneticField, reducing peak memory usage by ~2x.

  • Page 1 of 1