RE: Comoving Density Conversion Question

From: Cassandra Hall <cxh_at_roe.ac.uk>
Date: Thu, 6 Oct 2016 14:04:45 +0000

Hi Jared - unfortunately I can't answer your question, but I *think* (although I may be wrong) that yt can do this for you?

http://yt-project.org/

^ It generally makes life easier for simulation data

Cass
________________________________________
From: Jared Coughlin [Jared.W.Coughlin.29_at_nd.edu]
Sent: 06 October 2016 04:42
To: Gadget General Discussion
Subject: [gadget-list] Comoving Density Conversion Question

Hello! I know this is a pretty stupid question, but I'm drawing a blank on it so I figured I'd ask. I want to know how to convert density from comoving gadget units to proper cgs units. I've run a cosmological simulation (so comoving integration is on), which means that Gadget is writing the densities in comoving internal code units. For ease of talking about them, I've been calling a gadget unit of mass a GUM and a gadget unit of length a GUL.

(NOTE: I'm using the tex for gmail plugin on chrome, if that helps make this more readable)

That is,

1GUL = 3.085678e21 cm/h = X cm/h
1GUM = 1.989e43 g/h = Y g/h (the use of X and Y is just for ease of writing)

in the default system, which is what I'm using. For one of my analysis codes I need to convert the densities from comoving gadget units to proper cgs units. Let a subscript c is for comoving, and a subscript p is for proper, and the cg subscript is for comoving gadget units.

[\rho_{cg} = \left(\frac{|\rho_{cg}|\text{GUM}}{\text{GUL}_c^3}\right)\left(\frac{Y\text{g}}{h\text{GUM}}\right)\left(\frac{h\text{GUL}_c}{X\text{cm}_c}\right)^3\left(\frac{1\text{cm}_c}{\frac{1\text{cm}_p}{a}}\right)^3]


Where the || just means the magnitude of the density (no units attached). This is the number contained in the snapshot. The above simplifies to:
[\rho_{cg} = |\rho_{cg}|\left(\frac{Y}{X^3}\right)a^3h^2\text{gcm}^{-3}_p]



Therefore, it seems to me, from the above, that the magnitude of the density in proper cgs units is the value given in the snapshot ([|\rho_{cg}|]) multiplied by the scale factor cubed and then the other constants. That is:

[|\rho_{p\text{cgs}}|=|\rho_{cg}|\left(\frac{Y}{X^3}\right)a^3h^2]


However, this seems wrong to me, as I know that:

[\rho_c=a^3\rho_p]


So it seems like I could do:

[\rho_{pg}=\frac{\rho_{cg}}{a^3}]


That is, the density in proper gadget units is just the value given in the snapshot divided by the scale factor cubed. This quantity could then undergo the conversion to cgs units as above, with the only difference being that this method has me dividing by the scale factor cubed, which is, of course, different than what happened the first time.

I've thought myself into a corner on this, if that makes any sense, and so my question is this: Can anyone tell me the right way to convert the densities from comoving gadget units to proper cgs units? I would greatly appreciate it, and I apologize for such a stupid question. Thank you very much!

Sincerely,
-Jared
Received on 2016-10-06 16:20:05

This archive was generated by hypermail 2.3.0 : 2023-01-10 10:01:32 CET