====================================================== PyMAPDL Reader - Legacy Binary and Archive File Reader ====================================================== 这是一个传统模块,用于读取由 MAPDL 生成的二进制和 ASCII 文件。 通过该 Python 模块,您可以直接从 ANSYS v14.5+ 二进制文件中提取数据,并使用直接的 API 和基于 ANSYS 提供的头文件的 C 库快速显示或制作动画。 ``ansys-mapdl-reader`` 模块支持以下格式: - ``*.rst`` - Structural analysis result file 结构分析结果文件 - ``*.rth`` - Thermal analysis result file 热分析结果文件 - ``*.emat`` - Element matrix data file 单元矩阵数据文件 - ``*.full`` - Full stiffness-mass matrix file 全刚度-质量矩阵文件 - ``*.cdb`` or ``*.dat`` - MAPDL ASCII block archive and Mechanical Workbench input files MAPDL ASCII 块存档和 Mechanical Workbench 输入文件 请参阅 `PyMAPDL-Reader 文档 `_ 获取完整文档。 .. note:: 该模块将来可能会被舍弃。 我们鼓励您在 `PyDPF-Core `_ 和 `PyDPF-Post `_ 中使用 新的数据处理框架 (DPF) 模块,因为它们提供了使用客户端/服务器界面访问 Ansys 结果文件的现代界面,该界面使用在 Ansys Mechanical 中使用的相同软件,但通过 Python 客户端。 Brief Demo: Direct Access to Binary Files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 下面是一个快速示例代码块,展示如何使用 ``ansys-mapdl-reader`` 从 ANSYS 结果文件直接加载结果并绘制结果图: .. code:: python >>> from ansys.mapdl import reader as pymapdl_reader >>> result = pymapdl_reader.read_binary('rotor.rst') >>> nnum, stress = result.principal_nodal_stress(0) >>> print(stress[:3]) array([[-1.2874937e-06, 1.2874934e-06, 5.6843419e-14, 0.0000000e+00, 8.1756007e-06, -8.1756007e-06], [-1.1674185e-04, -1.1674478e-04, -3.0856981e-04, -1.7892545e-06, -2.5823609e-05, 2.5835518e-05], [-5.7354209e-05, -5.5398770e-05, -1.4944717e-04, -1.0580692e-06, -1.7659733e-05, -3.5462126e-06]], dtype=float32) 第一个结果的单元应力 >>> estress, elem, enode = result.element_stress(0) >>> estress[0] array([[ 1.0236604e+04, -9.2875127e+03, -4.0922625e+04, -2.3697146e+03, -1.9239732e+04, 3.0364934e+03] [ 5.9612605e+04, 2.6905924e+01, -3.6161423e+03, 6.6281304e+03, 3.1407712e+02, 2.3195926e+04] [ 3.8178301e+04, 1.7534495e+03, -2.5156013e+02, -6.4841372e+03, -5.0892783e+03, 5.2503605e+00] [ 4.9787645e+04, 8.7987168e+03, -2.1928742e+04, -7.3025332e+03, 1.1294199e+04, 4.3000205e+03]]) 获取第一个单元对应的 ansys 单元编号。 >>> elem[0] 32423 获取第一个单元所属的节点。 >>> enode[0] array([ 9012, 7614, 9009, 10920], dtype=int32) 绘制第一个结果的节点位移图。 >>> result.plot_nodal_displacement(0) .. figure:: ./images/rotor.jpg :width: 500pt .. toctree:: :maxdepth: 1 :hidden: getting_started user_guide/index api/index examples/index contributing License and Acknowledgments --------------------------- ``ansys-mapdl-reader`` 模块采用 MIT 许可证授权。