NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

JDK1.0.2 simulations (1996-2001) => Thermodynamics => Topic started by: Fu-Kwun Hwang on January 29, 2004, 08:41:18 pm



Title: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on January 29, 2004, 08:41:18 pm

Ideal gas law $PV=N k T$ :  gas consists of N particle at tempearture T in a container (volume V) with pressure P.
And temperature $T$ is proportional to $V_{avg}^2$ where $V_{avg}$ is the average velocity for all the particles.
 

This java applet shows a microscopic model for an ideal gas. The pressure that a gas exerts on the walls of its container is a consequence of the collisions of the gas molecules with the walls.
In this model:
  1. The molecules obey Newton's law of motion.

  2. The molecules move in all direction with equal propability.

  3. There is no interactions between molecules (no collisions between molecules).

  4. The molecules undergo elastic collisions with the walls.

You can change the following parameters
  1. N: Total number of molecules

  2. P: The presure of the system

  3. v: The velocity of each molecules.

  4. The width of the container (Click near the boundary and Drag the mouse)

The volume of the container is adjusted automatically according to the above parameters.
The animation is suspended when you press the mouse button. It is resumed when you release the button.
Try to find out the relations between
  1. total number of molecules N ---- volume V

  2. the pressure of the system P--- volume V

  3. the velocity of the molecules v --- volume V


Title: topic25
Post by: on January 30, 2004, 11:40:48 am
Subject:  model for an idel gas
Date:     Mon, 22 Mar 1999 22:44:29 +0100
From:     Stefan Berger <averell.bo@cityweb.de>
To:       hwang@phy03.phy.ntnu.edu.tw
dear mr. hwang,

i'm a teacher for physics in germany. this is the third time i launched
your site in the internet. but when i try out your applet i get problems
by changing the number of particles. always i'm trying to change this
value it doesn't change the number of particles in the applet. can you
help me?

sincerely, stefan berger, bochum, germany


Title: topic25
Post by: on January 30, 2004, 11:42:55 am
Subject:  Re: model for an idel gas
Date:     Tue, 23 Mar 1999 13:40:57 +0100
From:     Stefan Berger <averell.bo@cityweb.de>
To:       Fu-Kwun Hwang <hwang@phy03.phy.ntnu.edu.tw>
dear mr. hwang

thank you for helping! now it works!

sincerely, stefan berger


Title: Changing the shape of the container
Post by: kristianly on September 03, 2004, 09:33:42 am
Dear Prof Hwang, when I changed the shape of the container, the pressure changes. Shouldn't it remain constant since the gas should react by pushing the ceiling upward to achieve constant pressure. Is the parameter for pressure actually the mass since changing the shape of the container does not change the pressure although area of ceiling is changed.

Thanks, :lol:
Christian Lee
NIE, Singaore


Title: Email Code
Post by: narpoodle123 on May 23, 2005, 08:50:50 pm
Could you eamil me the source code that gos with that appelet i want to use it as a physics engine for a little game im making. http://kcgstupy@kc.rr.com


Title: topic25
Post by: Fu-Kwun Hwang on May 24, 2005, 09:31:41 am
You should have received the source code in your email account now!


Title: topic25
Post by: lopa on September 26, 2005, 12:28:57 pm
sir/mam
Could you eamil me the source code of  this appelet .
thanks


Title: topic25
Post by: chfahlke on December 29, 2005, 06:02:27 pm
Dear Dr Hwang,
I would greatly appreciate to receive the code for the ideal gas java applet.
Thank you very much in advance.
Sincerely yours,
Christoph Fahlke


Title: topic25
Post by: Fu-Kwun Hwang on June 23, 2006, 03:17:30 pm
Someone send me an email and ask questons related to this applet. Questions and responses are posted for your reference:


We use finite number of particles to simulate the real system.  In the simulation we did not  take into account collisions between  particles. The collision between particles and wall are treated as elastic collision.  Due to the limited number of particle (200 as default),  the simulation will show deviation from equilibrium state.  In the real world, there are 1019 particles cm3. The statistatic error is inverse proportional to squar root of the number of particles.  So we can measure fix number of pressure or volume in real world when the system is in equilibrium.  But we can not reach that goal for a real simulation with only several hundred of particles.


