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 def advanceQ_RK4(main,grid,myFFT,utilities): Q0 = np.zeros(np.shape(main.Q),dtype='complex')
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) myFFT.myifft3D(main.vhat,main.v)
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)
pass else: folderLoc = '3DSolution' #============================================== # Make Solution Directory if it does not exist if (mpi_rank == 0): if not os.path.exists(folderLoc): os.makedirs(folderLoc) # 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,L2,L3,mpi_rank,comm,turb_model) main = variables(turb_model,rotate,Om1,Om2,Om3,grid,u,v,w,uhat,vhat,what,t,dt,nu,myFFT,mpi_rank,initDomain,time_scheme) utilities = utilitiesClass() #==================================================================== # Make Solution Directory if it does not exist solloc = folderLoc + '/rank_' + str(mpi_rank) if not os.path.exists(solloc): os.makedirs(solloc) # 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 if (mpi_rank == 0): string = folderLoc + '/runinfo' np.savez(string,turb_model=turb_model,dt=dt,save_freq=save_freq,nu=nu,N1=N1,N2=N2,N3=N3,num_processes=num_processes,et=et)