CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > ANSYS Meshing & Geometry

[ANSYS Meshing] Export fluent mesh via script

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Nigirim

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 28, 2013, 03:46
Default Export fluent mesh via script
  #1
New Member
 
Join Date: Sep 2012
Posts: 26
Rep Power: 14
Nigirim is on a distinguished road
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.
Nigirim is offline   Reply With Quote

Old   August 29, 2013, 08:05
Default
  #2
New Member
 
Join Date: Sep 2012
Posts: 26
Rep Power: 14
Nigirim is on a distinguished road
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");""")
If your Meshingmodule is set to export the file in ASCII format you will get the meshfile in fluent format usable for OpenFOAM.
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
DonKizzy likes this.

Last edited by Nigirim; August 29, 2013 at 09:47.
Nigirim is offline   Reply With Quote

Old   June 16, 2014, 04:15
Default
  #3
New Member
 
Select One...
Join Date: Apr 2012
Posts: 21
Rep Power: 14
eneja is on a distinguished road
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:
Originally Posted by Nigirim View Post
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
eneja is offline   Reply With Quote

Old   June 16, 2014, 05:56
Default
  #4
New Member
 
Join Date: Sep 2012
Posts: 26
Rep Power: 14
Nigirim is on a distinguished road
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
Nigirim is offline   Reply With Quote

Old   June 17, 2014, 10:42
Default
  #5
New Member
 
Select One...
Join Date: Apr 2012
Posts: 21
Rep Power: 14
eneja is on a distinguished road
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.
eneja is offline   Reply With Quote

Old   June 18, 2014, 03:56
Default
  #6
New Member
 
Join Date: Sep 2012
Posts: 26
Rep Power: 14
Nigirim is on a distinguished road
Quote:
Originally Posted by eneja View Post
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.
Hello eneja,

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
Nigirim is offline   Reply With Quote

Old   June 18, 2014, 06:00
Default
  #7
New Member
 
Select One...
Join Date: Apr 2012
Posts: 21
Rep Power: 14
eneja is on a distinguished road
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
eneja is offline   Reply With Quote

Old   June 18, 2014, 06:49
Default
  #8
New Member
 
Join Date: Sep 2012
Posts: 26
Rep Power: 14
Nigirim is on a distinguished road
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
Nigirim is offline   Reply With Quote

Old   September 12, 2016, 16:08
Default
  #9
New Member
 
Join Date: Mar 2016
Posts: 2
Rep Power: 0
s sur is on a distinguished road
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
s sur is offline   Reply With Quote

Old   August 19, 2021, 11:56
Default
  #10
New Member
 
coyote
Join Date: Aug 2021
Posts: 10
Rep Power: 5
coyote is on a distinguished road
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
coyote is offline   Reply With Quote

Old   March 24, 2022, 06:00
Default
  #11
New Member
 
Pete Lloyd
Join Date: Mar 2022
Posts: 1
Rep Power: 0
men9prl is on a distinguished road
coyote,
... SC.doFileExport(FilePath="C:/.../Mesh1.msh");""")
men9prl is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 10:00.