[1] When we change the width of the chamber we get different volumes even though we are keeping the same values for the variables.  Do you why this would happen?


R: User can drag the boundary to change the boundary for the chamber.   The simulation will move back to new equilibrium condition. As long as "Pressure" and "number of particles" and "average velocity"  are not changed, the volume should return back to the original value. The deviation is due to statistatic error as explained above.

[2] When the piston is near the top or bottom of the chamber the instantaneous volumes shows greater deviations than when the piston is more centered vertically.  Is there a reason for this?
 R: The velocity in the simulation is much smaller than that in the real world.  If we put the velocity in the simulation close to the real case, you would not be able to see any of the particles. Because it will be too fast. In real world, the velocity of the particle in room temperature is several hundred meter per second. And the size of the chamber usually are less than meter.   The deviation is due to the velocity is too small.

 [3] Sometimes the bottom line of the piston disappears above the top of the chamber and the volume output is essentially constant.  Are the instantaneous volumes collected valid when the piston moves out of sight or have we exceeded the limits of the algorithm?
 R: The volume output  should change when the piston move above the top of the simulated region.   It is not a constant.  I do not why you said it is essentially a constant.

 [4] Can you tell us the units for the parameters used to calculate the volumes?  Also, are the particles considered to have volumes or are they treated as point particles?
 R:  The particles did not considered to have volumes in the simulation. The volume in the simulation is calculated from width* height in unit of pixel divided by  1000.

 [5] If the students generate three proportionality constants by varying each parameter individually, would you expect that they could derive a combined proportionality constant that would correctly predict the volume of gas when all three parameters vary?  This would be a constant for the simulation analogous to the ideal gas law constant, R.
 R: you will find the volume of the gas is propotional to number of particle, square of velocity  and inverse propertional to pressure.
So Pressure*Volume= N * k * velocity2
You can ask students to find out the constant k.


Title: Units
Post by: talimu on July 04, 2007, 01:09:17 am
Dear mr. Hwang
I'm a student.
I found you application very interesting.
Please help me. How can i know what are the units of pressure volume in Molecular Model for an Ideal Gas  applet.
Thank You
Tali


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on July 10, 2007, 05:20:03 am
Sorry for the late reply. I was in Greece for Computer Based Learning in Science (CBLIS2007) international conference. when you post the message.
I just came back to Taiwan yesterday afternoon 

In real world, you will find 3*1019 particles in one cubic center meter volume.
There is no way the simulation can simulate so many particles.
So the unit in the simulation is a relative scale.


Title: Re: Molecular Model for an Ideal Gas
Post by: jshearman on February 16, 2008, 09:04:22 am
This is a fantastic simulation! My high-school students in Hong Kong LOVE it for its mad behaviour when you change the parameters violently and I love it because it makes the relationship of kinetic theory to the Gas Laws so clear.

Would it be difficult to modify it so that one can control the volume also and, preferably, have a temperature control rather than a velocity control? This would make it more accessible to the students. Ideally, I would like four controls corresponding to p, V, n and T with radio buttons to select which one is going to be controlled by the student and which one is allowed to vary as a result of that change.


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on February 16, 2008, 12:32:35 pm
Actually, you can change the volume for the above applet.
Just drag near the right edge and move it left/right.

However, I have created another applet (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=632.0) due to your request.
I hope the following is what you ask for. Please let me know if you still want more.
User can change Pressure(P), Velocity(v), Temperature (T), number of particle (N) and width of the system.
However, I did not add Volume as an adjustable parameter, because we are simulated an equilibrium state.
The volume of the system is not determined by the gas system itself. And I think we should teach student about this.
(Otherwise, we need to decide which one should be fixed (P or T) when volume is changed).


The applet has been modified to include fixed volume option. 2009/01/19
-*-


Title: Re: Molecular Model for an Ideal Gas
Post by: lookang on April 11, 2008, 02:33:37 pm
Hi Prof

