### Author Topic: Ejs Open Source Ideal Gas Model based on Kinetic Theory of Gas  (Read 101855 times)

#### lookang

• Moderator
• Hero Member
•     • • Posts: 1772
• http://weelookang.blogspot.com ##### Ejs Open Source Ideal Gas Model based on Kinetic Theory of Gas
« on: March 13, 2010, 09:02:30 am »
Particle model of ideal gas
This java simulation use 10 to 200 particles to simulate the particle of ideal gas. Each particle has the same speed moving in random direction. Piston will move down due to the gravity and move up because collision from particles.
You can change the velocity and pressure with the slider bar
Explain why the volume in the simulation is changing all the time.
Answer: the random collisions of the particles with the wall causes a fluctuation in the (N*m(delta v) /dt) rate of Change of momentum with the walls and since P = F/A = N*m(delta v) /dt*A

New Model customized by lookang for the following:
Assumptions of ideal gas

1. The molecules in the gas can be considered small hard spheres. ( un-checkbox magnify for "small" & "hard sphere" is in the motion because the molecules do not deform or change the spherical shape)
2. All collisions between gas molecules are elastic and all motion is frictionless (no energy is lost in collisions or in motion). ( vary the coefficient of restitution to observe what if the collision are not perfectly elastic )
3. Newton’s laws apply. ( in the absence of external force, the particles continue in the state of motion, constant velocity)

4. The distance between molecules on average is much larger than the size of the molecules. ( un-checkbox magnify for "small", can you observe the molecules move a large distance before hitting another particle? )
5. The gas molecules are constantly moving in random directions with a distribution of speeds. (observe the histogram, do you see a distribution of speed in the molecules, even though the particles are started with the same speed?)
6. There are no attractive or repulsive forces between the molecules or the surroundings. ( the particles do not experience forces between particles except when the particles collide in a very short duration, external walls do not affect the motion of the molecules except during the very time of collision with walls, that the perpendicular component of velocity re-bounce.)

Additional option in applet to change elastic to inelastic (i.e. coefficient of restitution), p-V, p-T and V-T graphs

Original Source: This java applet was created by Fu-Kwun Hwang with Easy Java Simulation (Ejs) from Francisco
the original applet is from http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=632.0 New Model customized by lookang in Ejs Open Source Ideal Gas Model based on Kinetic Theory of Gas

reference:

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
• Please feel free to post your ideas about how to use the simulation for better teaching and learning.
• Post questions to be asked to help students to think, to explore.
• Upload worksheets as attached files to share with more users.
Let's work together. We can help more users understand physics conceptually and enjoy the fun of learning physics!  « Last Edit: March 28, 2010, 01:34:11 am by lookang »

#### lookang

• Moderator
• Hero Member
•     • • Posts: 1772
• http://weelookang.blogspot.com ##### Re: Ejs Open Source Ideal Gas Model based on Kinetic Theory of Gas
« Reply #1 on: March 13, 2010, 09:05:41 am »
1 added text to the code variable, to understand the meaning of the many variables
2 add the pPa = pBar*13600*(-g)*0.76; // when g is -9.8 to allow questioning of the relationship between Pa and Bar ( atm )
3 found a bug when N is change, the applet may hang, i used the _isPaused() to enable the slider N to prevent the hanging to occur.
4 add the V = volume*(0.00138)/0.00123; so that P.V= N.k.T is more close to the real life values of //1.01*e5*1.09*e-21 = 400*1.38*e-23*200 http://hyperphysics.phy-astr.gsu.edu/Hbase/kinetic/eqpar.html#c2
5 made the V slider respond better by
volume = V/(0.00138)*0.00123; // need for slider to understand what to do
_initialize(); // need for responsive
7 change drawing to new Ejs objects
8 fix a max limit problem for Volume by *2.2
9 changing all the suit real life data, using http://hyperphysics.phy-astr.gsu.edu/Hbase/kinetic/eqpar.html#c2 as the base calculator, amu = 18 water molecule
10 add collisions between molecules by adapting Ejs Hard Disk Gas Model written by Wolfgang Christian http://www.compadre.org/osp/items/detail.cfm?ID=7573
11 change N = 50 as the computation is too great to run at n =400 as explained by Hwang here about the about calculation on possible collision between any two particles. A loop with 400*400 checking for collision.http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=632.msg5537#msg5537
12 remove 10 and 11 and deploy http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1484.0 Ejs Open Source Brownian Motion Gas Model Java Applet by Professor Francisco (Paco) Esquembre, Professor Fu-Kwun Hwang and lookang
13 added coefficient of elasticity between particles
14 added coefficient of elasticity between particles and wall
15 change the color of the gas to yellow
16 add Maxwell distributive speeds through Ejs Hard Sphere Gas Model written by Wolfgang Christian http://www.compadre.org/osp/items/detail.cfm?ID=7574 and http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1487.msg5608#new
17 added real calculation based on vrms= Math.sqrt(speed[j]+......)/n;
19 add total kinetic energy of N molecules = 1/2*m*vrms*vrms
20 add TKE = 3/2*N*k*T valid only for monoatomic particles, did not account for diatomic TKE = 5/2*N*k*T , polyatomic TKE = 7/2*N*k*T
21 new layout and hidden other panels
22 add mass but hidden to simply
23 hide TKE
24 adjusted k3m value from 50 to 2000 to prevent the volume from going to sub 10, thus avoiding the bug of particles "flying off"

