Changeset 676 for codes/icosagcm


Ignore:
Timestamp:
01/31/18 18:48:48 (6 years ago)
Author:
dubos
Message:

devel/unstructured : update DCMIP 3.1 test case

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  
    9494print 'llm, nb_hex, dx, dz =', llm, mesh.Ai.size, dx, dz 
    9595 
    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)) 
     97dt = courant*.5*dx/np.sqrt(gas0.c2.max()) 
     98 
     99nt = int(math.ceil(T/dt)) 
     100dt = T/nt 
     101print 'Time step : %g s' % dt 
    98102 
    99103mesh.plot_e(mesh.le/mesh.de) ; plt.title('le/de') 
     
    103107plt.savefig('fig_NH_3D_DCMIP31/Ai.png'); plt.close() 
    104108 
    105 #dt = courant*.5/np.sqrt(gas0.c2.max()*(dx**-2+dz**-2)) 
    106 dt = courant*.5*dx/np.sqrt(gas0.c2.max()) 
     109caldyn_thermo, caldyn_eta = unst.thermo_entropy, unst.eta_lag 
    107110 
    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() 
     111if 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) 
     115else: # 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()) 
    118124 
    119125def plots(it): 
    120     junk,fast,slow = caldyn.bwd_fast_slow(flow, 0.) 
    121     m,S,u,Phi,W = flow 
    122126    s=S/m ; s=.5*(s+abs(s)) 
    123127    for l in range(llm): 
     
    133137    plt.close() 
    134138 
     139w=mesh.field_mass() 
     140z=mesh.field_mass() 
     141m,S,u,Phi,W=flow0  
    135142plots(0) 
    136143 
    137144for it in range(Nslice): 
    138     #    unst.setvar('debug_hevi_solver',True) 
     145    unst.setvar('debug_hevi_solver',False) 
    139146    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) 
    141148    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) 
    144151    factor = 1e9/(4*nt*w.size) 
    145152    print 'nanosec per gridpoint per call to caldyn_hevi : ', factor*(time2-time1), factor*(elapsed2-elapsed1) 
    146153    plots(it+1) 
    147      
  • codes/icosagcm/devel/Python/test/python.sh

    r661 r676  
    66. $DYNAMICO_ROOT/Python//env/$CURRENT_ARCH.env 
    77 
     8export OMP_STACKSIZE=128M 
     9 
    810LD_PRELOAD=$PYTHON_PRELOAD python -u $* 
Note: See TracChangeset for help on using the changeset viewer.