The new applet looks like made using EJS, chance to share to source code xml ? ;D


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on April 12, 2008, 12:28:26 am
It is available now.


Title: Re: Molecular Model for an Ideal Gas
Post by: lookang on April 12, 2008, 09:57:17 am
thanks!!


Title: Re: Molecular Model for an Ideal Gas
Post by: anaktyl on January 08, 2009, 09:01:28 pm
hi Prof

I'm not programmer but chemist,and I have a favour ,Do you have any applet similar above but with constant volume and change mass of particles-choose one of ideal gases.

Thank you very much for help


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on January 09, 2009, 05:48:58 pm
Parameters for ideal gas are Pressure P, Volume V, number of particles N and Temperature T.

P*V=N*R*T

You want volume to be kept the same, and change the mass of the particles (different gas).
What else need to be the same? or changed?

If it is the same temperature T and the same number of particles, then pressure will be the same.
Because the same temperature T, means the same average kinetic energy.
So heavy particles will have less average velocity (compared to light particles).


Title: Re: Molecular Model for an Ideal Gas
Post by: anaktyl on January 09, 2009, 09:33:11 pm
Hi Prof

Yes I agree with you. PV=NRT

but If we change the volume the pressure will be going up or down P=NRT/V and  the particles will be moving slower or faster, it's similar with changing mass of particles

So I just need very simple animation, where can I change just number of particles, ideal gas(mass of particles), and volume.

Thank you for help


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on January 10, 2009, 11:09:51 am
What do you mean by change just number of particles, ideal gas(mass of particles), and volume.
Do you mean change all of the above 3 patrameter at the same time and without changing other parameters?

From P*V=N*R*T:
If you can freely change V and N, there is no way to keep P and T constant (unless V/N is keep as constant,too!)

When you use mouse to change parameters, you can adjust one parameter at a time.
Let me know exactly what you want to do. Please give me an example (in detail) and I will try to find way to help you! O.K.?
Please write it in detail!


Title: Re: Molecular Model for an Ideal Gas
Post by: anaktyl on January 19, 2009, 03:52:10 am
Hi

 for example on the top you showing how the volume is moving along with pressure (up,down),
I need the animation where volume is constant means you can change using mouse or tape the size, and then tape the number of molecules, and showing how pressure is changing, it makes sense
   


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on January 19, 2009, 09:31:02 am
The above simulation was designed for a system with piston so that the volume changed according to external apply modification: change pressure, temperature or number of particles.

I modified another simulation (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=632.0) to simulate what you want.
You can select Volume fixed checkbox, then you can change number of particle,temperature and the pressure will change according to your input (you can also change volume,too!).



Title: Re: Molecular Model for an Ideal Gas
Post by: descale on March 01, 2009, 07:49:32 am
Hello,
this Java Applet is excellent, perfect work! I have few a questions. Can you help me, please?

1) Why are there used Runge Kutta equations?
2) How to calculate the accuracy of volume calculation?
3) Can we find there method Monte Carlo?
4) It is there momentum?

Thank you very much. Tomas


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on March 01, 2009, 08:12:49 am
1.If the volume is fixed and without consider gravitation effect, you do not need to use Runge-Kutta method.
2. I do not understand the rest of your questions:
Quote
2) How to calculate the accuracy of volume calculation?
3) Can we find there method Monte Carlo?
4) It is there momentum?
e.g. what do you mean by "the accuracy of volume calculation"?
Why you want to find  Monte Carlo method?
momentum??? DO you maen "linear momentum"?


Title: Re: Molecular Model for an Ideal Gas
Post by: descale on March 01, 2009, 09:10:09 am
e.g. what do you mean by "the accuracy of volume calculation"?
Why you want to find  Monte Carlo method?

I thought there has been applied method Monte Carlo. And the accuracy of Monte Carlo is 1/sqr(n). That's okay, thank you. ;)


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on March 01, 2009, 11:05:05 am
The volume of the system was calculated from width/height and display the average( in time).


Title: Re: Molecular Model for an Ideal Gas
Post by: siuchun on April 06, 2009, 09:23:15 pm
Dear Prof Hwang,
 
