Changeset 656 for codes/icosagcm/devel
- Timestamp:
- 12/30/17 01:06:26 (6 years ago)
- Location:
- codes/icosagcm/devel/Python/test/py
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/Python/test/py/NH_3D_bubble.py
r646 r656 54 54 55 55 #Lx, nx, llm, thetac, T, Nslice, courant = 2000., 100, 50, 30., 5., 10, 2.8 56 Lx, nx, llm, thetac, T, Nslice, courant = 2000., 8, 80, 30, 5., 10, 2.856 Lx, nx, llm, thetac, T, Nslice, courant = 2000., 20, 79, 30, 5., 10, 2.8 57 57 #Lx, nx, llm, thetac, T, Nslice, courant = 3000., 75, 25, -30, 5., 10, 2.8 58 58 … … 72 72 print 'Time step : %d x %g s' % (nt,dt) 73 73 74 #caldyn_thermo, caldyn_eta = unst.thermo_theta, unst.eta_mass 74 75 caldyn_thermo, caldyn_eta = unst.thermo_entropy, unst.eta_mass 75 76 #caldyn_thermo, caldyn_eta = unst.thermo_entropy, unst.eta_lag … … 95 96 96 97 m,S,u,Phi,W=flow0 98 if caldyn_thermo == unst.thermo_theta: 99 s=S/m 100 theta = thermo.T0*np.exp(s/thermo.Cpd) 101 S=m*theta 102 title_format = 'Potential temperature at t=%g s (K)' 103 else: 104 title_format = 'Specific entropy at t=%g s (J/K/kg)' 105 97 106 w=mesh.field_mass() 98 107 z=mesh.field_mass() … … 114 123 ax1.set_ylim((0.,1.)), ax1.set_ylabel('z (km)') 115 124 plt.colorbar(c,ax=ax1) 116 ax1.set_title('Specific entropy at t=%g s (J/K/kg)' % (it*T,)) 125 ax1.set_title(title_format % (it*T,)) 126 117 127 # plt.show() 118 128 -
codes/icosagcm/devel/Python/test/py/slice_GW_NH.py
r646 r656 16 16 caldyn_thermo = unst.thermo_entropy 17 17 g = mesh.dx/metric.dx_g0 18 caldyn = unst.Caldyn_NH(caldyn_thermo,caldyn_eta, mesh,thermo,BC,g) 18 19 dt = courant*.5*dx/np.sqrt(gas0.c2.max()) 20 nt=int(T/dt)+1 21 dt=T/nt 22 print 'nt,dt,dx', nt,dt,dx 19 23 20 24 Sik = m0ik*gas0.s … … 30 34 flow0=(m0ik,S0ik,u0,Phi0_il,0*Phi0_il) 31 35 32 dt = courant*.5*dx/np.sqrt(gas0.c2.max()) 33 nt=int(T/dt)+1 34 dt=T/nt 35 print 'nt,dt,dx', nt,dt,dx 36 scheme = time_step.ARK2(caldyn.bwd_fast_slow, dt, a32=0.7) 37 #scheme = time_step.ARK3(caldyn.bwd_fast_slow, dt) 36 if False: # time stepping in Python 37 caldyn = unst.Caldyn_NH(caldyn_thermo,caldyn_eta, mesh,thermo,BC,g) 38 scheme = time_step.ARK2(caldyn.bwd_fast_slow, dt, a32=0.7) 39 #scheme = time_step.ARK3(caldyn.bwd_fast_slow, dt) 40 def next_flow(m,S,u,Phi,W): 41 m,S,u,Phi,W = scheme.advance((m,S,u,Phi,W),nt) 42 return m,S,u,Phi,W 43 else: # time stepping in Fortran 44 scheme = time_step.ARK2(None, dt, a32=0.7) 45 caldyn_step = unst.caldyn_step_NH(mesh,scheme,nt, 46 caldyn_thermo,caldyn_eta,thermo,BC,g) 47 def next_flow(m,S,u,Phi,W): 48 caldyn_step.mass[:,:], caldyn_step.theta_rhodz[:,:], caldyn_step.u[:,:] = m,S,u 49 caldyn_step.geopot[:,:], caldyn_step.W[:,:] = Phi,W 50 caldyn_step.next() 51 return (caldyn_step.mass.copy(), caldyn_step.theta_rhodz.copy(), caldyn_step.u.copy(), 52 caldyn_step.geopot.copy(), caldyn_step.W.copy()) 38 53 39 # nt=1 # FIXME 40 flow=flow0 54 m,S,u,Phi,W=flow0 55 41 56 for i in range(12): 42 57 time1=time.time() 43 flow = scheme.advance(flow,nt)58 m,S,u,Phi,W = next_flow(m,S,u,Phi,W) 44 59 time2=time.time() 45 60 print 'ms per time step : ', 1000*(time2-time1)/nt 46 61 47 m,S,u,Phi,W = flow48 62 w=.5*(W[:,0:llm]+W[:,1:llm+1])/m 49 junk,fast,slow = caldyn.bwd_fast_slow(flow, 0.)63 # junk,fast,slow = caldyn.bwd_fast_slow(flow, 0.) 50 64 # zz=caldyn.geopot[:,0:llm]/metric.g0/1000 51 65 zz=Phi[:,0:llm]/metric.g0/1000 … … 59 73 plt.colorbar() 60 74 61 plt.figure(figsize=(12,3))62 ucomp = mesh.ucomp(u)63 plt.pcolor(xx,zz,caldyn.pk)64 plt_axes()65 plt.title("T(t = %f s)" % ((i+1)*dt*nt))66 plt.savefig('fig_slice_GW_NH/T%02d.png'%i)67 plt.close()68 75 # plt.figure(figsize=(12,3)) 76 # ucomp = mesh.ucomp(u) 77 # plt.pcolor(xx,zz,caldyn.pk) 78 # plt_axes() 79 # plt.title("T(t = %f s)" % ((i+1)*dt*nt)) 80 # plt.savefig('fig_slice_GW_NH/T%02d.png'%i) 81 # plt.close() 82 # 69 83 plt.figure(figsize=(12,3)) 70 84 ucomp = mesh.ucomp(u) … … 91 105 92 106 #Lx, nx, llm = 3e5, 100, 1e4, 30 93 Lx, nx, ztop, llm = 2e5, 400, 3e4, 60107 Lx, nx, ztop, llm = 3e5, 300, 3e4, 80 94 108 nqdyn, ny, dx = 1, 1, Lx/nx 95 109 mesh = Mesh(nx,ny,llm,nqdyn,nx*dx,ny*dx,0.) -
codes/icosagcm/devel/Python/test/py/slice_GW_hydro.py
r646 r656 67 67 plt.close() 68 68 69 Lx, nx, llm = 3e5, 300, 2069 Lx, nx, llm = 3e5, 300, 80 70 70 nqdyn, ny, dx = 1, 1, Lx/nx 71 71 mesh = Mesh(nx,ny,llm,nqdyn,nx*dx,ny*dx,0.)
Note: See TracChangeset
for help on using the changeset viewer.