Changeset 642 for codes/icosagcm/devel/Python/test/py/slice_GW_hydro.py
- Timestamp:
- 12/19/17 15:26:51 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/Python/test/py/slice_GW_hydro.py
r631 r642 15 15 caldyn_thermo = unst.thermo_entropy 16 16 g = mesh.dx/metric.dx_g0 17 caldyn = unst.Caldyn_HPE(caldyn_thermo,caldyn_eta, mesh,metric,thermo,BC,g)18 17 19 18 Sik = m0ik*gas0.s … … 25 24 S0ik = m0ik*gas0.s 26 25 27 u0=mesh.field_u() 26 u0=mesh.field_u() 28 27 u0[:,range(0,2*nx,2),:] = 100.*mesh.dx # Doppler shift 100 m/s 29 28 flow0=(m0ik,S0ik,u0) … … 35 34 dt=T/nt 36 35 print 'nt,dt,dx', nt,dt,dx 37 scheme = time_step.ARK2(caldyn.bwd_fast_slow, dt, a32=0.7)38 #scheme = time_step.ARK3(caldyn.bwd_fast_slow, dt)39 36 40 flow=flow0 37 m,S,u=flow0 38 39 if False: # time stepping in Python 40 caldyn = unst.Caldyn_HPE(caldyn_thermo,caldyn_eta, mesh,thermo,BC,g) 41 scheme = time_step.ARK2(caldyn.bwd_fast_slow, dt, a32=0.7) 42 #scheme = time_step.ARK3(caldyn.bwd_fast_slow, dt) 43 def next_flow(m,S,u): 44 m,S,u = scheme.advance((m,S,u),nt) 45 return m,S,u,caldyn.geopot 46 else: # time stepping in Fortran 47 scheme = time_step.ARK2(None, dt, a32=0.7) 48 caldyn_step = unst.caldyn_step_HPE(mesh,scheme,nt, caldyn_thermo,caldyn_eta,thermo,BC,g) 49 def next_flow(m,S,u): 50 caldyn_step.mass[:,:], caldyn_step.theta_rhodz[:,:], caldyn_step.u[:,:] = m,S,u 51 caldyn_step.next() 52 return caldyn_step.mass, caldyn_step.theta_rhodz, caldyn_step.u, caldyn_step.geopot 53 41 54 for i in range(10): 42 55 time1=time.time() 43 flow = scheme.advance(flow,nt)56 m,S,u,geopot = next_flow(m,S,u) 44 57 time2=time.time() 45 m,S,u = flow 46 print 'ms per time step : ', 1000*(time2-time1)/nt 47 print 'ptop, model top (m) :', unst.getvar('ptop'), caldyn.geopot.max()/unst.getvar('g') 48 junk,fast,slow = caldyn.bwd_fast_slow(flow, 0.) 49 zz=caldyn.geopot[:,0:llm]/metric.g0/1000 58 print 'ms per time step : ', 1000*(time2-time1)/nt, 1000*unst.getvar('elapsed')/(nt*(i+1)) 59 print 'ptop, model top (m) :', unst.getvar('ptop'), geopot.max()/unst.getvar('g') 60 # junk,fast,slow = caldyn.bwd_fast_slow(flow, 0.) 61 zz=geopot[:,0:llm]/metric.g0/1000 50 62 plt.figure(figsize=(12,3)) 51 63 ucomp = mesh.ucomp(u)
Note: See TracChangeset
for help on using the changeset viewer.