I have learned your molecular model for an ideal gas in the internet. It's a fantastic simulation.
 
Now I have a question that if the collision between the partials and walls is not elastic, the wall will occur plastic deformation after collision. Can this model be used to simulate the phenomenon?


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on April 07, 2009, 08:11:40 am
You need to define the model for your case:
How the wall will be deformed and how much enegy will be loss duing collision and what that will affect later collision.

It will be easier to modify it from EJS version of ideal gas law: PV=nRT  (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=632.0)


Title: Re: Molecular Model for an Ideal Gas
Post by: siuchun on April 07, 2009, 10:08:07 am
Thank you very much for your reply.
In fact, I am not familiar with Java. Can I simulate that plastic collision in MATLAB?


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on April 07, 2009, 10:12:38 am
I am not familiar with MathLab, but I believe it can be done.
You need to define your model (variables/relations/constraints) and write the code to deal with it.
If you are familiar with MathLab, you should be able to learn EJS very quickly!
You can check out SWF movie show step by step instructions to create java simulation with EJS (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=656.0) to know what EJS can help you.


Title: Re: Molecular Model for an Ideal Gas
Post by: CharlieD on May 21, 2009, 08:43:38 pm
Hi Fu-Kwun Hwang,

I really like your application but would be interested in something similar but different.  I am interested in the mixing potentials of different gasses under ambient pressure.  I'd really like a application that simulates the behaviour of three different gasses in a fixed volume over time.

lets say three hypothetical gasses: Gas A, Gas B and Gas C.   Effectively running your application in three different colours in the same volume.

Inputs

The size and shape of the container (2 dimensions is fine),
The mass of the gas molecules, A B and C  (and or the gravitational effect buoyancy)
The quantity of the individual gasses
The over all energy of all the particles, i.e. temperature

I'd like to be able to monitor the system with respect to time from a random orientation

Particle particle interactions can for now be avoided to make the programming easier...

Is this the sort of thing that you could do?

Many thanks

Charlie.


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on May 21, 2009, 10:07:29 pm
1. The size and shape of the container:
 I can add size as an input, but what do you mean by the shape of the container? Do you mean Square, Circle,... or just different width and height for rectangular shape?
2. The mass of the gas molecules, A B and C  (and or the gravitational effect buoyancy)
This can be done easily.

3. The quantity of the individual gasses:
 What is the range of for the number of particles? Remember collision need to be checked at least n*(n-1)/2 times.

4. The over all energy of all the particles, i.e. temperature
Do you mean the average energy for all the particles?

Please provide possible range for all the physics properties, it will save me a lot of time and the result will be better fit with what you really want. 


Title: Re: Molecular Model for an Ideal Gas
Post by: CharlieD on May 22, 2009, 05:24:40 pm
Hi Fu-Kwun Hwang,

Thank you very much for your reply.

Size and shape.  rectangular is good.  would want to see the difference between a square container verses a tall thin rectangular one..

The number of particles would depend on the size and pressure.  Could you maybe set Gas A as the basis that fills the remaining volume, and then allow for Gas B and C to be filled up to the whole volume as well.  i.e. if the volume can hold 1000 molecules and you specify that Gas B has 100 molecules and Gas C has 200 then Gas A would be set to 700. ranges would then be 0-1000 for each B and C with A set automatically.  Would be good to have as big a volume as is possible though I understand that the bigger the more complex the calculations.  What sort of size would be reasonable?  is 10 litres of space too much? 20L?

Temperature is the average temperature / energy of the molecules.

Would be good to be able to speed up the simulation of the time so a time factor could be written in to i.e. 1s = 1h in simulation time etc.

Physical properties:
Gasses will be molecular mass 2-50.
temp 200 K to 400K
simulation time 0 s to few days.
Three different colours for the different gasses, say Red, Blue, Yellow

Size would be rectangular from tall thin to wide flat as big as is reasonable, set by the volume.  I'll run it direct off a PC so much more RAM for the calculations than off a website

Hope this helps.

