CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Automating Mesh Database (.mshdb) to CGNS Conversion in ANSYS 2021 R2

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 26, 2024, 17:43
Default Automating Mesh Database (.mshdb) to CGNS Conversion in ANSYS 2021 R2
  #1
New Member
 
Join Date: Jul 2024
Posts: 2
Rep Power: 0
aliazar is on a distinguished road
Hello everybody,

I have a couple of mesh database files (.mshdb) and I want to convert all of them to CGNS in an automated process. I’m using ANSYS 2021 R2. I cannot use PyMechanical unfortunately, and no matter what I do with ACT, using Journal, using CFX-Pre, or using Fluent, it’s not working. I can convert them manually one by one, but I’m just wondering if there is a way to do it in batch mode or using IronPython or any other ideas.

Thank you.
aliazar is offline   Reply With Quote

Old   July 28, 2024, 13:52
Default
  #2
New Member
 
Join Date: Jul 2024
Posts: 2
Rep Power: 0
aliazar is on a distinguished road
Solved by myself:

Not fully automated (like APDL and batch script) but still working. I used WB, File --> Scripting --> Run script --> choose python code (Iron python code!). First upload the project

Code:
Open(FilePath = Wbpj_path)
Then set current design point to 0 (dp0) and update the mesh (I learned this one by recording Journal from File)

Code:
dp0 = Parameters.GetDesignPoint(Name= "0")
Parameters.SetBaseDesignPoint(DesignPoint=dp0)
Note that if dp0 is already set as current design point do not runParameters.SetBaseDesignPoint. The code will give you an erro stating the dp0 is current and exit (which I found it so dumb)

Anyways updating Mesh:
Code:
# Update Mesh
system0 = GetSystem(Name="SYS")
meshC0 = system0.GetComponent(Name="Mesh")
meshC0.Update(AllDependencies=True)
here is get tricky you need to choose Mesh container and open it and then export your mesh.

Code:
mesh1 = system1.GetContainer(ComponentName="Mesh")
mesh1.Edit()

export_command = '''DS = WB.AppletList.Applet('DSApplet').App;DS.Script.doFileExport("F:\dump_here\SYS.cgns")'''

# Execute
mesh1.SendCommand(Command=export_command)

and finally exit

Code:
mesh1.Exit()
Of course at the beginning import os and use For loop to loop over all desgin points. You can use this method to save the mesh to other format as well.

Last edited by aliazar; July 28, 2024 at 14:36. Reason: Add more explanation
aliazar 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
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 07:09
decomposePar problem: Cell 0contains face labels out of range vaina74 OpenFOAM Pre-Processing 37 July 20, 2020 06:38
Can you help me with a problem in ansys static structural solver? sourabh.porwal Structural Mechanics 0 March 27, 2016 18:07
Ansys SIG$ILL error loth ANSYS 3 December 24, 2015 06:31
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55


All times are GMT -4. The time now is 23:57.