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

Click For Summary

Discussion Overview

The discussion revolves around troubleshooting a Python simulation of an ideal gas in 2D, specifically addressing discrepancies in pressure calculations and the adjustment of the gas constant R due to the use of pixel-based measurements instead of standard units. The focus includes theoretical comparisons, unit conversions, and the implications of modeling choices.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant notes that the simulation yields pressure values approximately 1000 times higher than expected, questioning the potential reasons for this discrepancy.
  • Another participant suggests that the issue may stem from unit conversion errors, such as converting kilograms to grams or meters to millimeters.
  • There is a discussion about the nature of interactions in an ideal gas, with one participant asserting that molecules interact through elastic collisions, while another clarifies that the ideal gas model assumes no attractive or repulsive forces between molecules.
  • Participants discuss the adjustment of the gas constant R, with one suggesting defining the size of a pixel in meters and the length of an iteration step in seconds to facilitate the conversion.
  • Clarifications are made regarding the area of the box in a 2D simulation and its relevance to pressure calculations, with some participants emphasizing that the area plays a role similar to volume in 3D models.

Areas of Agreement / Disagreement

Participants express differing views on the nature of interactions in an ideal gas and the implications of the simulation's dimensionality. There is no consensus on the exact cause of the pressure discrepancy, and multiple competing explanations are presented.

Contextual Notes

Limitations include potential misunderstandings regarding unit conversions and the assumptions underlying the ideal gas model. The discussion reflects varying interpretations of the model's assumptions and their application in the simulation.

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
 
Science 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.
 

Similar threads

Replies
6
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 35 ·
2
Replies
35
Views
6K
  • · Replies 69 ·
3
Replies
69
Views
8K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 60 ·
3
Replies
60
Views
11K
  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 22 ·
Replies
22
Views
6K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K