Charlie.


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on May 23, 2009, 11:21:13 am
I modified browian motion simulation to fit most of your request.
The following is 1000 particles randomly distributed (position, velocity and direction).
Number of three different particles are NA, NB and NC, there mass are ma,mb,mc
The temperature T define the average velocity: Vavg proportional to sqrt(T/m)

The dimension of volume (e.g. 10 liters) is meanless if you mean to simulate a real volume.
Because there are almost 1019 particles in 1 cm3.
Unless the colume is just used to calculate the pressure.

For the same reason, change the width/height of the container will not be able to represent real case.

There are limitation for the simulation: for example: in real world, most of the gas molecular moving with speed faster than speed of sound.  And there are more than 1019 particles in 1 cm3.  if you want to visualize it. The particle can not move too fast on the screen.

The simulation has to be design in a proper way to show the effect. And for different purpose, it need to be designed differently.

Please write down the real problem you are studying and what kind of phenomena you are interested.
May be we can find out a better way to simulate it.
It might not be necessary to calculate the collision between particles, unless you want to study the energy transfer between particles.
It will be better if you can write down the physics model of the system.

The following is the simulation I have created for you!


Title: Re: Molecular Model for an Ideal Gas
Post by: CharlieD on May 26, 2009, 04:15:15 pm
Hia,

Simulation is fantastic.

I'm trying to visualise how different gasses will separate out in different closed containers. e.g. if you had a container of air with some helium and some Argon, mass 29, 4, and 40 respectively, then the helium would settle out at the top of the container, air in the middle and argon at the bottom. I'm interested in how long this process would take is it minutes hours, days or weeks.

Is there a buoyancy effect on the force on each particle or is the mass only used to calculate the elastic collisions with other particles?

Each particle will have a downward force of 9.8 x real Mass. (Real mass = Mass x 1.66054 x 10E-27 Kg)  the heavier molecules will therefore have a larger force pushing them down and will effectively settle out at the bottom first. (sorry if this is so obvious that it is already in the equations)

I think maybe the scale is so small that the particles are not given the space to settle and the proximity of the walls mean that the elastic collisions far out weigh the buoyancy differences of the gas molecules.   If we were to define each dot as a unit volume of gas, say 1000 molecules, then the model would be considerably bigger and the distance between the walls would be significantly longer reducing the effect of the elastic collisions while the downward force would be considerably higher.  in real terms 1000 molecules is a fraction of a fraction of a cm3 so easily justifiable as a modelling constraint.

Can you have a button to turn off the particle particle interactions? and see if they settle better with only particle-wall interactions.

Cheers

C.


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on May 26, 2009, 06:25:10 pm
Now, I understand more what you want for the simulation.
There is no gravity in the previous version.
I just added gravity (can be changed with slider) and also draw Yaverage for three different particles.
The difference between those three curves (Yaverage)are due to statistical error (because number of particles are not big enough).

More options are added.
1. Gravity g can be changed with slider.
2. Collision between particles can be turn off with check box.
3. The top boundary can be turn on/off.

The separation process will be faster if you un-check closetop check box.
The above simulation has been updated with new version.


Title: Re: Molecular Model for an Ideal Gas
Post by: CharlieD on May 28, 2009, 06:05:07 pm
Hia.  This is fantastic and beginning to look like I had envisaged..


Can I suggest a couple more alterations?

1) the particles now really clump at the bottom of the container with largely vacuum at the top.  could we maybe change the gravity effect into a relative vertical component vector.  By this I mean Ma =29 therefore relative to it's self it has a vertical force of 29/29 upwards and 29/29 downwards. Gas B has a upwards force of Ma/Mb and downwards force of Mb/Ma  and Gas C has a upwards force of Ma/Mc and downwards Mc/Ma.  This way lighter gasses will rise while Heavier gasses will fall. The space will be more uniformly filled without all the gas accumulating at the bottom..

The alternative is to incorporate some force of attraction towards the empty space that is higher for the smaller less dense molecules than it is for the heavier more dense molecules.. (this I think is quite a challenge..)

2) could you extend the temperature range to cover much lower temperatures.  This will slow the particles down and might help to lower the significance of the P-P interactions while not affecting the gravitational forces.

Cheers

