File file2 = new File("\\potential.dat");
file2.delete();
//creates new file "efield.dat" in working directory and writes
//field data to it
WriteFile fieldFile = new WriteFile("efeld", "");
for (int i = 0; i < g.getNumCellsX(); i++) {
for(int j = 0; j < g.getNumCellsY(); j++) {
fieldFile.writeLine(i*g.getCellWidth() + "\t" + j*g.getCellHeight() +
"\t" + g.getEx(i, j) + "\t" + g.getEy(i, j));
}
}
fieldFile.closeFstream();
WriteFile potentialFile = new WriteFile("potential", "");
for (int i = 0; i < g.getNumCellsX(); i++) {
for(int j = 0; j < g.getNumCellsY(); j++) {
potentialFile.writeLine(i*g.getCellWidth() + "\t" + j*g.getCellHeight() + "\t" + g.getPhi(i, j));
}
}
potentialFile.closeFstream();
//YOU NEED GNUPLOT FOR THIS http://www.gnuplot.info/
//NEEDS TO BE IN YOUR EXECUTION PATH (i.e. PATH variable on windows)
//plots the above output as vector field
try {