Export Pressure Data to Mechanical

This code will Export Pressure Data to a .CSV file that can be mapped to a Mechanical Model.

Procedure:

  1. Specify n_iter and n_core
  2. Make sure you have Fluent 2025R1 installed and double check the path (last row of the code), here os.system(“"C:\Program Files\Ansys Inc\v251\fluent\ntbin\win64\fluent.exe" 3ddp -t”+ n_core + “ -g -i journal.jou -case export.cas.h5”)
  3. Run the script.

Here is the resulting .CSV file written in format Node# (not used), X, Y, Z, Pressure:

Transparent

Create an External Data System and read in the .CSV file:

Transparent Transparent

Map the pressure in Mechanical!

Transparent

# Python Script, API Version = V251
import os
dialog = OpenFileDialog()
dialog.Title = "Select disco file"
dialog.Show()
File.Open(dialog.FileName)
filePath = dialog.FileName.Remove(dialog.FileName.Length-os.path.basename(dialog.FileName).Length)

n_iter = "100"
n_core = "6"
 
#
## Save Project As
File.SaveAs(filePath + "export.cas.h5")
## EndBlock
#
f = open(filePath + "journal.jou", "w")
f.write("/solve/initialize/initialize-flow \n")
f.write("/solve/iterate " + n_iter + " \n")
f.write("/file/export ascii data.csv * () yes pressure () no ok \n")
f.write("exit ok \n")
f.close()
#
os.chdir(filePath)
os.system("\"C:\\Program Files\\Ansys Inc\\v251\\fluent\\ntbin\\win64\\fluent.exe\" 3ddp -t"+ n_core + " -g -i journal.jou -case export.cas.h5")