Version 0.4

9 prikaza
Preskoči na prvu nepročitanu poruku

Andreas Ipp

nepročitano,
25. lip 2012. 10:27:2225. 06. 2012.
u open...@googlegroups.com
I've created a new pull request for updates for version 0.4:

For some strange reason, the program would behave differently when launched as java application or as java applet in a browser. 
Since it kept crashing, I introduced a quick fix:

It needs to be analyzed more carefully why the program crashed there in the first place.

If you are happy with this, we can release version 0.4.

Jan Kis

nepročitano,
26. lip 2012. 19:23:2726. 06. 2012.
u open...@googlegroups.com
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?

You can find the code at https://github.com/karolovbrat/openpixi.git in the particleOutsideOfSimulationArea branch.

Cheers,
Jan

Kirill Streltsov

nepročitano,
27. lip 2012. 03:11:4827. 06. 2012.
u open...@googlegroups.com
Hi Jan,

the +1 was added because we have used an extra layer of cells around the simulation area previously. Therefore, the simulation started at array index 1,1. To make this more clear we introduced xCellPosition2 to distinguish between the values that are the "non physical" array indices and the actual distances inside the simulation area. The index of the grid point at the lower left to the particle is xCellPosition, but the coordinate of this point is (xCellPosition-1)*cellWidth. As you will notice in the code xCellPosition2 is = to xCellPosition but in turn the algorithm was changed a bit.

            g.addJx(xCellPosition, yCellPosition, p.getCharge() * p.getVx() * (xCellPosition2 * g.getCellWidth() - p.getX()) *
                    (yCellPosition2 * g.getCellHeight() - p.getY()) / (g.getCellWidth() * g.getCellHeight()));

For example in the code above xCellPosition2 * g.getCellWidth() must be the grid coordinate on the right side of the particle, after your change its on the left side.

I think you can fix it by adding a +1 in these lines:
            int xCellPosition2 = xCellPosition;
            int yCellPosition2 = yCellPosition;

Havent tried it...got to go since I have a meeting with andreas in 1h.

Jan Kis

nepročitano,
27. lip 2012. 06:23:1727. 06. 2012.
u open...@googlegroups.com
Thanks Kirill, your fix:

int xCellPosition2 = xCellPosition + 1;
int yCellPosition2 = yCellPosition + 1;

worked very nicely :)

I am still having some trouble with git, as soon as I resolve it, I will issue a pull request.

Jan

Andreas Ipp

nepročitano,
28. lip 2012. 15:54:5028. 06. 2012.
u open...@googlegroups.com
I merged your pull request #27 and released version 0.4:


Am Mittwoch, 27. Juni 2012 12:23:17 UTC+2 schrieb Jan Kis:
Thanks Kirill, your fix:

int xCellPosition2 = xCellPosition + 1;
int yCellPosition2 = yCellPosition + 1;

worked very nicely :)

I am still having some trouble with git, as soon as I resolve it, I will issue a pull request.

Jan
Odgovori svima
Odgovori autoru
Proslijedi
0 novih poruka