C


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on May 29, 2009, 10:08:05 am
1. Simulation can be done with different model. What is important is how make sense of the simulation.
The gravity is the same (-g ) for all particles in the above simulation, because that what phyiscs tell me.

Quote
Ma =29 therefore relative to it's self it has a vertical force of 29/29 upwards and 29/29 downwards. Gas B has a upwards force of Ma/Mb and downwards force of Mb/Ma  and Gas C has a upwards force of Ma/Mc and downwards Mc/Ma. 
I do not understand the physics meaning of your model:
1. What do you mean by upward force and downward force?
If particle A has the same upwards and downwards force, the net force is zero. Then, particle should move with constant velocity.
2. Why the download forces and upwards force are different for particle B/C?
3. Do you mean force or acceleration?

The temperature range can be change easily. However, the value of temperature slider (T) was used to calculate the initial average velocity for all the particles. It is not the real temperature when it reach equilibrium later on. In order to visualize the effect you want, the gravitation energy was set to a much larger value (compared to real gas under STP condition).

If you just want to have three different gas particles moving in different layer, it can be generated, too! However, it is far from real!

Do you really want to simulate some physical model you have?
 Or you just want to have some visualized effect?
Are you using it for teaching purpose? What is the purpose to have such simulation?

For real gas:
 The separation between gas particles are much larger than the size of the particles.
 And there are 1019 particles in 1 cm3.

A good model need to be designed properly to simulate real gas.


Title: Re: Molecular Model for an Ideal Gas
Post by: CharlieD on May 29, 2009, 07:06:15 pm
Hia, I'm after a good combination of visual effect and real science.  I think i know what will happen in reality and I'm trying to form a model that will show what happens with a set of principles and constraints that can be argued from  scientific first principles.  The effect of gravity will not be the same on all particles as the force downwards will depend on the mass. the acceleration downwards might be uniform but there is also the buoyancy effect from the displacement of the other atoms as one falls due to gravity. The lighter gasses will rise to the top and the heavier gasses will sink to the bottom, relative to the mass of the main constituent of the volume. Setting the gravitational effect on gas A as uniformly up and down (i.e. no effect) was in my mind a way of simplifying the process to make the model appear more like the real situation.  This should stop the appearance of a vacuum at the top and a dense cloud of gas at the bottom.  The relative effects would be multiplied by the gravitational acceleration.

In effect the particle A should have no relative gravitational effect, B should have a positive effect in the upwards direction and C should have a positive effect in the down wards direction.

A balloon of helium has the potential to lift the amount of weight that is equal to the difference in mass of the volume of Helium and the mass of air that is displaced. There is therefore an upward force provided by each molecule that is equal to it's buoyancy or mass difference  times the gravitational constant.

To explain this better 24 litres of helium would displace 24 litres of Air  so the mass of the 24 litres would be 4gramms rather than 29gramms. There is therefore the potential to lift 25 grams  so the overall force upwards is 0.025 x 9.8 N. mathematically this equates to  (Mb-Ma/1000)*9.8 (negative = upwards, positive = downwards) 

In the case of an individual molecule it would be (Mb-Ma)x1.66054 x 10E-27 X 9.8 N. again this would be negative for upwards and positive for downwards.

We can easily expand the area so that there is more space between the molecules if that helps the reality of the gas.

In a big enough system the gasses should separate out completely given enough time with only a small overlap  in the "mixing region". 

If I can get it to give the results I need with a reasonable level of scientifically sound assumptions then I'd like to use it in a lecture and a scientific paper.  (Naturally you will be acknowledged.)

Sorry if it seems a bit confused above.

C


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on May 30, 2009, 11:29:42 pm
Here is another simulation with more options.
ga,gb,gc to adjust gravity for different particles.
gscale: adjust over all gravity scale
vscale: adjust over all velocity (to change ratio between relative thermal energy and gravitation energy )
diameter: to change the collision rate.

I can not find the right parameters to show what you would like to see.
May be some other factors need to be considered.

It seems that you are trying to using particle model to simulate fluid behavior.
I think we need to find a better model to simulate what you want!

