if 'L2' in globals(): #| pass #| else: #| L2 = 2.*np.pi #| if 'L3' in globals(): #| pass #| else: #| L3 = 2.*np.pi #| #============================================== # Initialize Classes. #===================================================================== utilities = utilitiesClass() myFFT = FFTclass(N1,N2,N3,nthreads) grid = gridclass(N1,N2,N3,x,y,z,kc,L1,L2,L3) main = variables(weave,turb_model,rotate,Om1,Om2,Om3,grid,uhat,vhat,what,t,dt,nu,Ct,dt0,\ dt0_subintegrations,dt1,dt1_subintegrations,cfl,dim) #==================================================================== # Make Solution Directory if it does not exist if not os.path.exists('3DSolution'): os.makedirs('3DSolution') # Save the grid information np.savez('3DSolution/grid',k1=grid.k1,k2=grid.k2,k3=grid.k3,x=grid.x,y=grid.y,z=grid.z) # Save the run information np.savez('3DSolution/runinfo',turb_model=turb_model,dt=dt,save_freq=save_freq,nu=nu) #RK4 time advancement function. Note that to save memory the computeRHS #function puts the RHS array into the Q array
iteration_start = 0 #| if 'computeStats' in globals(): #| pass #| else: #| computeStats = 1 #| #============================================== # Make Solution Directory if it does not exist if (mpi_rank == 0): if not os.path.exists('3DSolution'): os.makedirs('3DSolution') # Initialize Classes. #===================================================================== myFFT = FFTclass(N1,N2,N3,nthreads,fft_type,Npx,Npy,num_processes,comm,mpi_rank) grid = gridclass(N1,N2,N3,x,y,z,kc,num_processes,L1,L3,mpi_rank,comm,turb_model) main = variables(grid,u,v,w,t,dt,et,nu,myFFT,Re_tau,turb_model,tau0,Cs,mpi_rank) #==================================================================== main.computeStats = computeStats main.iteration = iteration_start main.save_freq = save_freq ### Main time integration loop t0 = time.time() #======================================================================== while (main.t < main.et): #------------- Save Output ------------------ if (main.iteration%main.save_freq == 0): div = checkDivergence(main,grid) myFFT.myifft3D(main.uhat,main.u)
pass #| else: #| cfl = -dt #| if 'fft_type' in globals(): #| pass #| else: #| fft_type = 'pyfftw' #| #============================================== # Make Solution Directory if it does not exist if (mpi_rank == 0): if not os.path.exists('3DSolution'): os.makedirs('3DSolution') # Initialize Classes. #===================================================================== myFFT = FFTclass(N1,N2,N3,nthreads,fft_type,Npx,Npy,num_processes,comm) grid = gridclass(N1,N2,N3,x,y,z,kc,num_processes,L1,L3,mpi_rank) main = variables(grid,u,v,w,t,dt,et,nu,myFFT,Re_tau) ucheck = myFFT.myifft3D( myFFT.myfft3D(main.u)) checkVal = np.linalg.norm(main.u - ucheck) print('FFT CHECK = ' + str(checkVal) ) if ( checkVal >= 1e-1 ): sys.stdout.write('ERROR! FFT Check routines have error -> ifft(fft(u)) = ' + str(checkVal) + ' \n') sys.stdout.write('Quitting! \n') sys.stdout.flush() exit(0)
tau0 = 0.1 #| if 'Cs' in globals(): pass else: Cs = 0.16 #============================================== # Make Solution Directory if it does not exist if not os.path.exists('3DSolution'): os.makedirs('3DSolution') # Initialize Classes. #===================================================================== myFFT = FFTclass(N1,N2,N3,nthreads,fft_type) grid = gridclass(N1,N2,N3,x,y,z,kc) main = variables(grid,u,v,w,t,dt,et,nu,myFFT,Re_tau,turb_model,tau0,Cs) #==================================================================== main.iteration = 0 main.save_freq = save_freq ### Main time integration loop t0 = time.time() #main.u = myFFT.myifft3D( myFFT.myfft3D(main.u)) #main.v = myFFT.myifft3D( myFFT.myfft3D(main.v)) #main.w = myFFT.myifft3D( myFFT.myfft3D(main.w)) ucheck = myFFT.myifft3D( myFFT.myfft3D(main.u)) checkVal = np.linalg.norm(main.u - ucheck)