Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Reaction Forces and Moments along an axis.

    • ivan.redrado
      Subscriber

      Hi, 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.

      CDN media

      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

      r/ANSYS - Output from the code

      Any help would be appreciated. Thanks. 

    • ErKo
      Ansys Employee

       

       

      Hi

      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-column

       

      All the best

       

      Erik

       

       

    • ivan.redrado
      Subscriber

      Many, many thanks for the asnwer, works perfectly fine! However, I have two inquiries: 

      1. How do I make the force reaction be at all parts as a whole (as in the parts/components composing the geometry)?
      2. 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! 

       

       

       

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
[bingo_chatbox]