I will be busy for a few days.


Title: Re: Molecular Model for an Ideal Gas
Post by: CharlieD on June 04, 2009, 08:40:36 pm
Many thanks, that is fantastic.  I can now show what I am after i just need to justify it from a physics perspective so that it is meaningful...

Will have a play and then be back in touch if i can think of any other tweeks.

Cheers again.


Title: Re: Molecular Model for an Ideal Gas
Post by: mirlinda on September 11, 2009, 04:08:09 pm
Dear author,

I would like to say that this is a wonderful simulation! My high-school students liked it very much.

Could you sent the source code by email: m.ebibi@seeu.edu.mk.

I woud like to make some changes.

I am so thankfull to you.

Regards


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on September 11, 2009, 11:48:32 pm
The above simulation is created with EJS. Please
1. download EJS (http://www.phy.ntnu.edu.tw/demolab/download/ejs.zip) and unzip it to c:\
2. Click c:\Ejs4.2\EjsConsole.jar to test the installation (Your computer need to support java :assume java run time has been installed)
3. Download jar file from the link just below the simulation.
4. Double click downloaded jar file to tun it.
5. RIght click in the simulation and select "open EJS model" to open source code in EJS.
6. You can modify variables/ relations/GUI element and properties  in the simulation and click run button to compile it.

If you need the source code for the simulation at the first post, just download idealGas.java
However, it was written more than 10 years ago with JDK1.0.2.


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on December 29, 2010, 07:50:37 am
Code:
I receive question related to this simulation as private message.
[quote]
Good morning, professor.

I have been using a model like this for my students.

My students learn that the "starting point" is 300 K, 100 kPa, 1.00 L, and approximately 0.040 moles of gas. If we use air, we find that the "average velocity" is something like 450 m/s, not 100 m/s. why is there a discrepancy between this simulation and the value that I've calculated?


I assume you are talking about smulation at Molecular Model for an Ideal Gas (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=25.0)

The velocity of ideal gas depends on temperature and mass of the particle.
The average velocity for hydrogen atom will be much larger than average velocity for oxygen atom.
I did not specify temperature and mass of the particle in the simulation.
The simulation was designed to show relation between number of particle N, pressure P and Volume V.
You can ask student what is the initial temoerature if the simulation is for air.
The temperature of the simulation is related to velocity.
How to change the velocity so that it is can be used to simulate air at room temperature.

I just pick up simple number: N=200 P-50 V=100 without specify any unit for the above parameter.
In reality, there is more than 1019 particle in 1 cm3.
There is no way to add so many particle in the simulation.
The pressure is proportion to the number of objects on top of the movable piston.


Title: Re: Molecular Model for an Ideal Gas
Post by: lookang on December 29, 2010, 08:26:25 am
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1455.0
This simulation is remixed to address the real life values.
I introduce some constants to make the simulation reflect real numbers.

Maybe can introduce this simulation :)


