Trying to improve my multigrid algorithm for calculating the potential field. I am using two grids, the fine one and the coarse one which is 20 times as wide. First I do 20 fine iterations, then 60 coarse ones, then I interpolate to the fine grid and do another 20 there.
I use the jacobi iteration step which is to take the average of the 4 adjacent grid values and add the value of the source of the point times the step size.
This means the source term matters a lot for the coarse iteration. This is a problem because depending on the location of the particle there is one or up to four coarse grid vertices within its radius. This makes a huge difference on their effect. (spot the tiny yellow dots: they are the same mass&radius as the others).
I want to do many coarse steps to get some reach fast.
Alternating between coarse&fine steps is not good because the portals make the interpolation rather expensive.
Maybe I need to distribute my mass more naturally within the radius: more dense in the center, less so in the periphery...
#physicssim #multigrid #physics #creativecoding