【原始碼】從Ansys匯入mesh到MATLAB的小程式
如果在Ansys Workbench中生成了有限元網格,並希望將其匯入到Matlab中,請執行以下操作:
If you have a finite element mesh generated in Ansys Workbench and want to import it into Matlab, do the following:
-
in Ansys workbench: Create an “input file” (in the model, select “solution” in the tree, click “tools”->Write input file)
-
in Matlab: pass the file name of the input file to the function ‘importMesh_ansys2D’.
函式從.dat檔案中讀取頂點座標和連通性,並將它們儲存到Matlab陣列中。有關示例,請參見檔案“test_importMesh”。
The function reads the vertex coordinates and connectivity from the .dat file and stores them into Matlab arrays. For an example, see the file ‘test_importMesh’.
注意:
-僅適用於2D作品。但是,通過在連線中選擇相應的列,對3D的擴充套件應該很簡單。
-忽略附加節點(在二次形狀函式的情況下)。
-對於三角形元素,連通性表重複第三個頂點。此格式採用Ansys。
Notes:
-
Works for 2D only. However, the extension to 3D should be straightforward by selecting the corresponding columns in the connectivity.
-
The additional nodes (in case of quadratic shape functions) are ignored.
-
For triangular elements, the connectivity table repeats the third vertex. This format is adopted from Ansys.
更多精彩文章請關注公眾號: