12 mesh = Geom.UnstructuredMesh(mpi, 2)
13 meshReader = Geom.UnstructuredMeshSerialRW(mesh, 0)
14 name2ID = meshReader.ReadFromCGNSSerial(
16 os.path.dirname(__file__),
"..",
"..",
"data",
"mesh",
"NACA0012_H2.cgns"
19 print(name2ID.n2id_map)
20 meshReader.Deduplicate1to1Periodic(1e-9)
21 meshReader.BuildCell2Cell()
22 meshReader.MeshPartitionCell2Cell({
"metisUfactor": 5})
23 meshReader.PartitionReorderToMeshCell2Cell()
25 mesh.RecoverNode2CellAndNode2Bnd()
26 mesh.RecoverCell2CellAndBnd2Cell()
27 mesh.BuildGhostPrimary()
28 mesh.AdjGlobal2LocalPrimary()
29 mesh.InterpolateFace()
32 fig, ax = plt.subplots(figsize=(16, 16), dpi=320)
33 xymaxs = np.array([-1e100, -1e100], dtype=np.double)
34 xymins = np.array([1e100, 1e100], dtype=np.double)
35 for iCell
in range(mesh.cell2node.Size()):
36 c2n = mesh.cell2node[iCell].tolist()
41 nodes.append(np.array(mesh.coords[iNode]))
42 nodes = np.array(nodes)
44 vertices = nodes[:, 0:2]
45 xymaxs = np.maximum(vertices.max(axis=0), xymaxs)
46 xymins = np.minimum(vertices.min(axis=0), xymins)
48 polygon = patches.Polygon(
52 facecolor=
"blue" if iCell < mesh.cell2node.father.Size()
else "red",
58 ax.set_aspect(
"equal")
59 ax.set_xlim(xymins[0], xymaxs[0])
60 ax.set_ylim(xymins[1], xymaxs[1])
61 ax.set_title(f
"part_{mpi.rank}")
66 plt.savefig(f
"test_print_part_{mpi.rank}.png")