Ideal gas simulation

  • Thread starter leibo
  • Start date
  • #1
11
1

Main Question or Discussion Point

Hi

I built with Python a simulation of an ideal gas in 2D, treating the molecules as hard spheres with elastic collisions. I am trying to test the experimental values of P,T etc. in the simulation versus the theoretical values. however, I have two problems:

1) when comparing the pressure in the simulation to the pressure predicted from P=NmVx^2/a^2 (when N in number of molecules, m is the mass of each molecule and a^2 is the area of the box) I consistently get approximately the right values, but they are higher by a factor of 1000. What can be the reason?

2) I wonder how should I adjust the value of the gas constant R to the fact that in the simulation distances and velocities are measured with unites of pixels and pixels/iteration rather than by meters and meters/sec?

Thanks in advance and sorry for my poor english
 

Answers and Replies

  • #2
1,688
234
I built with Python a simulation of an ideal gas in 2D, treating the molecules as hard spheres with elastic collisions.
An ideal gas is composed of point masses with no interaction (except gravity).

when comparing the pressure in the simulation to the pressure predicted from P=NmVx^2/a^2 (when N in number of molecules, m is the mass of each molecule and a^2 is the area of the box) I consistently get approximately the right values, but they are higher by a factor of 1000. What can be the reason?
In a 2D simulation the walls are 1D and therefore have no area but a length only.

I wonder how should I adjust the value of the gas constant R to the fact that in the simulation distances and velocities are measured with unites of pixels and pixels/iteration rather than by meters and meters/sec?
Just define the size of a pixel in meters and the length of an iteration step in seconds.
 
  • #3
11
1
Molecules of an ideal gas do interact through elastic collisions. They do not interact through electric attraction forces. according to Wikipedia: "the ideal gas model depends on the following assumptions...All collisions are elastic and all motion is frictionless (no energy loss in motion or collision)...There are no attractive or repulsive forces between the molecules or the surroundings".

I did not say the walls have area, I said the box has area.

Thank you for the second answer.
 
  • #4
33,810
9,518
A factor of 1000 looks like some error in unit conversions - kg to g, m to mm or whatever.
 
  • #5
1,688
234
Molecules of an ideal gas do interact through elastic collisions.
With the walls but not with each other. Points are simply to small for local interactions. By using elastic spheres instead of points you created a very simple real gas model.

I did not say the walls have area, I said the box has area.
In a 2D simulation the area of the box is irrelevant for the pressure. It plays the same role as the volume in 3D.
 

Related Threads for: Ideal gas simulation

  • Last Post
Replies
6
Views
2K
Replies
3
Views
2K
  • Last Post
Replies
1
Views
947
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
5
Views
3K
Top