# we do not need to consider the z-dimension). # ncx = 10 # number of core mesh cells in x ncy = 15 # number of core mesh cells in y dx = 15 # base cell width x dy = 10 # base cell width y hx = dx * np.ones(ncx) hy = dy * np.ones(ncy) x0 = 0 y0 = -150 mesh = TensorMesh([hx, hy], x0=[x0, y0]) mesh.plotGrid() ############################################### # Padding Cells and Plotting # -------------------------- # # For practical purposes, the user may want to define a region where the cell # widths are increasing/decreasing in size. For example, padding is often used # to define a large domain while reducing the total number of mesh cells. # Here we demonstrate how to create tensor meshes that have padding cells. # ncx = 10 # number of core mesh cells in x ncy = 15 # number of core mesh cells in y dx = 15 # base cell width x
# Although the divergence cannot be constructed through Kronecker product # operations, the initial steps are exactly the same for calculating the # stencil, volumes, and areas. This yields a divergence defined for every # cell in the mesh using all faces. There is, however, redundant information # when hanging faces are included. # mesh = TreeMesh([[(1, 16)], [(1, 16)]], levels=4) mesh.insert_cells(np.array([5.0, 5.0]), np.array([3])) mesh.number() fig = plt.figure(figsize=(10, 10)) ax1 = fig.add_subplot(211) mesh.plotGrid(centers=True, nodes=False, ax=ax1) ax1.axis("off") ax1.set_title("Simple QuadTree Mesh") ax1.set_xlim([-1, 17]) ax1.set_ylim([-1, 17]) for ii, loc in zip(range(mesh.nC), mesh.gridCC): ax1.text(loc[0] + 0.2, loc[1], "{0:d}".format(ii), color="r") ax1.plot(mesh.gridFx[:, 0], mesh.gridFx[:, 1], "g>") for ii, loc in zip(range(mesh.nFx), mesh.gridFx): ax1.text(loc[0] + 0.2, loc[1], "{0:d}".format(ii), color="g") ax1.plot(mesh.gridFy[:, 0], mesh.gridFy[:, 1], "m^") for ii, loc in zip(range(mesh.nFy), mesh.gridFy): ax1.text(loc[0] + 0.2,