Is it possible to automatically read Ansys Mechanical available inputs #2397
-
Good day, I'm truing to find the way how to get inputs (boundary conditions) from Ansys Mechanical to replace the values of them on the new one and perform calculation. the approaches I saw before were based of manual finding the values in ds.dat file. Is there any way to automate this process, like loading project file and recognition will provide me all data (boundary conditions) can be changed for simulation? If yes, could you recommend what file type should be used (*.dat, *.cdb, etc) Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Hello! For changing things such as boundary conditions given a
I'm afraid there is not a more dynamic approach with setters, getters, and classes in PyMAPDL. Alternatively, you can have a look at PyMechanical using "embedded instances`. |
Beta Was this translation helpful? Give feedback.
-
Hi @ValentynBarannik & @germa89 If you look at the input file written by Mechanical there is a comment given that describes the type of bc/load. If we list the component in MAPDL or PyMAPDL then the those with the 'internal' name style will not be listed. But if instead of CMLIST we use CMLIST,ALL then all the components are listed. Maybe @germa89 can add the .to_list method to the PyMAPDL version of CMLIST with an option for 'ALL' we can see them. Now if you are using Mechanical to pre-process the model then want to take it into PyMAPDL to set up the loads/bc's and solve. Or maybe solve multiple times for different loadings, you would be better off defining Named Selections in Mechanical of the regions you want to apply loads/bc's to. Give then a name that makes sense to you...like "Loc1FixedXYZ" or something. Then define and change the loads/bc's in PyMAPDL as needed with the component names. Then use the manual method in Mechanical to write out the input file. Instead if you use PyMechanical you can turn on the recording of actions in the Mechanical scripting window, then define the load/bc. This will show the Mechanical commands used to define the load/bc. Then in PyMechanical you can reuse these and do a Python substitution on the values as needed. Mike |
Beta Was this translation helpful? Give feedback.
Hello!
For changing things such as boundary conditions given a
ds.dat
file, you have two approaches if you want to use PyMAPDL:ds.dat
file usingmapdl.input
. Then you will have all the model in memory. Then you can change things, like boundary conditions using MAPDL commands such asmapdl.d
,mapdl.f
, etc. You should have also the components, so it should be easy to reuse them to apply/modify loads.ds.dat
file the hardcoded values. You can opends.dat
file within python (open("ds.dat", "r") as ...
), replace/modify the lines you want, and then submit the job to MAPDL usingmapdl.input_strings
.I'm afraid there is not a more dynamic approach with setters, getters, …