我使用 PyVista 创建了两个圆柱网格,目的是使用 PyAnsys 在内圆柱(以蓝色显示)和外圆柱(以灰色显示)上执行模态分析。这些圆柱体中的每一个都具有不同的材料特性并构成单个模型的一部分:
网格生成脚本:
import numpy as np
import pyvista as pv
def create_mesh(inner_radius, thickness, height, z_res, c_res, r_res_pipe, r_res_fluid):
# Create a pipe mesh using a structured grid using the specified mesh density:
outer_radius = inner_radius + thickness
# Create a list of radial divisions between the inner and outer radii:
if r_res_pipe % 2 != 0:
r_res_pipe = r_res_pipe + 1 # radial resolution must be even to accommodate array reshaping
radial_divisions = np.linspace(inner_radius, outer_radius, r_res_pipe)
grid = pv.CylinderStructured(
radius=radial_divisions, height=height, theta_resolution=c_res, z_resolution=z_res
)
grid.points = grid.points
original_mesh = pv.UnstructuredGrid(grid)
pipe_mesh = original_mesh
points = pipe_mesh.points.reshape(z_res, c_res, r_res_pipe * 3)
points[:, c_res - 1, :] = points[:, 0, :]
pipe_mesh.points = points.reshape(z_res * (c_res) * 2, int(r_res_pipe + r_res_pipe / 2))
pipe_mesh.plot(color='grey', show_edges=True)
# Create a fluid mesh using a structured grid based on the pipe dimensions:
# Create a list of radial divisions between the inner and outer radii:
if r_res_fluid % 2 != 0:
r_res_fluid = r_res_fluid + 1 # radial resolution must be even to accommodate array reshaping
radial_divisions = np.linspace(0.0, inner_radius, r_res_fluid)
grid = pv.CylinderStructured(
radius=radial_divisions, height=height, theta_resolution=c_res, z_resolution=z_res
)
grid.points = grid.points
original_mesh = pv.UnstructuredGrid(grid)
fluid_mesh = original_mesh
points = fluid_mesh.points.reshape(z_res, c_res, r_res_fluid * 3)
points[:, c_res - 1, :] = points[:, 0, :]
fluid_mesh.points = points.reshape(z_res * (c_res) * 2, int(r_res_fluid + r_res_fluid / 2))
fluid_mesh.plot(color='blue', show_edges=True)
return pipe_mesh, fluid_mesh
为此,我需要在灰色和蓝色网格之间共享拓扑。是否有可以处理此问题的 MAPDL 命令?
我查看了文档,但找不到任何可以做到这一点的东西(但是,我对库的理解不是很好,我可能会遗漏一些东西)。