# Internal G=1 unit conversion/systems for simulation timestepping

1. Jan 12, 2008

### mdemone

Hey everyone,

I'm knocking my head against something and for some reason I can't get it to work out -- I'm running an N-body simulation which uses an internal gravitational constant of 1, meaning that the timestep used is a function of the units of mass, length, and velocity.

But I don't know the relation that allows me to solve for the timestep, e.g. if I am working in a system of unit mass M = 2.3e9 M_sol = 4.6e39 kg, and unit length L = 1 kpc, and unit velocity V = 100 km/s, what is my unit of time for G = 1?

Can anybody help me out real quick? This is a very *duh* moment for me...

Last edited: Jan 13, 2008
2. Jan 13, 2008

### marcus

It looks to me as if you have two contradictory solutions.
On the one hand, if you have a mass unit and a length unit, then setting G = 1 will immediately determine a time unit!

but on the other hand, if you have a length unit and a speed unit THIS will automatically determine a time unit. The two time units will be in conflct.

To make it worse, If you ignore your length unit, then your speed unit together with mass and G = 1 will determine a time unit. And this will not agree with the other two.

=============
first of all, check that you have your mass unit right.

You claim that 2.3E9 solar masses = 4.6 E33 kilogram
but I think you are off by 6 orders of magnitude.
==============
once you have your mass unit correct, multiply it by G and you will get
3.05257453 E20 m^3 / s^2

THIS MUST EQUAL ONE IN YOUR UNITS

but you have declared that the speed of E5 meter/second also equals one!

therefore you can divide the above expression by the square of that speed and get

3.05257... E10 meters this must also equal one in your units, to be consistent

If you divide this length unit by the speed unit of E5 meter/second, you will get the time unit.

In other words your time unit must equal 3.05...E5 seconds
this is about 1/100 of a year.
=======================

now this is just as I understand what you are saying. Maybe I don't understand what you are doing.
But you said you want your mass unit to be that huge mass M
and you want your speed unit to be E5 m/s
As I understand units, if you then say that G = 1 you have no more choice.
You length and time units are then locked in.

Last edited: Jan 13, 2008
3. Jan 13, 2008

### mdemone

I should have better said: my set units are velocity and length (100 km/s and 1 kpc, respectively), as drawn from Widrow et al. 2003's disk/bulge/halo models for M31 (see note A on pg.22 here). The authors state that setting G=1 implies a mass unit of 2.3e9 M_sol (though there is an unfortunate typo in that number's exponent).

So how did they come to that conclusion and what was the timestep that must have been used?

Also, my solar mass-in-kilograms reference was wrong (how terrible!), although the one right next to it in grams was correct (it is of course 2e30 kg = 2e33 g). Thanks for pointing that out.

Edit: You added more while I was posting. Let me fiddle with it and see what I get...

Last edited: Jan 13, 2008
4. Jan 13, 2008

### mdemone

So obviously if Widrow et al. have V = 100 km/s and L = 1 kpc, then the time unit is T = 3.09e19/1e5 = 3.09e14 seconds = 9.78 Myr.

Then that gives us GM/V^2 = (6.67e-11 * 4.6e39) / (1e5)^2 = 3e19 meters =1 kpc, if we are given our mass unit first, and rearranging solves for the mass unit if necessary.

Okay, excellent. I gotcha now...thanks for the pointer! I hate it when I can't do something I feel is so simple, then I just get frustrated and it makes the mental block worse.

Of course they are. I just wasn't thinking. This is what happens when I'm doing unit conversion on a Saturday night!

Last edited: Jan 13, 2008
5. Jan 13, 2008

### marcus

Good! I am glad it is straightened out.