Also, I don't see where there the size of the surface area of the cell is corrected for. Otherwise we will be over counting the effect of small cells and under counting the effect of large cells. Or am I missing somewhere this is taken into account? Maybe this is this included in the value for 'cell normal'? I.e. is the magnitude of this vector scaled with the size of the cell?
* I think this is because in line 121 of your code you write to the text file:
Code: Select all
forces[1], forces[2], forces[3], forces[2]);
Code: Select all
forces[1], forces[0], forces[3], forces[2]);