Universe Simulator

More
20 years 10 months ago #7973 by Rudolf
Replied by Rudolf on topic Reply from Rudolf Henning
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by Larry Burford</i>
There will probably be times when I'm not able to do a review right away ... but I'm willing to give it a try.
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

I'm sure you won't have a problem. I've slipped a day not doing something (selling home and buying a new one) but should be able to send you something basic soon. I just want to include that last step to calculate the final new position of a particle/star.
I have not included the limited range paramater yet but once the 'standard' equation seems to work fine for regular particles (well within the gravity range) I'll include that.

Rudolf

Please Log in or Create an account to join the conversation.

More
20 years 10 months ago #8317 by Rudolf
Replied by Rudolf on topic Reply from Rudolf Henning
One of the first things I picked up is that the value of G will be dependant on my scale selections for distance and time. How would I have to adjust G for say the following combinations:

Kilometer and second
Astronomical unit and day
Lightyear and year

What would be the numerical values (no units) for these combinations?

These should be part of the start-up routines to set the 'constants' correctly based on the scales.

Thanks

Rudolf

Please Log in or Create an account to join the conversation.

More
20 years 10 months ago #7977 by Larry Burford
Rudolf,

CRC Handbook (ha), or try [url] www.metric-conversions.org [/url]

You may end up using a lot of unit conversions, and some of them will be "unusual". As in rarely used by most technologists. You may even have to figure out the values for some of them yourself.

I'd set up a bunch of constants for this.

example -
some common conversion factors
CONST SecondsPerMinute = 60
CONST SecondsPerHour = 60 * SecondsPerMinute
CONST SecondsPerDay = 24 * SecondsPerHour
CONST KilometersPerAU = 149598000000

(I like to avoid abreviations, but that's just a personal style issue. You can (and should) get pretty fancy here. Use previous definitions to help build new ones. I always use constants and variables instead of numbers. Some compilers claim the code is faster if you avoid actual hard coded numbers.)

Then all you have to remember is the name of the constant. This has the added benefit of making the code more readable, and reducing the need to add (and maintain) comments.

The only down side is some rather long names if you don't abreviate severely. But abreviations can haunt you six months later.

===
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
[Rudolf] How would I have to adjust G for say the following combinations:

Kilometer and second
Astronomical unit and day
Lightyear and year<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

G is 6.67300 m^3 / (kg * sec^2) using mks units, so

CONST G_mks = 6.673

to get this in units of lightyears, kilograms and years per your third example, do the conversion in several steps. First meters to Ly

CONST G_Lyks = G_mks * LightYearsPerMeter^3

Next seconds to years

CONST G_LykY = G_Lyks * YearsPerSecond^2

You could of course also convert the kilograms into another unit with one more pass.

===

Keeping your units straight is very important. Any time you add a new constant, be very methodical about it.

Regards,
LB

Please Log in or Create an account to join the conversation.

More
20 years 10 months ago #4111 by Rudolf
Replied by Rudolf on topic Reply from Rudolf Henning
Thanks, slowly but surely this 'thing' is growing.

Rudolf

Please Log in or Create an account to join the conversation.

More
20 years 10 months ago #7978 by Larry Burford
Rudolf,

Got an oops here. The "seconds" unit is in the denominator of the definition of G, so the conversion factor YearsPerSecond should be to power -2, or divided instead of multiplied, for G_LykY.


and

CONST KilometersPerAU = 149598000000

should be named MetersPerAU

KilometersPerAU is 149598000

===

1.27.2004 - Just noticed I dropped the power of ten multiplier on G, but I'll bet you already saw it.

G_mks = 6.67300 E-11 m^3/(kg * sec^2)


LB

Please Log in or Create an account to join the conversation.

More
20 years 9 months ago #8146 by Rudolf
Replied by Rudolf on topic Reply from Rudolf Henning
I've been busy lately (with other things like work - yiggy) but the one thing I have noticed is a 'problem' or issue with my 'particles' as they fall through or past each other. According to the last simulations I ran they accelerated towards each other and once past the zero point they deaccelerate but at a rate that they seem to fly apart forever. I basically ended up with a one dimentional coordinate system for simplicity. I suspect I'll have to build in some logic to check if the next 'step' would take it position past the other particle and then only apply a fraction of the acceleration/velocity for the first bit and a negative amount for the rest.

Rudolf

Please Log in or Create an account to join the conversation.

Time to create page: 0.218 seconds
Powered by Kunena Forum