Title: Re: Molecular Model for an Ideal Gas
Post by: ahmedelshfie on February 08, 2011, 05:50:11 pm
Here is Molecular Model by paul Falstad.
http://www.falstad.com/gas/
(http://www.phy.ntnu.edu.tw/ntnujava/index.php?action=dlattach;topic=25.0;attach=3860)


Title: Re: Molecular Model for an Ideal Gas
Post by: surya316 on March 17, 2011, 01:12:33 pm
Dear Professor ,
Can you please email  me  the 2nd collision simulation source code where you kept the volume constant. I tried downloading the files directly but it tells me that the files are corrupted. Do help me out


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on March 17, 2011, 02:08:38 pm
Please provide the message where you found the simulation.
I do not know which one you need.


Title: Re: Molecular Model for an Ideal Gas
Post by: naive on March 01, 2012, 08:04:26 am
Hi Fu-Kwun Hwang,
Bernoulli's equation (ignoring gravity) can be illustrated with a straight tube connected to a tapering tube connected to another straight tube, with pistons in the straight tubes.
question 1: can this be simulated with an ideal gas between the pistons?
question 2: is Bernoulli's equation  true for an ideal gas?
thanks for thinking about this.


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on March 01, 2012, 08:43:24 pm
Bernoulli's equation :
Do you mean : $P+\tfrac{1}{2}\rho v^2+\rho g h=$constant

Quote
question 1: can this be simulated with an ideal gas between the pistons?
Could you describe your model in more detail? I can not catch your ideas.

Quote
question 2: is Bernoulli's equation  true for an ideal gas?

The Bernoulli's principle is valid for incompressible flows (e.g. most liquid flows) and also for compressible flows (e.g. gases) moving at low Mach numbers


Title: Re: Molecular Model for an Ideal Gas
Post by: naive on March 03, 2012, 05:32:32 am
hi!
you have the equation.  let's ignore the third (gravitational) term.

i hope this diagram clarifies ( " * " outlines a 3-section tube, " + " outlines the pistons.):
Code:
  *  *  *  *  *  *  *  *  *
                  +                 *
                  +                     *
                  +                         *  *  *  *  *  *  *  *  *  *  *  *  *
                  +                                                    +
                  +       gas enclosed                            +
                  +                                                    +
                  +                         *  *  *  *  *  *  *  *  *  *  *  *  *
                  +                     *
                  +                 *
   *  *  *  *  *  *  *  *  *
basically, we're changing the shape of an ideal gas, keeping the volume the same.  but we're looking at the process while it is happening, not a "before" and "after" situation.
it's not clear that we can ignore the temperature.
nor is it clear that the pressure on one piston is the same as the pressure on the wall of its corresponding straight tube section.
nor is it clear that the density in the straight tube sections is the same.

i thought a simulation might help see what's happening.  i have no idea if anyone has done this.

thanks again.



Title: Re: Molecular Model for an Ideal Gas
Post by: naive on March 03, 2012, 05:39:17 am
sorry!

my diagram got screwed up in the posting. spaces got deleted. i don't know how to correct this.


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on March 03, 2012, 06:21:25 am
You can add text in between [code] and [/code]  to keep space in the text. (I have already modified your text for you. :-)

Bernoulli's equation is valid for steady fluid which can be represented by stream lines.

It is a different situation you have pistons on both side of the tube: this is a closed system.

We can use fluid model to simulate gas flow when the mean free path is much smaller than the size of the tube. (fluid dynamics)

The molecular model can be used when the mean free path is smaller than the size of the tube, and this is a good time to use particles to simulate the situation.  (However, a lot of computational power is needed: to simulate large number of particles!)


Title: Re: Molecular Model for an Ideal Gas
Post by: ptnk_triz on July 12, 2012, 10:22:31 pm
Hello Prof Hwang,

Could you tell me the relation of the number of collision and pressure in your ideal gas model?

How can you calculate pressure exactly?


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on July 12, 2012, 10:37:40 pm
If you are talking about the simulation at the first post: then the umber of particles are 200 as default and can be changed from user input.
The pressure was calculated by momentum change per second.
Because there are limited number of particles so that the pressure change over time.
In real case, it will be more than $10^{19}$particles per center meter square.
 


Title: Re: Molecular Model for an Ideal Gas
Post by: ptnk_triz on July 12, 2012, 10:51:29 pm
The pressure is calculated by the momentum change per second. Can you tell me the equation?

The momentum is the average momentum of all the particles?

Do you think, could we find any relation betweens the number of collision of particles on the wall and the pressure?

I just know that : p = F / A

I dont know the relation of p and momentum, could you write down the relation.


Title: Re: Molecular Model for an Ideal Gas
Post by: Fu-Kwun Hwang on July 12, 2012, 11:25:16 pm
From the simulation, I can calculate how many particle collide with the wall per second,
Wih velocity and mass, the momentum can be calculated.

 $\vec{F}=\frac{d\vec{P}}{dt}=\frac{d (m\vec{V})}{dt}$

and Pressure $P=\frac{F}{A}$  normal component of the momentum need to be calculated to from the pressure.


Title: Re: Molecular Model for an Ideal Gas
Post by: diinxcom on December 14, 2014, 06:00:31 pm
-*-
Bookmarking this thread post. I will read latter