cold and hot gas

Maryam salimi
  • 1
  • 3 Oct '20

Hi.

I have some IDs and I followed the mass evolution of gas for them ,like task9 in API tutorial .But I want to have evolution of cold and hot gas separately for them ,and I don 't know how to do it .

I 'll be grateful for your help .

Dylan Nelson
  • 5 Oct '20

Hi Maryam,

This is relatively easy (like Task 9) only for properties of galaxies/halos which are already stored in the group catalog. You can see the full list of these in the documentation.

However, "cold gas mass" and "hot gas mass" are not in the group catalog, you would need to compute these yourself, from the particle data of the snapshot, under whatever definition (e.g. temperature cut) you wish. What you would do is: (i) follow Task 9 get to the SnapNum and SubfindID backwards in time. (ii) for each snapshot, load the gas cells of the subhalo at that time, compute quantities of interest, and save these to an array or file. (iii) plot.

Maryam salimi
  • 3
  • 10 Nov '20

Hello,
Thank you very much Nelson,

I did what you said, but I have another question:

I wrote the code as follows:

redshift = 0.0
scale_factor = 1.0 / (1+redshift)

for id in ids:
baseUrl = "http://www.tng-project.org/api/TNG300-1/" #I used the TNG site address for Url.
start_url = baseUrl + "snapshots/z=" + str(redshift) + "/subhalos/" + str(id)
sub = get(start_url)

# get cutout of gas positions and masses
# we downloaded cutout of all ids 

# Estimate temperature for all gas particle of ID & estimate sum of cold & hot gas mass:
with h5py.File('cutout_'+str(id)+'.hdf5','r') as f:

    u           = f['PartType0']['InternalEnergy'][:]    #  the Internal Energy
    Xe          = f['PartType0']['ElectronAbundance'][:]  # xe (=ne/nH)  the electron abundance
    XH          = 0.76             # the hydrogen mass fraction
    gamma        = 5.0/3.0          # the adiabatic index
    KB          = 1.3807e-16       # the Boltzmann constant in CGS units  [cm^2 g s^-2 K^-1]
    mp          = 1.6726e-24       # the proton mass  [g]
    little_h    = 0.704                 # NOTE: 0.6775 for all TNG simulations
    mu          = (4*mp)/(1+3*XH+4*XH*Xe)

    # Estimate temperature  
    temperature = (gamma-1)* (u/KB)* mu* 1e10


    cold_gas = np.where(  (np.log10(temperature) < 5.0) )
    hot_gas  = np.where(  (np.log10(temperature) > 5.0) )

    cold_gas_mass = sum( mass [cold_gas] )
    hot_gas_mass  = sum( mass [hot_gas] )

    print 'cold_gas_mass = ' , cold_gas_mass
    print 'hot_gas_mass = '  , hot_gas_mass

I considered (log T < 5) for cold gas and (log T > 5) for hot gas. But when I ask the total mass of cold gas from it, it shows the number zero.
Do you think I made a mistake somewhere?

Thank you for your help.

Dylan Nelson
  • 10 Nov '20

Hello,

Looks good, except the 10e10 should be 1e10, which may solve the issue.

Maryam salimi
  • 1
  • 10 Nov '20

Oops
That was a bad mistake!
But by modifying it, it still shows cold gas mass = 0 .
By running the above code, it shows the following numbers:

cold_gas_mass = 0
hot_gas_mass = 208517.24069929123

I ran these codes for three different IDs with very different masses, but for all three IDs the amount of cold gas is zero.
Is this T = 10^5 suitable for separating hot and cold gas? Because when I run the code for T = 10^7, for example, it has a value for both hot and cold gas (When I print the temperature for all the particles in an ID, no particle has a temperature lower than T = 10^5).

Dylan Nelson
  • 10 Nov '20

HI Maryam,

You can make a histogram of gas cell temperature, to decide what cut(s) might be appropriate.

In general, you will find gas between 1e4 and 1e8 K in the simulations.

A value for separating hot and cold depends on your scientific goals.

One note: we frequently take the "star-forming gas" (StarFormationRate > 0) as cold, and the rest as hot. This is because star forming gas in the model is, by mass, assumed to be <<1e4 K, and this is most analogous to many common observational "cold" gas measures, e.g. neutral/molecular gas.

Maryam salimi
  • 11 Nov '20

HI Nelson,

Thank you very much for your time and thank you for your guidance.

  • Page 1 of 1