Particle Simulation in 2D: Estimating Cell Values

  • Context: Graduate 
  • Thread starter Thread starter mXSCNT
  • Start date Start date
  • Tags Tags
    Particle Simulation
Click For Summary

Discussion Overview

The discussion revolves around simulating a gas in a two-dimensional grid for a cellular automaton, focusing on approximating the number of particles and their average velocities in adjacent cells over time. Participants explore various methods and considerations for achieving this simulation efficiently, without tracking individual particles.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant proposes approximating the number of molecules and their velocities in adjacent cells by calculating the number and velocity of molecules crossing cell boundaries over time.
  • Another participant argues that calculating forces on molecules is necessary for accurate results, especially with fewer molecules, and suggests methods like the fast multipole method and Monte Carlo simulations for different approaches.
  • A different participant mentions that accuracy is not a priority since the simulation is for an ant colony, where qualitative results are sufficient, and discusses the scale of the simulation with a focus on computational efficiency.
  • One participant expresses skepticism about simulating gas behavior without statistical averages, emphasizing the need for a large number of particles and suggesting Verlet integrators for molecular dynamics modeling.
  • Another participant raises concerns about the feasibility of tracking individual particles due to the high number involved in the simulation.
  • A participant introduces the concepts of divergence and diffusivity as essential for calculating diffusion currents between cells.
  • One participant indicates an intention to explore Lattice Boltzmann methods for the simulation.

Areas of Agreement / Disagreement

Participants express differing views on the necessity of accuracy in the simulation and the methods to achieve particle behavior approximation. There is no consensus on a single approach, and multiple competing methods are discussed.

Contextual Notes

The discussion highlights limitations related to the assumptions about particle interactions, the scale of the simulation, and the computational constraints involved in tracking a large number of particles.

Who May Find This Useful

This discussion may be useful for individuals interested in computational physics, simulation techniques, and modeling of particle dynamics in cellular automata or similar systems.

mXSCNT
Messages
310
Reaction score
1
I would like to simulate a gas--very approximately--in 2 dimensions. The container will be divided into a grid, and instead of keeping track of each molecule of gas individually, I want to let each cell in the grid have a value for the number of particles in that cell, and another couple of values for the average velocity within the cell. This will allow me to simulate a larger number of particles, without slowing down the simulation.

The problem is then this: given that a cell has n molecules at time t=0, with average velocity v, how can one approximate the number and average velocity of molecules in the 4 adjacent cells at time t=1?

I guess that I need to look at the number and velocity of molecules passing across the boundary between an adjacent pair of cells over that time unit. I'm sure this problem has been solved before, I just don't know where.
 
Physics news on Phys.org
What kind of numbers are we talking about?

I don't think you could approximate the number and average velocity of molecules in the 4 adjacent cells at time t=1 without going through and calculating the forces on the molecules. Unless you have a very large number of molecules to work with you are not going to see a statistically averaged result (and really, with large numbers of gas particles situated haphazardly in a cell, the average net velocity would be zero and though the average speed would not be zero). There are ways to simulate large number of unknowns, like using fast multipole method. You can estimate the interaction of particles far away from your particle of interest by combining their potentials into the summation of pole moments (monopole, dipole, quadrapole, etc).

Sometimes you can use monte carlo methods to achieve desired results as well. Monte carlo and similar methods (random walk, worm theory (I think that's the name), etc) generally iterate towards the final state, they aren't useful for observing the motion of the particles, but if you want to know the equilibrium state then these methods are a different way of achieving that.
 
It doesn't have to be very accurate--this is for a cellular automaton (an ant colony--I want to give my ants velocities, instead of having them drift randomly). If the result looks qualitatively OK then it's good enough. Long-range effects aren't a concern, because velocities can be slow (1 cell/time step or less) and my ants don't have their own gravity :P

For scale: presently I'm simulating a 640x480 grid, there could be 0-255 particles per pixel, and I want to have a high frame rate (30+ FPS). I want to be economical in how much computation I do per pixel.
 
Well I'm just not sure how you would do this with a gas. The molecules of a gas have a potential profile, Van der Waals potential. The interaction between particles is a summation of the forces from all possible pairs according to the potential used. You can't just stick 10 gas molecules in a box and ask how will they come out and with what velocities without doing the calculations. Only if you have a very very large number would you be able to estimate this from statistical averages but that wouldn't be the case here.

Take a look at Verlet integrators for an accurate and fast way to model molecular dynamics. If your "potential" has a sharp distance cutoff, then what you can do is ID each particle with the box they are in. You could keep a relationship for the neighboring boxes. For example, you have an array of box ids and each element points to a list of atoms that are in each box. Then you have a second list of box ids where each element points to a list of the neighboring boxes. Then you could just go through and only calculate the interactions from the atoms in the 9 boxes (1 self box, 8 neighbors).

Another way is to have a list for each atom of the atoms that are within a cutoff distance of itself. Then you calculate the resulting interactions at that time step and integrate. The next time step, you would go through and update the list. You could speed this up by only looking at the atoms from the previous time step and the atoms in the list of these atoms (need to check for atoms that may come into your cutoff distance). This could work as long as the velocities are kept low enough.
 
I think that to keep a separate ID and compute separate behavior for each particle would be too slow. That would amount to tens of millions of particles (the grid is not sparse).
 
I believe you will need to know two things. 1) Divergence in two dimensions and 2) Diffusivity (diffusion coefficient). With this information, you can calculate a diffusion current from one cell to adjacent cells.
 
I'm going to try Lattice Boltzmann methods.
 

Similar threads

Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
2
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
Replies
7
Views
1K
  • · Replies 10 ·
Replies
10
Views
2K