Changeset 676 for codes/icosagcm/devel
- Timestamp:
- 01/31/18 18:48:48 (6 years ago)
- Location:
- codes/icosagcm/devel/Python/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/Python/test/py/NH_3D_DCMIP31.py
r673 r676 94 94 print 'llm, nb_hex, dx, dz =', llm, mesh.Ai.size, dx, dz 95 95 96 caldyn_thermo, caldyn_eta = unst.thermo_entropy, unst.eta_lag 97 caldyn = unst.Caldyn_NH(caldyn_thermo,caldyn_eta, mesh,thermo,params,params.g) 96 #dt = courant*.5/np.sqrt(gas0.c2.max()*(dx**-2+dz**-2)) 97 dt = courant*.5*dx/np.sqrt(gas0.c2.max()) 98 99 nt = int(math.ceil(T/dt)) 100 dt = T/nt 101 print 'Time step : %g s' % dt 98 102 99 103 mesh.plot_e(mesh.le/mesh.de) ; plt.title('le/de') … … 103 107 plt.savefig('fig_NH_3D_DCMIP31/Ai.png'); plt.close() 104 108 105 #dt = courant*.5/np.sqrt(gas0.c2.max()*(dx**-2+dz**-2)) 106 dt = courant*.5*dx/np.sqrt(gas0.c2.max()) 109 caldyn_thermo, caldyn_eta = unst.thermo_entropy, unst.eta_lag 107 110 108 nt = int(math.ceil(T/dt)) 109 dt = T/nt 110 print 'Time step : %g s' % dt 111 112 #scheme = time_step.RK4(caldyn.bwd_fast_slow, dt) 113 scheme = time_step.ARK2(caldyn.bwd_fast_slow, dt, a32=0.7) 114 115 flow=flow0 116 w=mesh.field_mass() 117 z=mesh.field_mass() 111 if False: # time stepping in Python 112 caldyn = unst.Caldyn_NH(caldyn_thermo,caldyn_eta, mesh,thermo,params,params.g) 113 scheme = time_step.ARK2(caldyn.bwd_fast_slow, dt, a32=0.7) 114 def next_flow(m,S,u,Phi,W): return scheme.advance((m,S,u,Phi,W),nt) 115 else: # time stepping in Fortran 116 scheme = time_step.ARK2(None, dt, a32=0.7) 117 caldyn_step = unst.caldyn_step_NH(mesh,scheme,nt, caldyn_thermo,caldyn_eta, thermo,params,params.g) 118 def next_flow(m,S,u,Phi,W): 119 caldyn_step.mass[:,:], caldyn_step.theta_rhodz[:,:], caldyn_step.u[:,:] = m,S,u 120 caldyn_step.geopot[:,:], caldyn_step.W[:,:] = Phi,W 121 caldyn_step.next() 122 return (caldyn_step.mass.copy(), caldyn_step.theta_rhodz.copy(), caldyn_step.u.copy(), 123 caldyn_step.geopot.copy(), caldyn_step.W.copy()) 118 124 119 125 def plots(it): 120 junk,fast,slow = caldyn.bwd_fast_slow(flow, 0.)121 m,S,u,Phi,W = flow122 126 s=S/m ; s=.5*(s+abs(s)) 123 127 for l in range(llm): … … 133 137 plt.close() 134 138 139 w=mesh.field_mass() 140 z=mesh.field_mass() 141 m,S,u,Phi,W=flow0 135 142 plots(0) 136 143 137 144 for it in range(Nslice): 138 # unst.setvar('debug_hevi_solver',True)145 unst.setvar('debug_hevi_solver',False) 139 146 time1, elapsed1 =time.time(), unst.getvar('elapsed') 140 flow = scheme.advance(flow,nt)147 m,S,u,Phi,W = next_flow(m,S,u,Phi,W) 141 148 time2, elapsed2 =time.time(), unst.getvar('elapsed') 142 factor = 1000./ (3*nt)143 print 'ms per call to caldyn_hevi: ', factor*(time2-time1), factor*(elapsed2-elapsed1)149 factor = 1000./nt 150 print 'ms per full time step : ', factor*(time2-time1), factor*(elapsed2-elapsed1) 144 151 factor = 1e9/(4*nt*w.size) 145 152 print 'nanosec per gridpoint per call to caldyn_hevi : ', factor*(time2-time1), factor*(elapsed2-elapsed1) 146 153 plots(it+1) 147 -
codes/icosagcm/devel/Python/test/python.sh
r661 r676 6 6 . $DYNAMICO_ROOT/Python//env/$CURRENT_ARCH.env 7 7 8 export OMP_STACKSIZE=128M 9 8 10 LD_PRELOAD=$PYTHON_PRELOAD python -u $*
Note: See TracChangeset
for help on using the changeset viewer.