geodynamics / aspect

A parallel, extensible finite element code to simulate convection in both 2D and 3D models.
https://aspect.geodynamics.org/
Other
227 stars 237 forks source link

More clever way to generate particles in cell #1035

Open gassmoeller opened 8 years ago

gassmoeller commented 8 years ago

@bangerth knows what this is about.

bangerth commented 8 years ago

When using a random distribution of particles, we first compute how many particles each cell should get. Let's say that, on each cell K, we find that we need to distribute N_K particles randomly. We then create particles randomly in the box that surrounds K, and take all those that are within K, until we have N_K. This works, of course, but it's inefficient because finding out whether a particle is inside or outside a cell K is expensive.

A better way to do this would be to generate N_K particles on the reference cell and then map them forward to K. This is cheap (the forward mapping is far cheaper than the backward mapping from real to reference cell). Furthermore, we can take all particles because we know that they are inside the cell.

Unfortunately, for strongly distorted cells, a uniform distribution of points on the reference cell does not yield a uniform distribution of points on the real cell. But, we can create a uniform distribution on the real cell using importance sampling with a weight equal to |det J|, as that is how each small part of the reference cell gets extended when mapping to the real cell. This means that we have to create more samples and select a smaller fraction, but we won't have to do the backward mapping.

In fact, we could even take into account that the original probability distribution is not necessarily uniform on cell K, and include this into the importance sampling factor.