This function reads the mesh data for all structural elements listed below, but includes corner nodes only (i.e. disregards any midside nodes). Both displacement- and stress results are imported. All data is returned in the "model" struct as explained below. The function is intended for further postprocessing FE results in Matlab.
Before using the function, the ANSYS model must be exported to a text file. Use the supplied "export.mac" to do this. In Workbench, add a "Commands (APDL)" block under "Solution" and paste in the macro contents. In Classic, run macro by clicking "File>Read input from..." and selecting the "export.mac" file. This will create the file "model.txt" located in the ANSYS working folder:
where "ANSYS_WORK_DIR" and "JOBNAME" are names chosen by yourself.
Supported element types:
- SOLID187 (3D tetrahedral solid)
- SOLID186 (3D hexahedral solid)
- PLANE42, PLANE82, PLANE182, PLANE183 (2D 4/8-node quad/triangle)
- SHELL181, SHELL281, SHELL63 (3D 4/8-node shell)
INPUTS: path\filename of the ANSYS export file "model.txt" (string).
model.filename = path + filename of the model file
model.raw = raw tables from ANSYS
.etlist = element type list: [type_no, ansys_name, internal_type]
.nlist = node list: [node_no, x, y, z]
.elist = element list: [elem_no, type_no, mat_no, node1, ..., node8, com_x, com_y, com_z]
.flist = face list: [node1, node2, node3, node4, elem_no, centr_x, centr_y, centr_z]
.stress = stress results: [node_no, Sx, Sy, Sz, Sxy, Syz, Sxz]
.disp = displacement results: [node_no, Ux, Uy, Uz, Usum]
model.surf = same as above, but containing surface nodes/elements only
.nlist = same as above, but containing surface nodes/elements only
.elist = same as above, but containing surface nodes/elements only
.flist = same as above, but containing surface nodes/elements only
.stress = same as above, but containing surface nodes/elements only
.disp = same as above, but containing surface nodes/elements only
model.surf.mapping = maps between names and indices for nodes, elements and faces
.node2ni = node_no (externally referenced number) -> node index in nlist
.elem2ei = elem_no -> element index in elist
.face2elem = face index -> element name
.ni2face = node index -> face index
.ni2ei = node index -> element index
There are two sub-structs in output model: "raw" and "surf". The first contains the raw reading of data from the ANSYS export (ETLIST, NLIST, ELIST, PRNSOL,S and PRNSOL,U). The second contains the same, but for a reduced surface model, which is "scooped-out" such that only the surface nodes/faces of the elements are included. This is expedient to reduce the computational load of plotting solid models (i.e. not plotting the internal nodes/elements)
1) Planar model: mesh with node numbers and stress contours with deformed shape.
2) Solid model: showing a reduced (surface only) model.
3) Shell model: showing a 3D shell structure in deformed configuration.
Mikkel Pedersen (2021). ANSYSimport (https://www.mathworks.com/matlabcentral/fileexchange/66659-ansysimport), MATLAB Central File Exchange. Retrieved .
Thank you very much for your help!
It seems you are trying to export the results of a modal analysis. The script was not intended for this, but rather for static structural analyses. Anyways, I think it may be fixed - your solve.out specifies the error and solution in line 553-555:
*** ERROR *** CP = 1.156 TIME= 21:54:08
The substep (MODE) number must be specified on the SET command for
buckling (ANTYPE=1) or modal (ANTYPE=2) analysis.
Try adapting the export script as ANSYS proposes: Use SET, loadstep, substep (where you set substep = mode number). The substep number is generally not included, because it is not necessary for a static structural analysis. As it is, the script will only work with a single result set, not multiple, as in the case of a modal analysis, so you've got to select just one. Good luck.
Yes, i'm looking for it in the right folder.
Here is my solve.out file: https://drive.google.com/file/d/1Y23yIDIzEVHq0jJTKU8g1hqGsUzr_Dwm/view?usp=sharing
It should. Are you sure you're looking in the right folder as specified above? Otherwise, ANSYS should return an error in the solve.out file, hinting at what went wrong.
The macro doesn't create the model.txt file for me.
You can make a loop in ADPL using the *DO - *ENDDO commands around the exporting commands. There is an example in the included macro, line 44. Within the loop, you can select the active load step with the stresses you want to export using the SET command. Good luck.
I would like to use your script to post process a Harmonic response simulation. And I was wondering how the APDL command has to be modified to obtain the results from every interval solution (every Frequency step). Now the PRNSOL, S and PRNSOL, U only give me the results at the final frequency step of the harmonic response. I'm not familiar with the APDL commands, do you know how to create a loop over all simulated frequency intervals in the harmonic response.
Thnx in advance
Great Job. Thank you!
Hi Mikkel, very nice tool! Do you have any plans for this function to support remote points also (174/170 elements)? Thanks!
Hi, for a 3D printing study I need to figure out how to pull just the shell data for n-layers. Can anyone help? I have limited to no FEA experience and am fumbling in the dark with ANSYS Academic, but, what I need is for every layer of a part, all the perimeter nodes (including features for holes etc preferably) XY coordinates and magnitude data for those points eg. for +/- stress. What sub functions do I need to call and how? I don't understand the difference between an element and a node... thanks
Thank you T_K_86. Each of the appended examples show how to plot both stresses and deformation. It uses the function 'patch' in Matlab. Try following one of those.
Great Job Mikkel!
I was able to use your function, but how can I plot the mesh or the stresses or deformation?
Thanks a lot for your help!
I guess you can "disguise" the thermal results as stresses and use the script as it is. However, the script reads the export in a fixed-width format, so your thermal results must be written in the exact same format as the stresses. You can modify the exporting ANSYS macro - the line which currently says PRNSOL,S exports the stresses. Use *VWRITE command instead to create your own user defined output.
Thank you very much for this contribution. Any feeling if this could to plot steady-state thermal results in Matlab, for example?
I followed the above given steps but my system is not generating the required .txt file. Please help if anybody could guide me where I am going wrong.
I think you can just add "190" (the ansys element no.) to the list in line 127. Then it will be imported like the other shell elements, however not with any of the special results for your particular element.
Thank you for the great work. Any tips on how to modify the script to include SOLSH190? Thank you.
I guess there is not really any problem in including midside nodes. However, there are no stress results for the midside nodes in ANSYS. The largest stresses are always in the corner nodes. Therefore, I didn't need them;-).
thanks for valuable work. whats the problem for including midside nodes?
Thanks Chris. The script currently handles a single load step only, but I'm sure you can make a loop in the ANSYS APDL export code snippet and another loop calling the import script in Matlab. Should be no problem.
Worked easily, didn't take much effort on my part. Any tips on how to modify to that it exports a time series of displacements when doing a transient analysis?
At the moment, the script cannot read the .rst. You need to use Ansys to export the results to a text file which can then be read by the script. Eventuelly, it would be nice to extract stuff directly from the .rst, but it is much more tricky to read a binary file.
This is a good job ! And if the function can read the '.rst' file, it must be a more prefect job. Thank you so much.
Inspired by: Read ANSYS mesh
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!