Re: velocity units

From: Volker Springel <volker_at_MPA-Garching.MPG.DE>
Date: Mon, 30 Oct 2006 14:23:56 +0100

Melanie Jo Clarke wrote:
> I have been attempting to use Grafic-1 initial conditions to run small scale
> Gadget2 simulations and have run into the following problem with velocity
> units.
> The manual suggests to divide by sqrt(a) to convert from physical velocity to
> Gadget units. When I do this, I find that the Gadget simulation does not
> evolve far enough compared to a P3M simulation run with the same initial
> conditions.
> As I understand it, the internal units for velocity are dx/d(ln a), so to
> convert from physical velocity, dx/dt, to these units, I should divide by d(ln
> a)/dt. This factor is a*sqrt(omega_m/a + omega_v*a^2 + 1 - omega_m - omega_v),
> where omega_m is the matter density ratio and omega_v is the vacuum energy
> density ratio. This factor reduces to sqrt(a) in the case that omega_m=1 and
> omega_v=0. When I use this factor to convert physical velocity to Gadget
> units, I get good agreement between P3M and Gadget simulations.
> Is my interpretation correct? If so, can the Gadget2 manual be corrected so
> that future users don't run into this problem?

Hi Melanie,

The manual is correct on this...

I can only speculate where you got confused, but I'm guessing you have
mixed up the definitions of comoving, physical, and peculiar velocity.
Note that they are all different. Also note that the manual says that
the IC file should contain the *peculiar* velocity divided by sqrt(a),
not the *physical* velocity as you state above. Let "x" denote comoving
coordinates and "r=a*x" physical coordinates. Then I call

 comoving velocity: dx/dt
 physical velocity: dr/dt = H(a)*r + a*dx/dt
 peculiar velocity: v = a * dx/dt

The physical velocity is hence the peculiar velocity plus the Hubble flow.

I think your attempts to guess the correct conversion factor have caused
some additional confusion. Let me try to clarify: The internal velocity
variable of gadget2 is not given by dx/d(ln a). Rather, it is given by
the canonical momentum p = a^2 * dx/dt, which is different from the
definition you assumed. The IC-file and snapshot files of gadget don't
contain the variable "p" directly because of historical reasons of
compatibility with gagdet-1. Instead, they contain the velocity variable
u = v/sqrt(a) = sqrt(a) * dx/dt = p / a^(3/2), which is just what the
manual says. (The conversion between u and p is done on the fly when
reading or writing snapshot files.)

Also note that d(ln a)/dt is not a*sqrt(omega_m/a + omega_v*a^2 + 1 -
omega_m - omega_v), as you say above... This factor is equal to the
Hubble rate, i.e.: d(ln a)/dt = H(a) = H_0 * sqrt(omega_m/a^3 + omega_v
+ (1 - omega_m - omega_v)/a^2).

If you can't solve your unit conversion problem, I'd suggest to talk to
Michele Trenti, who figured out the grafic->gadget2 conversion.

Best wishes,

> Thank you,
> Melanie Clarke Dosaj
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> with a subject of: unsubscribe gadget-list
> A web-archive of this mailing list is available here:
Received on 2006-10-30 14:23:56

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