boardix


Post New Topic  New Poll  Post A Reply
my profile | directory login | | search | faq | forum home
  next oldest topic   next newest topic
» boardix   » Groups   » Codecrave   » Distributed Gas Law sim...

 - UBBFriend: Email this page to someone!    
Author Topic: Distributed Gas Law sim...
Atomic-Ant
In Real Life Now
Member # 2

 - posted      Profile for Atomic-Ant     Send New Private Message       Edit/Delete Post   Reply With Quote 
Hey guys. For my CIS class we're working on a distributed gas law sim applet. (yes i know its applet and yes i know its java and yes I know its probably very slow. If you want to elaborate on how slow it is, that's fine with me though.) Anyway, this applet is not distributed yet. we'll be using something called Remote Method Invocation (i think its invocation, anyway) to distribute the moving of the particles.

As you can probably tell, the display is disconnected from the moving of the particles. They run in separate threads. So as you load the sucker up with stuff, the display refresh rate slows down, but the particles will move (nearly) as fast as usual i think. So that's interesting.

Here's the link

So try it and stress your system. I think i had 150,000 particles or so running before it started refreshing like once every 5 seconds. Just thought you'd all be intersted. plus, if you kinda blur your eyes, it reallllllly is tripping... You kinda see like little patterns developing and such.

Speaking of patterns.... when you first start it, hit the "add 10,000" button about 5 times.... Its REALLY interesting to me to watch the state of the system go from a condition of low entropy to higher and higher entropy levels until it looks completely random. So crazy, i love it. Kinda like you know your 5th grade science teacher told you that there's a very small chance the all the air in a room could gather in the corner of a room, and you'd all suffocate? watch it happen! its fun.

--------------------
 -

Posts: 1768 | From: Nashville, TN | Registered: Apr 2002  |  IP: Logged
bigO
He Who Knows All
Member # 7

 - posted      Profile for bigO     Send New Private Message       Edit/Delete Post   Reply With Quote 
ya know what's really cool about java? It's easy to reverse engineer.

I didn't do it to that program, but i might, for the experience of it.

You know what you could do to slow it down a lot? make the particles bounce off each other too.

--------------------
Anybody can be cool, but AWESOME takes practice.

Posts: 4521 | From: VP luv | Registered: Apr 2002  |  IP: Logged
Mystery Man
vote YES to the Heroes bill
Member # 1

 - posted      Profile for Mystery Man     Send New Private Message       Edit/Delete Post   Reply With Quote 
Like I said, I love this thing.

1. I want a screensaver version.

2. If the particles were to bounce off of eachother, would you calculate the angle they bouced off and send them in the appropriate direction accordingly, as if they were round? that seems like the most realistic situation. Probably not worth programming out though.

3. I want a screensaver version.

--------------------
 -

Posts: 2726 | From: VP | Registered: Apr 2002  |  IP: Logged
What Huh Studios
Member
Member # 100

 - posted      Profile for What Huh Studios     Send New Private Message       Edit/Delete Post   Reply With Quote 
very cool

wierd thing: it wouldn't work in IE (couldn't load some class... BounceDriver, but it did work in java (which always seems to crash whenever anything java comes up).

--------------------
http://www.whathuhstudios.com

Posts: 1687 | From: Villa park | Registered: Feb 2003  |  IP: Logged
Atomic-Ant
In Real Life Now
Member # 2

 - posted      Profile for Atomic-Ant     Send New Private Message       Edit/Delete Post   Reply With Quote 
Yeah... kordik we talked a LOT about bouncing and how all that would work in the real world... We looked at it from a conservation of energy perspective and a conservation of momentum perspective. In one dimesion, everything's fine, you just have 2 variables and 2 equations, so that's nice. In 3 dimensions things get harder. we give the particles an x-velocity and a y-velocity, so we have instant unit vectors, so it really turns into two different one dimensional situations. This is where I need to get my notes out...

Ok... we're always aussiming equal masses, just so you know. Man my notes are confusing. For some odd reason, we end up with 4 unknowns and 3 equations, so its sorta no good.

But of course, with the same mass, and since we're assuming these aren't really much of a "circle" and that they are more like point masses, the angle of incidence equals the angle of reflection. So we could kinda calculate a line through the point of contact that would allow the angle of incidence to equal the angle of reflection for both particles. So do that in your mind a bit....
code:
.      .
. .
. .
..
..
. .
. .
. .

so it would kinda look like that. But then we said, "wait... that's exactly the same thing as if they just passed through each other... and it would save cpu cycles like your mom on a diet." So for right now, we decided that it doesn't matter. And when you have a million of them all interacting... It probably doesn't matter.

The only case i can think of when it would matter is this one... if you hit the add 10000 button a bunch, then watch them all gather in the corner. In that situation, they wouldn't all gather in the corner as much in the "real world" because they would not all be able to fit in there and stuff... like you can't assume that a particle just "goes through" another one if there are say, 10 more particles and a brick wall behind it. But that's the only thing I can think of.

Kordik how would i get it to run after X number of minutes and all that? I think you may need to manually start it.

And dan that's really odd. I use IE5 i think and it always workds fine for me. My roommate tried it in mozilla i think and it didn't work till he updated his java. And isn't it odd that java crashes whenever it encounters anything java?

--------------------
 -

Posts: 1768 | From: Nashville, TN | Registered: Apr 2002  |  IP: Logged
Atomic-Ant
In Real Life Now
Member # 2

 - posted      Profile for Atomic-Ant     Send New Private Message       Edit/Delete Post   Reply With Quote 
