CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Output transient file to csv (https://www.cfd-online.com/Forums/cfx/26363-output-transient-file-csv.html)

Ben September 7, 2008 00:43

Output transient file to csv
 
Hi,

I am trying to output my transient results to csv format. Does anyone know how to conduct this operation?

I found out that you can do this in CFX-Post by going to File>Export, type in the filename as name.csv, select the variables you want to output, and save it as .csv.

However this only output the final results file....

I figured out that ANSYS-CFX solver can output transient results file to Fieldview,CGNS and other format..but it can't export to .csv file! I am currently trying to output variables such as velocity or pressure into csv format so that it can be read in MATLAB.

Does anyone have any idea? Any input will be greatly appreciated.

Cheers, ben

Padla September 7, 2008 11:58

Re: Output transient file to csv
 
Hello, Yes, it's a kind of problem in CFX to output transient fields into csv. I do it like this: 1. Create in CFX-Post one single Point, then create a time-plot of variable you want and wait (it depends on mesh how long. When I did it took sometimes for 5 or 10 minutes). 2. Then, using comand editor make any quantity of points you want by copy-pasting your first point and giving them new names. Then do the same with the plots. 3. Then you apply your changes and wait, until CFX builds your plots. Then press the "Export" button. And that is all.

P.S. Yeah, I know, it's pertty dull, but I didn't manage to find any better variant.


ben September 10, 2008 05:14

Re: Output transient file to csv
 
Ok, that might just work. Thanks for the input!

Terje September 23, 2008 08:17

Re: Output transient file to csv
 
Hi,

Padla's explanation does probably work but it involves a lot of manual work and has the problem that cfx post is very slow at making time plots. My method requires a little work up front but it will save you tremendous amount of time if you handle a lot of files. I often have a lot of trn-files and want to extract e.g. the temperature at the flow front to a csv-file at each time step. Here is my suggestion:

- First create a session file (temp1.cse) in post defining the flow front and export the temperature there to a Out.csv file.

- Write a small script that loops through your trn-files changes the name of the csv-file and runs cfx-post in batch mode. It could look something like below if you are using python. Here repString changes the string 'out.csv' to something like 'flowFront_22.csv' in the file temp1.cse.

prefix = 'flowFront'

for f in os.listdir(transFileFolder):

>if f[-3:] == 'trn':

>>timeStep = f.split("_")[0]

>>transFile = transFileFolder + f

>>repString('temp1.cse','temp2.cse','Out.csv', prefix + '_' + str(timeStep) + '.csv')

>>os.system('cfx5post -batch temp2.cse ' + transFile)



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