|
[Sponsors] |
[ANSYS Meshing] Export fluent mesh via script |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 28, 2013, 03:46 |
Export fluent mesh via script
|
#1 |
New Member
Join Date: Sep 2012
Posts: 26
Rep Power: 14 |
Hi all,
I have written a script creating a mesh using data from excel, now I want to export the created mesh for the usage in OpenFOAM using a script command. Usually the export works per mesh.export(FilePath="MyMesh.msh") in the Python section of the script. But this way I get a binary file, which I doubt is even a fluent mesh file. The Option that toggles the ASCII export is already set in the mesher but it doesn't seem to have any effects. Is there any way to get my mesh in ASCII format via Python or should I try to make a jscript and work with mesh.sendCommand()? /Edit: I forgot to mention that I use Ansys 14.5.0 Thanks in advance Nigirim Last edited by Nigirim; August 28, 2013 at 07:33. |
|
August 29, 2013, 08:05 |
|
#2 |
New Member
Join Date: Sep 2012
Posts: 26
Rep Power: 14 |
Hi all,
I found my solution to export the mesh in fluent format. Code:
system = GetSystem(Name="SYS") mesh = system.GetContainer(ComponentName="Mesh) mesh.Edit() mesh.SendCommand(Command= """ var DS = WB.AppletList.Applet("DSApplet").App; SC = DS.Script; SC:doFileExport("MyMesh.msh");""") Please note it is NOT possible to run those commands inside the IronPythonconsole from workbench you have to do it with a journal or python file. It is also possible with the other ansys mesh formats you just have to change the ".msh" to the file ending. Greets Nigirim Last edited by Nigirim; August 29, 2013 at 09:47. |
|
June 16, 2014, 04:15 |
|
#3 | |
New Member
Select One...
Join Date: Apr 2012
Posts: 21
Rep Power: 14 |
Hello!
Would it be possible to get an example of a script where you have created mesh? I just have to do simple 2D, rectangular shape. Thanks in advance Quote:
|
||
June 16, 2014, 05:56 |
|
#4 |
New Member
Join Date: Sep 2012
Posts: 26
Rep Power: 14 |
Hello eneja,
I have created the mesh manually in the ANSYS Mesher, the script was just to use the parametric functions of ANSYS Workbench. Do you want to create the Mesh via Macros/Scripts from the scratch or modify a existing Mesh using Parameters? Greets Nigirim |
|
June 17, 2014, 10:42 |
|
#5 |
New Member
Select One...
Join Date: Apr 2012
Posts: 21
Rep Power: 14 |
Actually I am open for suggestions. What I want to do is a parametric analysis, probably with scripts/journals. Calculations will be:
1. geometry 1, boundary conditions 1, calculate 2. geometry 1, boundary conditions 2, calculate 3. geometry 2, boundary conditions 1, calculate 4. geometry 2, boundary conditions 2, calculate etc. I do not want to change geometry and meshing manually... I am not quite sure how to do it, so if anyone could advise me, I would be more than happy. |
|
June 18, 2014, 03:56 |
|
#6 | |
New Member
Join Date: Sep 2012
Posts: 26
Rep Power: 14 |
Quote:
do you only want to change the geometry and mesh it or is there some work done in DM? If you only want to change it you can use IronPython to Change the source of you geometry. If you on the other hand have some work done in DM you will Need to use JScript to tell DM what he has to do. Almost the same goes for your meshing, you can go for a simple update via Workbench or have some work done via JScript. Are the two geometries completely different or just parametric changes to a Basic geometry? Greets Nigirim |
||
June 18, 2014, 06:00 |
|
#7 |
New Member
Select One...
Join Date: Apr 2012
Posts: 21
Rep Power: 14 |
I just want to change one or two parameters (such as width from let's say 0.5 cm to 1 cm), so if I understand you correctly, I should use IronPython. I guess I will have to look in a WB scripting guide, but if you (or anyone else) have any suggestions how and where to start, please feel free to replay.
Thank you very much |
|
June 18, 2014, 06:49 |
|
#8 |
New Member
Join Date: Sep 2012
Posts: 26
Rep Power: 14 |
Hello eneja,
I would highly recommend you to stick to IronPython if possible, it is documented from ANSYS, macros in JScript for DM etc. are barely documented and you have to dig deep to find useful commands. If you only want to do some little changes on Parameters or geometry this might help you: http://www.padtinc.com/blog/the-focu...mponent-system This side uses Excel to Change some Parameters, do the Simulation and give the Solutions back to Excel (There is a second part of this blog aswell but I can't find it right now). Depending on what you want you can modify this. Greets Nigirim |
|
September 12, 2016, 16:08 |
|
#9 |
New Member
Join Date: Mar 2016
Posts: 2
Rep Power: 0 |
Just wanted to point a small typo in your mesh exporting code snippet:
it should be SC.doFileExport and not SC:doFileExport Thanks for finding this. Honestly where would anyone find these commands with available literature being practically non-existent? I haven't found anything on the ANSYS Portal either |
|
August 19, 2021, 11:56 |
|
#10 |
New Member
coyote
Join Date: Aug 2021
Posts: 10
Rep Power: 5 |
I'm trying to export to .msh and the code seems to work (at least no error is shown), but there is no export anywhere, or at least I cannot find it...
I try absolute path, relative path..anywhere and still cannot find it... can someone help ? thanks in advance |
|
March 24, 2022, 06:00 |
|
#11 |
New Member
Pete Lloyd
Join Date: Mar 2022
Posts: 1
Rep Power: 0 |
coyote,
... SC.doFileExport(FilePath="C:/.../Mesh1.msh");""") |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] ANSYS to Fluent mesh export in ASCII format | johannes | ANSYS Meshing & Geometry | 64 | October 19, 2021 21:13 |
[ICEM] Problems with export 2D mesh from ICEM to FLUENT | newcomer | ANSYS Meshing & Geometry | 54 | September 20, 2014 13:40 |
export mesh from fluent | hamednoordoost@yahoo.com | FLUENT | 3 | May 11, 2013 10:51 |
Help, trying to generate mesh from gambit to export to fluent | whiteheart2k | Main CFD Forum | 1 | January 28, 2013 03:35 |
Export mesh from Fluent in Nastran format | Wieland | FLUENT | 9 | October 19, 2012 10:16 |