Oh and I just posted the souce code on that page, if you are interested. A disclaimer, though, i haven't tried to "clean it up" much... there are probably a few little spots that are inneficient and such. but you too can program your own gas law sim now! YAY.

--------------------
 -

Posts: 1768 | From: Nashville, TN | Registered: Apr 2002  |  IP: Logged
bigO
He Who Knows All
Member # 7

 - posted      Profile for bigO     Send New Private Message       Edit/Delete Post   Reply With Quote 
Awesome, now i won't have to decompile it and look at super crappy code with all the variable names changed to a, b, c, d, etc...coo

and with the particle collisions, they do appear to pass through each other iff* their x and y velocities are exactly equal. otherwise it does become a momentum problem, in which you'd need to calculate the new x and y velocities using the x-y velocites of the other one, and in many cases the angles won't exactly match up.

Then to make it even more realistic, allow a certain amount of energy to be given off with each collision and watch as every particle gradually has the same velocity.

--------------------
Anybody can be cool, but AWESOME takes practice.

Posts: 4521 | From: VP luv | Registered: Apr 2002  |  IP: Logged
What Huh Studios
Member
Member # 100

 - posted      Profile for What Huh Studios     Send New Private Message       Edit/Delete Post   Reply With Quote 
that would be really really cool. except... make it say about 50 particles running in full screen, with the slowest ones being blue, the fastest ones being red, and the middle ones being gray. then, as they slow down as energy is exchanged, they all slowly fade to that middle gray.

that would rock.

(these particles would be say like 20x20 pixels in size)

--------------------
http://www.whathuhstudios.com

Posts: 1687 | From: Villa park | Registered: Feb 2003  |  IP: Logged
Atomic-Ant
In Real Life Now
Member # 2

 - posted      Profile for Atomic-Ant     Send New Private Message       Edit/Delete Post   Reply With Quote 
well here's the thing. the part of the program that takes up the most cpu cycles is drawing. So for the final product we are going to come up with ways to be more representational on the graphics so it doens't stress the cpu as much... for example... lighting up the sides when there is a collision only, or dividing the area into a grid and assign the squares different colors based on the number of particles that are in there, or only displaying one out of every 100 particles, etc... So we can run millions of particles without wasting cpu cycles on drawing each and every little one.

--------------------
 -

Posts: 1768 | From: Nashville, TN | Registered: Apr 2002  |  IP: Logged
Atomic-Ant
In Real Life Now
Member # 2

 - posted      Profile for Atomic-Ant     Send New Private Message       Edit/Delete Post   Reply With Quote 
Hey guys. here's an update on what i've been working on for this stuff. There are two permutations:

Reverse Bounce - All the particles originate in one place and fan out. you can then watch the entropy increase as before. but then, just when you thought there was not a single salvageable bit of order in the system, you whip out your mouse and hit the "REVERSE" button and watch the wholeeeeeeeeeeee thing go back to the beginning. WHOAH!!!! it reminds me of how they say the universe is expanding, and so they want to find out where it origninated from. kinda like that, you hit the reverse button, and you can actually see the particles probable positions BEFORE THEY WERE EVEN CREATED!!!! sweet action!!!!

okay, here's #2...

Piston Bounce - All the same features as above with one big addition and a couple small ones. There is a blue "piston" on the left side of the screen that has a constant acceleration toward the right. Add particles, and watch it swoop right, then back left as the particles bounce off of it and push it back, and then oscilate back and forth a bit till it finds equilibrium!!!! Physics is faaaamazing!!! And yes, momentum is conserved. I believe the mass ratios are something like 1:100, but you can look in the code if you really want to know for sure. Also, there are "play" and "pause" buttons up there for you to screw around with. You can pause the action and resume it flawlessly now. kinda nice.

I'll be adding more tinkering, real-time adjustment features on this program too, like for instance a slider to control the speed, and maybe the ability to "heat" the outside to make the particles increase in velocity, and some other stuff like that... enjoy.

--------------------
 -

Posts: 1768 | From: Nashville, TN | Registered: Apr 2002  |  IP: Logged
Atomic-Ant
In Real Life Now
Member # 2

 - posted      Profile for Atomic-Ant     Send New Private Message       Edit/Delete Post   Reply With Quote 
reply, dangit! i may be a reasonable man, but i'm also a client!!!! GRRR!!!

--------------------
 -

Posts: 1768 | From: Nashville, TN | Registered: Apr 2002  |  IP: Logged
What Huh Studios
Member
Member # 100

 - posted      Profile for What Huh Studios     Send New Private Message       Edit/Delete Post   Reply With Quote 
that is really really cool. i like adding hundreds and hundreds of particles when the blue bar is WAY to the right and watching the little dots ping off of it as if saying "get away! get away!"

--------------------
http://www.whathuhstudios.com

Posts: 1687 | From: Villa park | Registered: Feb 2003  |  IP: Logged
bigO
He Who Knows All
Member # 7

 - posted      Profile for bigO     Send New Private Message       Edit/Delete Post   Reply With Quote 
Computer Science with application to physics. caaaaah-wazy.

--------------------
Anybody can be cool, but AWESOME takes practice.

Posts: 4521 | From: VP luv | Registered: Apr 2002  |  IP: Logged


 
Post New Topic  New Poll  Post A Reply Close Topic   Feature Topic   Move Topic   Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:

kordix.com

(C)2000-2011 The Boardix Community

Powered by Infopop Corporation
UBB.classicTM 6.5.0