Changeset 672 for codes/icosagcm/devel
- Timestamp:
- 01/30/18 17:58:02 (6 years ago)
- Location:
- codes/icosagcm/devel/Python
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/Python/dynamico/meshes.py
r642 r672 5 5 import matplotlib.tri as tri 6 6 import matplotlib.pyplot as plt 7 from unstructured import init_mesh 7 from unstructured import init_mesh, list_stencil 8 8 9 9 radian=180/math.pi -
codes/icosagcm/devel/Python/test/py/RSW_MPAS_W02.py
r632 r672 1 print 'Loading DYNAMICO modules ...' 2 from dynamico import unstructured as unst 3 from dynamico.meshes import MPAS_Mesh as Mesh 4 from dynamico import time_step 5 print '...Done' 6 1 7 print 'Loading modules ...' 2 8 import math as math 3 9 import matplotlib.pyplot as plt 4 10 import numpy as np 5 print '...Done'6 7 print 'Loading DYNAMICO modules ...'8 from dynamico import unstructured as unst9 from dynamico.meshes import MPAS_Mesh as Mesh10 from dynamico import time_step11 11 print '...Done' 12 12 -
codes/icosagcm/devel/Python/test/py/partition.py
r620 r672 6 6 print '%d/%d starting'%(mpi_rank,mpi_size) 7 7 8 import sys 8 #from dynamico import partition 9 from dynamico import parallel, meshes 10 from dynamico import unstructured as unst 11 9 12 import math as math 10 13 import numpy as np … … 15 18 from matplotlib.collections import PatchCollection 16 19 17 #from dynamico import partition18 from dynamico import parallel19 from dynamico import unstructured as unst20 from dynamico.unstructured import list_stencil, reindex21 22 20 print 'Done loading modules' 23 24 sys.stdout.flush()25 21 26 22 #----------------- partition hand-written 15-cell mesh ------------------# … … 90 86 mydegree, mybounds = [get_mycells(x) for x in nEdgesOnCell, verticesOnCell] 91 87 print '%d : len(mydegree)=%d'%(mpi_rank, len(mydegree)) 92 vertex_list = sorted(set( list_stencil(mydegree,mybounds)))88 vertex_list = sorted(set(unst.list_stencil(mydegree,mybounds))) 93 89 print '%d : len(vertex_list))=%d'%(mpi_rank, len(vertex_list)) 94 90 get_myvertices = parallel.Get_Indices(dim_vertex, vertex_list) 95 91 mylon, mylat = [get_myvertices(x)*180./math.pi for x in lonVertex, latVertex] 96 92 vertex_dict = parallel.inverse_list(vertex_list) 97 reindex(vertex_dict, mydegree, mybounds)93 meshes.reindex(vertex_dict, mydegree, mybounds) 98 94 return vertex_list, mydegree, mybounds, mylon, mylat 99 95 … … 104 100 #grid = 'x4.163842' 105 101 print 'Reading MPAS file %s ...'%grid 106 sys.stdout.flush()107 102 108 103 nc = cdf.Dataset('grids/%s.grid.nc'%grid, "r") … … 127 122 cellsOnEdge, edgesOnEdge, verticesOnEdge) : x.data = x.data-1 128 123 edge2cell, cell2edge, edge2vertex, vertex2edge, cell2cell, edge2edge = [ 129 unst.Stencil_glob(a,b) for a,b in124 meshes.Stencil_glob(a,b) for a,b in 130 125 (edge_degree, cellsOnEdge), (nEdgesOnCell, edgesOnCell), 131 126 (edge_degree, verticesOnEdge), (vertex_degree, edgesOnVertex), … … 135 130 136 131 print 'Partitioning ...' 137 sys.stdout.flush()138 132 139 133 edge_owner = unst.partition_mesh(nEdgesOnEdge, edgesOnEdge, mpi_size) 140 134 edge_owner = parallel.LocPArray1D(dim_edge, edge_owner) 141 cell_owner = unst.partition_from_stencil(edge_owner, nEdgesOnCell, edgesOnCell)135 cell_owner = meshes.partition_from_stencil(edge_owner, nEdgesOnCell, edgesOnCell) 142 136 cell_owner = parallel.LocPArray1D(dim_cell, cell_owner) 143 137 … … 145 139 146 140 print 'Constructing halos ...' 147 sys.stdout.flush()148 141 149 142 def chain(start, links): … … 152 145 yield start 153 146 154 edges_E0 = unst.find_my_cells(edge_owner)147 edges_E0 = meshes.find_my_cells(edge_owner) 155 148 cells_C0, edges_E1, vertices_V1, edges_E2, cells_C1 = chain( 156 149 edges_E0, ( edge2cell, cell2edge, edge2vertex, vertex2edge, edge2cell) ) 157 150 158 edges_E0, edges_E1, edges_E2 = unst.progressive_list(edges_E0, edges_E1, edges_E2)159 cells_C0, cells_C1 = unst.progressive_list(cells_C0, cells_C1)151 edges_E0, edges_E1, edges_E2 = meshes.progressive_list(edges_E0, edges_E1, edges_E2) 152 cells_C0, cells_C1 = meshes.progressive_list(cells_C0, cells_C1) 160 153 161 154 print 'E2,E1,E0 ; C1,C0 : ', map(len, (edges_E2, edges_E1, edges_E0, cells_C1, cells_C0)) 162 sys.stdout.flush()163 155 164 156 #com_edges = parallel.Halo_Xchange(24, dim_edge, edges_E2, dim_edge.get(edges_E2, edge_owner)) … … 172 164 comm.Reduce(local_num, total_num, op=MPI.SUM, root=0) 173 165 if(mpi_rank==0): print 'total num :', total_num[0], dim_cell.n 174 sys.stdout.flush()175 166 176 167 #---------------------------- plot -----------------------------# … … 178 169 if True: 179 170 print 'Plotting ...' 180 sys.stdout.flush()181 171 182 172 halo_vertex_list, mydegree, mybounds, mylon, mylat = local_mesh(com_cells.get_all)
Note: See TracChangeset
for help on using the changeset viewer.