Ideal Gas Simulation: Troubleshooting Pressure and Gas Constant in 2D Model

AI Thread Summary
The discussion revolves around a Python simulation of an ideal gas in 2D, where the user encounters issues comparing simulated pressure to theoretical values, finding results consistently higher by a factor of 1000. The discrepancy is suggested to be due to unit conversion errors, such as miscalculating mass or distance units. Additionally, the user seeks guidance on adjusting the gas constant R, given that the simulation uses pixels for distance and velocity measurements. It is noted that in a 2D simulation, the area of the box is crucial for pressure calculations, similar to volume in 3D. Overall, the conversation highlights challenges in unit conversions and the implications of dimensionality in gas simulations.
leibo
Messages
11
Reaction score
1
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
 
Physics news on Phys.org
leibo said:
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).

leibo said:
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.

leibo said:
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.
 
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.
 
A factor of 1000 looks like some error in unit conversions - kg to g, m to mm or whatever.
 
leibo said:
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.

leibo said:
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.
 
Thread 'Question about pressure of a liquid'
I am looking at pressure in liquids and I am testing my idea. The vertical tube is 100m, the contraption is filled with water. The vertical tube is very thin(maybe 1mm^2 cross section). The area of the base is ~100m^2. Will he top half be launched in the air if suddenly it cracked?- assuming its light enough. I want to test my idea that if I had a thin long ruber tube that I lifted up, then the pressure at "red lines" will be high and that the $force = pressure * area$ would be massive...
I feel it should be solvable we just need to find a perfect pattern, and there will be a general pattern since the forces acting are based on a single function, so..... you can't actually say it is unsolvable right? Cause imaging 3 bodies actually existed somwhere in this universe then nature isn't gonna wait till we predict it! And yea I have checked in many places that tiny changes cause large changes so it becomes chaos........ but still I just can't accept that it is impossible to solve...
Back
Top