Hi Andreas and Kirill,
I have corrected (or at least I believe so) the mentioned crash.
The problem was that in CloudInCell we were trying to interpolate to a non existent cell. The code enabled to interpolate to the cell at x position numCellsX + 2 (the same applies for the y position).
Why did the code allow the interpolation to such a distant cell?
1) The code which determined the position of the particle was as follows
int xCellPosition = (int) Math.floor(p.getX() / g.getCellWidth() + 1);
int yCellPosition = (int) Math.floor(p.getY() / g.getCellHeight() + 1);
This returns a cell one greater than really should be returned. That is how we get the first +1 cell on x axis. Consequently, this also explains why the situation never happens at the other end of simulation area ie. at -1, -1.
2) The hardwall boundary allows the particle to be outside of the simulation area. Thus, we get another +1 cell on the x axis.
Finally, the interpolation interpolates to four surrounding cells. Thus, we get the last +1 making it numCellsX + 2.
How did I resolve the problem?
1) I corrected the code which extracts the particle's cell to
int xCellPosition = (int) Math.floor(p.getX() / g.getCellWidth());
int yCellPosition = (int) Math.floor(p.getY() / g.getCellHeight());
2) I added one extra cell at the end of simulation area so that under hardwall boundary conditions we can ask for the cell numCellsX + 1.
However, I did not issue a pull request since the correction 1 caused that the ClaudInCellTest is not passed any more. More specifically, the methods checkSignJx and checkSignJy in GridTestCommon.java fail now. I am quite hopeless here. Can you maybe help me figure out why these tests fail? The very first question of course is whether my correction 1 is indeed correct?