Ignore:
Timestamp:
02/14/18 00:06:52 (6 years ago)
Author:
dubos
Message:

devel/unstructured : local mesh setup + halo exchange

File:
1 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/devel/Python/test/py/RSW2_MPAS_W02.py

    r680 r681  
     1print 'Starting' 
     2 
     3from mpi4py import MPI 
     4comm = MPI.COMM_WORLD 
     5mpi_rank, mpi_size = comm.Get_rank(), comm.Get_size() 
     6print '%d/%d starting'%(mpi_rank,mpi_size) 
     7prefix='fig_RSW2_MPAS_W02/%02d'%mpi_rank 
     8 
    19print 'Loading DYNAMICO modules ...' 
    210from dynamico import unstructured as unst 
    3 from dynamico.meshes import MPAS_Format, Unstructured_Mesh as Mesh 
     11from dynamico.meshes import MPAS_Format, Unstructured_PMesh as PMesh, Local_Mesh as Mesh 
    412from dynamico import time_step 
    513print '...Done' 
     
    1119print '...Done' 
    1220 
    13 grid, llm, nqdyn = 10242, 1,1 # 2562, 10242, 40962 
     21grid, llm, nqdyn = 2562, 1,1 # 2562, 10242, 40962 
    1422Omega, radius, g, gh0 = 2.*np.pi/86400., 6.4e6, 1., 2.94e4 
    15 N, T, courant = 40, 10800., 1.2 # simulation length = N*T 
     23N, T, courant = 40, 10400., 1.2 # simulation length = N*T 
    1624 
    1725print 'Omega, planetary PV', Omega, 2*Omega/gh0 
     
    2028print 'Reading MPAS mesh ...' 
    2129meshfile = MPAS_Format('grids/x1.%d.grid.nc'%grid) 
    22 mesh = Mesh(meshfile, llm, nqdyn, radius, f) 
     30pmesh = PMesh(comm,meshfile) 
     31mesh = Mesh(pmesh, llm, nqdyn, radius, f) 
    2332print '...Done' 
    2433lon, lat = mesh.lon_i, mesh.lat_i 
     
    3039dx = mesh.de.min() 
    3140dt = courant*dx/c0 
     41print dx, dt 
    3242nt = int(math.ceil(T/dt)) 
    3343dt = T/nt 
     
    6171flow=gh,u 
    6272 
     73unst.ker.dynamico_update_halo(mesh.com_edges.index, 1, u.shape[0], u)  
     74                                   
    6375for i in range(20): 
    6476    if True: 
     
    6779        print i, gh.shape, gh.min(), gh.max(), u.min(), u.max() 
    6880        mesh.plot_i(gh-Phi0) ; plt.title('err(gh)'); 
    69         plt.savefig('fig_RSW2_MPAS_W02/err_gh_%02d.png'%i) 
     81        plt.savefig('%s_err_gh_%02d.png'%(prefix,i)) 
    7082        plt.close() 
    7183    else: 
     
    100112        ax8.scatter(u_nowref,u_now-u_nowref) ; ax8.set_title('u_now'); 
    101113        f.subplots_adjust(hspace=1.) 
    102         plt.savefig('fig_RSW2_MPAS_W02/scatter_%02d.png'%i) 
     114        plt.savefig('%s_scatter_%02d.png'%(prefix,i)) 
    103115        plt.close() 
    104116 
Note: See TracChangeset for help on using the changeset viewer.