# Ideal gas law in two dimensions?

#### Jason D.

Hi everyone,

I know that in P=nRT/v

R = 8.314 m3*Pa/mol*k

Now, when you are trying to calculate P, if you have volumn in m3 on the bottom, everything cancels out and you are left with Pa.

I've just developed a simulator which simulates particle motion over time and calculates pressure in a box. The box however is in 2D, not 3D, so I only have m2 on the bottom. The number's I'm getting are roughly correct with the ideal gas law, but are all off by a factor 1000 or 10000 for some reason. I can't see this factor being a coincidence, I think it's because of the m3, m2 difference but am unsure of how to calculate R for m2, or why it would be 0.008314 (e.g. a factor of 1000) for m2.

If you have any suggestions, let me know! Thanks.

Jason

(PS: I had to do the simulator as a project. Not sure if this this qualifies it as a "homework" question or not).

#### Ygggdrasil

Gold Member
I haven't done the calculations, but I think it may be possible to derive the gas constant for an ideal two-dimensional gas from first principles if you know statistical thermodynamics. You would have to calculate the partition function of a system with N non-interacting particles in a two dimensional space, and from the partition function, you could obtain an expression for the Helmholtz free energy. Using the Maxwell relations, you could then derive an expression for the equation of state of the 2D ideal gas.

#### Borek

Mentor
How do you have m2 at the bottom of 2d box? Or more like - how does the bottom of 2d box differ from its top? And how do you calcuate pressure? If the box is 2d and is 1m x 1m, gas molecules won't be able to hit neither top nor bottom, as they can move only parallel to them, that's 2d. The only pressure they exert will be the one exerted on the edge, so it won't be force per surface, but force per length.

Or am I missing something?

#### Jason D.

How do you have m2 at the bottom of 2d box? Or more like - how does the bottom of 2d box differ from its top? And how do you calcuate pressure? If the box is 2d and is 1m x 1m, gas molecules won't be able to hit neither top nor bottom, as they can move only parallel to them, that's 2d. The only pressure they exert will be the one exerted on the edge, so it won't be force per surface, but force per length.

Or am I missing something?
Nope, you pretty much have the idea exactly. Essentially, my particles only have an X&Y coordinate, and Vx and Vy velocity. Collisions are handled with 2D collision equations and are all regarded as perfectly elastic. When a particle hits a wall, a momentum of 2mvxy is absorbed by the wall. All collisions with the wall are summed over time t and divided by the circumference of the box and t to obtain the (two dimensional) pressure in the box.

After reading your post, I realized I made a mistake in my initial explanations...the denominator is over perimeter NOT area, so it should be m on the bottom and not m2.

My result is actually in Pa m2, not Pa m as I first thought. Still, I need to figure out what R would be for this so I can get Pa at the end.

It might turn out to be moot anywhere since I realized by numbers are only accurate (the factor of 1000 notwithstanding) around 500-2000 particles (10000x10000 box). I'm supposed to have at least 10000 particles in the box, for which my numbers are more like a factor 2000 off :(, so I'll have to see what's going on.

Still, if anyone has any suggestions let me know. Thanks for your reply Ygggdrasil but unfortunately I have no idea what any of that means, and I certainly wouldn't expect anyone to take the time to explain it to me, lol.

Cheers,
Jason

#### alxm

Still, I need to figure out what R would be for this so I can get Pa at the end.
R will be the same. It has no dependence on spatial dimensions.

Still, if anyone has any suggestions let me know. Thanks for your reply Ygggdrasil but unfortunately I have no idea what any of that means
Well that's a bad sign. With elastic collisions of identical particles, velocities are going to be constant. So how are you assigning the initial velocities, if not by the Maxwell-Boltzmann distribution?

#### Jason D.

R will be the same. It has no dependence on spatial dimensions.

Well that's a bad sign. With elastic collisions of identical particles, velocities are going to be constant. So how are you assigning the initial velocities, if not by the Maxwell-Boltzmann distribution?
Initial velocities are assigned randomly. I use a random number generator to get an absolute velocity between 0 and 50. I then randomly generate an angle between 0 and 2 Pi, and resolve those into Vx and Vy velocities. I didn't just make that up, it's exactly what the project description says to do.

EDIT: Also, if R is the same, any suggestion on the factor of 1000 difference?

Last edited:

#### alxm

Initial velocities are assigned randomly. I use a random number generator to get an absolute velocity between 0 and 50. I then randomly generate an angle between 0 and 2 Pi, and resolve those into Vx and Vy velocities. I didn't just make that up, it's exactly what the project description says to do.
Well, there's your problem. The velocities aren't randomly distributed. Not in the sense of a 'flat' distribution where every value is equally probable. They follow a distribution of velocities called the http://en.wikipedia.org/wiki/Maxwell-Boltzmann_distribution" [Broken].

Whereas your distribution would look like a straight line that suddenly drops off to zero at 50.

I can't really see how one would get results comparable with the Ideal Gas Law without a realistic statistical distribution of velocities.

Last edited by a moderator:

#### Jason D.

Well, there's your problem. The velocities aren't randomly distributed. Not in the sense of a 'flat' distribution where every value is equally probable. They follow a distribution of velocities called the http://en.wikipedia.org/wiki/Maxwell-Boltzmann_distribution" [Broken].

Whereas your distribution would look like a straight line that suddenly drops off to zero at 50.

I can't really see how one would get results comparable with the Ideal Gas Law without a realistic statistical distribution of velocities.
Interesting...well according to my professor it should work! Haha. Oh well, thanks anyway.

Jason

Last edited by a moderator:

#### Borek

Mentor
I can't really see how one would get results comparable with the Ideal Gas Law without a realistic statistical distribution of velocities.
I can be missing something, but won't correct distribution came out from the simulation? Assigning initial velocties is equivalent of injecting some energy into the system, once molecules start to collide distribution will change.

#### Ygggdrasil

Gold Member
It depends on how long he runs the simulation. Many simulations are computationally intensive and cannot be run to simulate large amounts of time. While the system should reach a Maxwell Boltzmann distribution, whether Jason observes this depends on whether the simulation is long enough for the system to reach equilibrium (IIRC, the system will relax to equilibrium fairly quickly, on the scale of the mean collision time, so his simulation should reach equilibrium fairly quickly unless the gas is very diffuse).

#### alxm

I can be missing something, but won't correct distribution came out from the simulation? Assigning initial velocties is equivalent of injecting some energy into the system, once molecules start to collide distribution will change.
Well, as Yggdrasil said, you'll (eventually - and this may take be a rather long time) approach a normal distribution of velocities in every direction, giving you a Maxwell-Boltzmann-like distribution.

The problem is you've lost T. It's not very easy to say what the 'temperature' is for a flat 0<v<50 distribution, and without it, you can't immediately compare to the ideal gas law result.

Edit: After further reflection - No! I don't think you will necessarily reach the MB distribution. It depends on how you treat the collisions. IIRC: In addition to being elastic - the probability of scattering must be the same in every direction. Which is physically weird. Again, if my memory serves me this is what Maxwell assumed but couldn't really justify properly, and which got thrown out by Boltzmann in his re-derivation, which didn't use particle collisions at all. I'm going to have to look into this.

Last edited:

#### Ygggdrasil

Gold Member
Looking through my old stat mech notes, it turns out that I had solved for the equation of state of a 2D ideal gas in an old problem set. The equation of state is PA = NkBT, where N is the number of molecules. This means that R is essentially the same as in the 3D case. Thus, the reason why your simulations do not match the ideal gas equation is that you are looking at a nonequilibrium state where the temperature is not defined.

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving