TAGGED: automation, force-reaction, forces, mechanical
-
-
April 2, 2025 at 4:13 pm
ivan.redrado
SubscriberHi, I am doing some structural analysis of a cantilever wing (as of now a simple structure), with imported pressure loads. The analysis can run well, that's not an issue at all. However, due to the nature of the task, I need to model the reaction forces and moments along the z-axis into a .csv or similar file (i.e. creating an array with Fx, Fy and Fz for each value of z, that can be plotted into 2D graphs such as in MatLab).
The "manual" way to do it would be creating several coordinate systems, generating a construction surface for each, and finally using the probe tool for the reactions at each surface. Then, the data for each would be extracted and can be plotted. See the figure below.
However, this is not practical if many tests have to be done, which is why I was wondering if there is any way to do get the values automatically by just setting up the problem and then clicking solve to get a .csv file in a specified directory. I have attempted with APDL and Python scripts (with the help of AI tools, as I am very unfamiliar with this), but have been unsuccessful. The closest i've gotten is, through the APDL code below, to retrieve the values for z=0 correctly (as contrasted to a probe), but the rest simply output small numbers with no sense (see image). I assume they correspond to the nodes, instead of computing a (interpolated?) sum for the plane.
Z_MIN = 0 Z_MAX = 3000 Z_STEP = 20 OUTPUT_FILE = 'C:\ANSYS_Results\Z_Reactions_2.csv' /POST1 SET,LAST *CFOPEN,OUTPUT_FILE,csv *VWRITE,'Z (mm)','FX (N)','FY (N)','FZ (N)','MX (Nmm)','MY (Nmm)','MZ (Nmm)' %13s,%13s,%13s,%13s,%13s,%13s,%13s *DO,Z_POS,Z_MIN,Z_MAX,Z_STEP NSEL, S, LOC, Z, Z_POS-0.5, Z_POS+0.5 ! Select nodes in a slice around the Z position ESEL, S, LOC, Z, Z_POS-0.5, Z_POS+0.5 ! Select elements in that slice FSUM ! Force summation *GET,FX,FSUM,,ITEM,FX *GET,FY,FSUM,,ITEM,FY *GET,FZ,FSUM,,ITEM,FZ *GET,MX,FSUM,,ITEM,MX *GET,MY,FSUM,,ITEM,MY *GET,MZ,FSUM,,ITEM,MZ *VWRITE,Z_POS,FX,FY,FZ,MX,MY,MZ %13.6f,%13.6f,%13.6f,%13.6f,%13.6f,%13.6f,%13.6f ALLSEL *ENDDO *CFCLOS ! Close output file CSYS,0 ! Return to global CS *STATUS ! Show parameter status ALLSEL FSUM *GET,TOTFX,FSUM,,ITEM,FX *GET,TOTFY,FSUM,,ITEM,FY *GET,TOTFZ,FSUM,,ITEM,FZ *MSG,UI,TOTFX,TOTFY,TOTFZ Total Model Reactions: FX=%G, FY=%G, FZ=%G
Any help would be appreciated. Thanks.
-
April 3, 2025 at 12:40 pm
ErKo
Ansys EmployeeHi
The script as you saw only gets the correct result at the start/ so the fixed nodes (it would not be easy to do this for a general cut across the mesh).
Hence the best way is to use as you show in the first image (force reaction on a construction geometry / surface).
One can automate this (create surfaces and results) using Mechanical scripting – see here for an example:
https://discuss.ansys.com/discussion/4802/how-would-we-automate-the-extraction-of-section-forces-along-a-structure-say-a-columnAll the best
Erik
-
April 8, 2025 at 4:55 pm
ivan.redrado
SubscriberMany, many thanks for the asnwer, works perfectly fine! However, I have two inquiries:
- How do I make the force reaction be at all parts as a whole (as in the parts/components composing the geometry)?
- How could I export the given data to a .csv (or similar, such as .txt) file that wraps the results in an array such as (z, Fx, Fy, Fz)?
Thanks in advance!
-
- You must be logged in to reply to this topic.
-
6450
-
1906
-
1457
-
1308
-
1022
© 2026 Copyright ANSYS, Inc. All rights reserved.

