- #1
gibatom
- 10
- 4
- Homework Statement
- Hello everybody,
I’m currently working on an university project, aiming to understand better the kinetic of a gas of atoms (in 2D).
To do so, i’m using a Verlet algorithm, which basically consists of improving the classical method of integrating the equations of motions of all the atoms making up the gas (with Newton’s 2nd law). With this algorithm, the energy should be conservered (that’s why it was developped in the first place) - which is effectively what i see with my Python code when the gas is not confined.
Neverthelsesss i would like to modelize a gas confined in a box, in order to study values such as the pressure, the temperature at equilibrum or the repartition of atom speeds. To do so, i use periodic conditions (instead of rebounds with the box, which i thought would be more complex) : i.e when an atom leaves the box, it appears on the other side, like PacMan.
Now, the problem i have is that as soon as an atom leaves the box, comes in the other side and interacts frankly with other atoms, the energy in the box grows all of a sudden.
Has any of you already encountered this problem ? Or has someone an idea to solve this problem of the non-conservation of the energy when i use periodic conditions ?
Thank you very much in advance for your help,
(If necessary i can show you my code)
- Relevant Equations
- -Equations of motions (2nd law of thermodynamics)
Verlet Algorithm with periodic conditions