else: # Initialize a simulation form a restart file [ ss , local_vars] = pyrandaRestart( problem ) # Restore simulation object locals().update( local_vars ) # Restore local vars saved time = ss.time # Resume time dt = ss.deltat # Last deltat import pdb pdb.set_trace() ## Make a probe set for diagnostics xprb = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] # X-positions of the probes yprb = [0.1, 0.2, 0.4, 0.55, 0.7, 0.8] # Y-positions of the probes probes = pyrandaProbes(ss,x=xprb,y=yprb,z=None) # Create a probe set ## Variables to write to visualization wvars = ['Yh','rho','u','v','p','beta','kappa','adiff','mu','T','op'] viz_freq = stop_time / float( Nviz ) viz_dump = time + viz_freq ## Frequency of restarts dump_freq = 3000 ## Frequency of probe queries probe_freq = 10 ## Plot the solution of 'rho' if viz:
plt.figure(2) plt.clf() plt.contourf( xx,yy,v ,64 , cmap=cm.jet) plt.contour( xx,yy,phi,[0.0]) plt.plot(xx, yy, 'k-', lw=0.5, alpha=0.5) plt.plot(xx.T, yy.T, 'k-', lw=0.5, alpha=0.5) plt.title(pvar) plt.pause(.001) # Make a probe set for diagnostics x = [5.]*20 y = numpy.linspace(-10,10,20) probes = pyrandaProbes(ss,x=x,y=y,z=None) while tt > time: # Update the EOM and get next dt time = ss.rk4(time,dt) dt = min( ss.variables['dt'].data * CFL, dt*1.1) dt = min(dt, (tt - time) ) # Print some output ss.iprint("%s -- %s --- %f" % (cnt,time,dt) ) cnt += 1