############################################################################# # Simulation ############################################################################# for t in time: X = reflection(vort[1].xy) vort[2].xy = X vort[2].updatexy = X vort[2].strength = -vort[1].strength/abs(vort[1].xy) vort[0].strength = -vort[2].strength target = [vort[i].xy for i in range(num_of_targets)] for i in range(num_of_targets): if vort[i].ele_type != "tracer": field[i][:] = vortex(vort[i], target) print field for i in range(num_of_targets): for j in range(num_of_vortex): if vort[i].fixed == 0: vort[i].updatexy = field[j][i]*dt + vort[i].updatexy target = [vort[i].updatexy for i in range(num_of_targets)] print target for i in range(num_of_targets): if vort[i].ele_type != "tracer": field2[i][:] = vortex(vort[i], target, "update")
time = pylab.arange(0, sim_time, dt) X = [] Y = [] alpha = 0.5 ############################################################################# # Simulation ############################################################################# for t in time: target = [vort[i].xy for i in range(num_of_targets)] for i in range(num_of_targets): if vort[i].ele_type != "tracer": field[i][:] = vortex(vort[i], target) for i in range(num_of_targets): for j in range(num_of_vortex): if vort[i].fixed == 0: vort[i].xy = field[j][i]*dt + vort[i].xy # if (round(t/dt)%round(1/dt) == 0): X.extend(vort[i].xy.real for i in range(num_of_targets)) Y.extend(vort[i].xy.imag for i in range(num_of_targets)) line.set_xdata(X) line.set_ydata(Y) pylab.draw() raw_input()