TAGGED: mechanical-apdl, static-structural
-
-
January 20, 2021 at 10:16 pmAhmedzeidSubscriberHello all,nI am writing a code in Python that carries out the helical compression spring design process. It can for example solve for the required spring wire diameter given the load applied. I wish to send the design parameters (wire diameter, applied load, number of coils, etc...) to Ansys to perform a simulation for it and plot the stress profile for this particular design.nHow can I automate such process, such that my Python code would automatically send these information to Ansys for it to automatically run the simulation using these information?nAny help would be appreciated.nRegards,nAhmed Zeidn
-
January 21, 2021 at 11:55 amAniketForum ModeratorIf you are using parametric geometry you can create multiple design points to simulate this. (https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v211/en/wb2_help/wb2h_parmdespt.html) Do you want to automate the result post processing as well? If yes, you can take a look at the Mechanical automation APIs here:nANSYS Store Developer Resourcesnandnhttps://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v211/en/act_script/act_script.html n-AniketnHow to access Ansys help linksnGuidelines for Posting on Ansys Learning Forumn
-
January 21, 2021 at 11:24 pmAhmedzeidSubscriberThank you for your reply, @AniketnnI am indeed working with a parametric geometry, as I have generated a script for a CAD software that will receive the geometry details from my python code, generate the geometry and later export it to Ansys to run the simulation.nFirst, and as for the parametric simulation recommendation, I looked it up, and it actually looks like it might work for my case. However, I wish to write a general simulation script that will work as my template for all different designs, and hence change the applied force parameter for example (inputted by user in the python code) and run the simulation using this force and the previously imported geometry, then finally do the postprocessing in the form of a stress profile plot. I tried to record this general script (the template) from Mechanical (using the script recording beta feature in my 2020R2), but unfortunately the parametric design steps were not caught in the script as they took place in WB not inside Mechanical as I understood. Is there a way where I can write the portion of the script that is related to the parametric design and postprocessing manually? Please note that I do not need multiple design points, as I am running only one simulation by spring design (i.e. design point).nSecondly, would it be a good idea to, generate a template Macro on MAPDL, then to run the simulation I would export my geometry file to MAPDL, change the parameters and real constants in the template Macro and run the simulation instead of the first point?nThirdly, as I understood, ACT can help you do things such as customizing a data input GUI. I tend to run my simulation in the background, and only show its results in my python code. Would I still be needing ACT, since I am not visually interacting with ANSYS at all during the simulation?nLastly, I am actually using Ansys products installed on university machines, and hence do not have access to Ansys customer portal. Would you mind if you mentioned the titles of the documents instead of the direct links please? Perhaps I can find some information about them online.nI am sorry if my question was too long, as this is my very first attempt with Ansys automation and I am a bit confused with all the material I found online during my research. Please feel free to answer whichever parts of my question you would like to.nnThank you once again for your help,nAhmed Zeidn
-
January 22, 2021 at 9:56 amAniketForum ModeratorIf a standard feature of parameters would work I don't think you need to script that, you can only script that part that is not covered in the standard feature, like exporting the images for each design pointnSure, if you are comfortable with APDL, instead of python and ok with the legacy graphics for image export and have your geometry properly tagged for faces/edges that are used for BCs using named selections/components, you can use APDL code to automate this instead of ACTnACT can automate things in batch too, but for result image capture I think it will need a GUI as far as I am aware.nPlease check the first link in my signature to access those links. If you are still not able to access those links please let me know!n-AniketnHow to access Ansys help linksnGuidelines for Posting on Ansys Learning Forumnn
-
January 23, 2021 at 1:05 pmAhmedzeidSubscriberI understand that you're suggesting that I don't script the standard features available in Mechanical because I can just do it manually. If my understanding was correct, then that's probably not the best suited for my case, as the simulation should be done automatically with absolutely no interaction from my side with Mechanical. That's why I wanted to script the whole thing.nI found that MAPDL would be more suited for my case as it is faster to load up and solve than Mechanical. I tend to do this by creating a CAD file, converting it to IGES, exporting it to MAPDL, apply SOLID187 element to it to make nodes, and carry on with the meshing, BC, .etc... (The whole process is Macro recorder). Do you think that I am missing any steps or most likely to run into problems using this approach?nJust for reference, I found out about this module called PyMPDL. It's such a convenient and powerful tool whenever Python/MAPDL integration is needed. https://mapdldocs.pyansys.com/#nThe Ansys help links worked out perfectly for me. Thanks a lot!nnRegards,nAhmed Zeidnn
-
January 29, 2021 at 1:29 pmAniketForum Moderator2 . I don't think you will run into problems if you are able to import the iges files without any issues.n3 . Good find! Best luck!n-AniketnHow to access Ansys help linksnGuidelines for Posting on Ansys Learning Forumn
-
Viewing 5 reply threads
- The topic ‘How to automate Ansys Mechanical using Python?’ is closed to new replies.
Ansys Innovation Space
Trending discussions
- At least one body has been found to have only 1 element in at least 2 directions
- Error when opening saved Workbench project
- How to apply Compression-only Support?
- Geometric stiffness matrix for solid elements
- Frictional No separation contact
- Timestep range set for animation export
- Image to file in Mechanical is bugged and does not show text
- Script Error Code:800a000d
- Elastic limit load, Elastic-plastic limit load
- Element has excessive thickness change, distortion, is turning inside out
Top Contributors
-
1421
-
599
-
591
-
565
-
366
Top Rated Tags
© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.