challenges: Done!
can learn from Ejs Hard Sphere Gas Model
Ejs Hard Disk Gas Model

removed, using the http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1484.0 Ejs Open Source Brownian Motion Gas Model Java Applet
Done! 18 March
add collisions between molecules can learn from Ejs Hard Sphere Gas Model
Ejs Hard Disk Gas Model
« Last Edit: March 28, 2010, 01:36:15 am by lookang »

#### lookang

• Moderator
• Hero Member
•     • • Posts: 1772
• http://weelookang.blogspot.com ##### Re: Ejs Open Source Ideal Gas Model based on Kinetic Theory of Gas
« Reply #2 on: March 28, 2010, 01:47:52 am »
an email from a colleague

Some problems with the gas lab:

1. the temperature slider markings remains at 200 K - 1800 K even when the real temperature is much more when the mass of atoms are changed. Suggest removing the mass slider
2. particles still flies off at extreme pressure and volume

LTL

1. i fixed a calculation error on T so the temperature at the input field is correct now.
the slider is for initial T, no to be confused with the input field instantaneous T
the TKE is correctly calculated now, so no need to remove the m slider

my solution is implemented
i change the variable inside to make the V bigger so it will not encounter the bug.
done!

Ejs Open Source Ideal Gas Model based on Kinetic Theory of Gas
version 11

« Last Edit: March 28, 2010, 12:03:23 pm by lookang »

#### Edward Collin ##### Re: Ejs Open Source Ideal Gas Model based on Kinetic Theory of Gas
« Reply #3 on: December 07, 2010, 08:02:03 pm »
The kinetic theory of gases is based on a microscopic molecular model. Here, large scale objects, in our case an ideal gas, can be treated as a collection of molecules. This model is essential for subsequent applications in areas such as statistical physics, also known as statistical mechanics or statistical thermodynamics. But underlying this successful theory are several important assumptions that are based on Newtonian mechanics. Understanding these assumptions makes it easier to get a handle on such topics as the molecular explanation of temperature. These assumptions also explain the relationship between temperature, pressure, and volume in gases.

Before proceeding, you may wish to review the Bright Hub article on energy for a refresher on the definitions of kinetic and potential energy. Simply put, kinetic energy is the energy of motion while potential energy is stored energy.

You will also need to recall from basic physics the concept of momentum, which is an inertia of motion (momentum = mass x velocity).

Without further ado, let us proceed.
The Number of Molecules

There is a large number of molecules N, each of which has a mass m. This actually makes sense in light of our previous explorations with ideal gases; in a previous article we learned how to calculate the number of air molecules in a room, and found this to be a tremendously large number.
Shape of the Molecules

The moleculesMolecule shapes are assumed to be spherical are assumed to be spherical in shape, like billiards or soccer balls or baseballs.
Gas Type

The gases are pure, so the molecules are assumed to be identical and we are unable to distinguish between them. This also makes it easier to count them.
Molecular Separation

The average separationThe molecular distance must be relatively large of the molecules is large compared with their dimensions. This means that if the molecules have a diameter d, and they are separated by a distance R, then R >> d (R is much greater than d). In other words, the molecules are tiny and must be far apart.

This also means that these molecules are tiny enough so they can be considered point masses, and so we don't take into account their internal structure when we use our models or fashion new ones.
Molecular Motion

As mentioned, the molecules are assumed to obey Newton's laws of motion. However, this motion is random;The molecular motion is random the molecules move in all directions at equal probabilities. They also have varying speeds. Even when they can collide with each other, this random motion remains the same, i.e. the distribution of these velocities do not change with time.

What do bouncing billard balls, the unfortunate collision of a scarecrow with an electrical pole, and Boyle's Law have to do with the kinetic theory of gases? C

#### semira

• Newbie
• • Posts: 2 ##### Re: Ejs Open Source Ideal Gas Model based on Kinetic Theory of Gas
« Reply #4 on: November 30, 2013, 05:35:51 pm »
hi
can i get the code i'm working on a gas simulation..........so i can improve your work
this is my email: semira_system@yahoo.com
thank you

#### semira

• Newbie
• • Posts: 2 ##### Re: Ejs Open Source Ideal Gas Model based on Kinetic Theory of Gas
« Reply #5 on: November 30, 2013, 05:39:27 pm »
hi
can i get the source code i'm working on a similar gas simulation..........so i can improve your work
this is my email: semira_system@yahoo.com
thank you