imsh = imshow(transpose(sc.ones((S.Nx, S.Ny), 'f')), cmap=cm.jet, vmin=-0.05, vmax=0.05, origin='lower', interpolation='bilinear') colorbar() #-------------------------------------------------------------------- from time import * t0 = time() for tstep in xrange(1, tmax + 1): S.updateE() Drude.updateE() Cpml.updateE() S.Ez[Nx / 2 + 30, Ny / 2 + 50, :] += sc.sin(0.1 * tstep) S.updateH() Cpml.updateH() if tstep / 20 * 20 == tstep: print_elapsed_time(t0, time(), tstep) imsh.set_array(transpose(S.Ez[:, :, Nz / 2])) png_str = './png/%.6d.png' % tstep savefig(png_str) print_elapsed_time(t0, time(), tstep)
cmap=cm.jet, vmin=-0.05, vmax=0.05, origin='lower', interpolation='bilinear') colorbar() #-------------------------------------------------------------------- from time import * t0 = time() for tstep in xrange( 1, tmax+1 ): S.updateE() Drude.updateE() Cpml.updateE() S.Ez[Nx/2+30, Ny/2+50, :] += sc.sin(0.1*tstep) S.updateH() Cpml.updateH() if tstep/20*20 == tstep: print_elapsed_time( t0, time(), tstep ) imsh.set_array( transpose( S.Ez[:,:,Nz/2] ) ) png_str = './png/%.6d.png' % tstep savefig(png_str) print_elapsed_time( t0, time(), tstep )
cmap=cm.jet, vmin=-0.2, vmax=0.2, origin='lower', interpolation='bilinear') colorbar() #-------------------------------------------------------------------- from time import * t0 = time() for tstep in xrange( 1, tmax+1 ): S.updateE() Drude.updateE() Cpml.updateE( ( 'fb', 'fb', '' ) ) S.Ez[Nx/2+30, Ny/2+50, :] = sc.sin(0.1*tstep) S.updateH() Cpml.updateH( ( 'fb', 'fb', '' ) ) if tstep/20*20 == tstep: print_elapsed_time( t0, time(), tstep ) imsh.set_array( transpose( S.Ez[:,:,Nz/2] ) ) png_str = './png/%.6d.png' % tstep savefig(png_str) print_elapsed_time( t0, time(), tstep )
#-------------------------------------------------------------------- from time import * t0 = time() for tstep in xrange(1, tmax + 1): if myrank is not server: S.updateE() Cpml.updateE(pml_direction) mpi_exchange(S.Ey, S.Ez, myrank, target_list, mpi_func_list) mpi_exchange_pbc(S.Ey, S.Ez, myrank) if myrank == 2: S.Ez[30, Ny / 2 - 50, :] += sc.sin(0.1 * tstep) S.updateH() Cpml.updateH(pml_direction) if tstep / 50 * 50 == tstep: if myrank is not server: for output in output_list: output.send() else: print_elapsed_time(t0, time(), tstep) imsh.set_array(transpose(Output_ez.gather())) Output_ex.gather() Output_ez_yz.gather() Output_ez_yz_2.gather() #plot( Output_ez_yz_2.gather() ) png_str = './png/Ez-%.6d.png' % tstep savefig(png_str)
g_extra_args = ['colorbar'] graphic = ViewGraphic2d( data_shape, g_extra_args ) #-------------------------------------------------------------------- from time import * t0 = time() for tstep in xrange( 1, tmax+1 ): if myrank is not server: S.updateE() Cpml.updateE( pml_direction ) mpi_exchange( S.Ey, S.Ez, myrank, target_list, mpi_func_list ) mpi_exchange_pbc( S.Ey, S.Ez, myrank ) if myrank == 2: S.Ez[30, Ny/2-50, :] += sc.sin(0.1*tstep) S.updateH() Cpml.updateH( pml_direction ) if tstep/50*50 == tstep: if myrank is not server: Output_ez.send() else: print_elapsed_time( t0, time(), tstep ) graphic.draw( Output_ez.gather() ) png_path = './png/Ez-%.6d.png' % tstep graphic.save( png_path )