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

import data from CFX-post to MATLAB/EXCEL

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Lance

Reply
 
LinkBack Thread Tools Display Modes
Old   April 15, 2007, 09:42
Default import data from CFX-post to MATLAB/EXCEL
  #1
dhaval
Guest
 
Posts: n/a
hi, can u give the procedure to import the data from CFX-post to MATLAB/EXCEL to plot the graph & do the calculation.
  Reply With Quote

Old   April 15, 2007, 12:47
Default Re: import data from CFX-post to MATLAB/EXCEL
  #2
Sze Hong
Guest
 
Posts: n/a
Create a graph on the CFX post, and when you decide what you plotted, there is a button that says EXPORT.
  Reply With Quote

Old   April 17, 2007, 10:45
Default Re: import data from CFX-post to MATLAB/EXCEL
  #3
Omer
Guest
 
Posts: n/a
1. You can do it the way Sze Hong says, by plotting the chart and then exporting

2. Or once you have created your point/line of interest. Just press file ---> export--- in csv format, and you have it in EXCEL. ( You cannot export transient results this way though, i think)

Then if you want, you can import your values from excel to MATLAB easily.

  Reply With Quote

Old   April 21, 2007, 12:12
Default what is the procedure to find coefficient of lift
  #4
Dhaval patel
Guest
 
Posts: n/a
what is the procedure to find the coefficient of lift from velocity vs chord length graph? or pressure vs chord length graph?
  Reply With Quote

Old   April 28, 2011, 02:48
Default
  #5
Member
 
Darren Leong
Join Date: Dec 2010
Posts: 63
Rep Power: 8
Darren Leong is on a distinguished road
Hi guys,

I need help on this too. I have transient run in which i would like Matlab to graph the location of a moving body (X,Y,Z), along with the forces and moments acting on it. So far, I've set up the monitor plots in which the data is stored in *.out files for each time step.

The data sitting in front of me on screen, however I haven't the clue to how to graph them out using Matlab, e.g. Collating them into one data file for plotting or reading the values from each .out file as it plots the graph.

Edit: Just to clarify what i mean is through script rather than manually (e.g. using the mouse) in Matlab.
Darren Leong is offline   Reply With Quote

Old   May 24, 2011, 05:26
Default
  #6
New Member
 
Join Date: May 2011
Posts: 9
Rep Power: 7
Kartus is on a distinguished road
I use the export function to export the results in a .csv file. You have to set a location from which it exports the results, so it is always recommended to view the results first in a chart and then export them to a .csv file. Make sure you don't add the header, you can unselect it on the second tab of the export screen, otherwise you have to manually set the rows and columns of the data for Matlab to work.

Use csvread in Matlab to load the results in your workspace. You can check 'help csvread' on how to do that.

Cheers!
Kartus is offline   Reply With Quote

Old   May 26, 2011, 00:39
Default
  #7
Member
 
Darren Leong
Join Date: Dec 2010
Posts: 63
Rep Power: 8
Darren Leong is on a distinguished road
Thanks, Kartus. I've managed to do as you've suggested

Results_002 = csvread ('Analysis_Results_002.dat',1,0);


It would have been good to have the labels read, would save me time to manually include them in the plot, e.g.

Timestep = Results_001(:,1);
Mesh_Quality = Results_001(:,2);
Sphere1_Force_X = Results_001(:,3);
Sphere1_Force_Y = Results_001(:,4);
Sphere1_Force_Z = Results_001(:,5);
Sphere1_Moment_K = Results_001(:,6);
Sphere1_Moment_M = Results_001(:,7);... and so on
Darren Leong is offline   Reply With Quote

Old   May 26, 2011, 05:01
Default
  #8
New Member
 
Join Date: May 2011
Posts: 9
Rep Power: 7
Kartus is on a distinguished road
To my knowledge it is not possible to read anyhting else then values from a csv file using csvread.

I can't help you with the labels, I add all the labels manually in an m-file and load all the results for different cases from that file. It is a copy-paste solution, not very elegant...
Kartus is offline   Reply With Quote

Old   March 4, 2013, 10:29
Default
  #9
New Member
 
amin gls
Join Date: Sep 2012
Location: Iran
Posts: 14
Rep Power: 6
amin_gls is on a distinguished road
hello. i have a question about this . when i export to .csv file and opens it with excel . the data are in different rows and just one column .for example x1 and v1 are in first column i want to be x1 in fist and v1 in second column . how can i do it . thanks for help .
amin_gls is offline   Reply With Quote

Old   March 4, 2013, 11:02
Default
  #10
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 601
Rep Power: 13
Lance is on a distinguished road
This is really not a CFX issue, but here goes...

It would be something like:
Data/From text/<find your file>/Delimited/<next>/Delimiters: comma/<finish>
amin_gls likes this.
Lance is offline   Reply With Quote

Old   March 5, 2013, 03:28
Default
  #11
New Member
 
amin gls
Join Date: Sep 2012
Location: Iran
Posts: 14
Rep Power: 6
amin_gls is on a distinguished road
Quote:
Originally Posted by Lance View Post
This is really not a CFX issue, but here goes...

It would be something like:
Data/From text/<find your file>/Delimited/<next>/Delimiters: comma/<finish>

thank you .. i did it .
amin_gls is offline   Reply With Quote

Old   September 13, 2016, 08:16
Default
  #12
Member
 
Thomas B
Join Date: Apr 2016
Location: Germany
Posts: 30
Rep Power: 2
Thomasbr is on a distinguished road
Hello,

I know this thread is very old, but I might have the same issue: I have several defined points P_i (like 100 or so), several reference temperatures (one for each point). For each point, a heat transfer coefficient is computed using the formula:

h(P_i)=\frac{Wall\ Heat\ Flux\ (P_i)}{\text{Reference Temperature}\ (P_i)-300[K]}


What interests me is the weighted average of these HTC's (therefore I cannot use the "monitor point method"):

h_\text{total}=\frac{\sum_iA_ih(P_i)}{\sum_iA_i}

This value only depends on time:

h_\text{total}=h_\text{total}(t)

I want to export the datas ( \text{time step} , h_\text{total} (\text{time step})) to MATLAB. For this purpose, I need the .csv file. Thing is, as far as I know, we can do that with the "export" command in CFX Post only for a given time step.

But I have the chart h_\text{total}=h_\text{total}(t) plotted. Is there a way to get the .csv file direct from the chart?

Or do I have no other choice but to write some script to loop over the time steps to retrieve for each one of them the value of h_\text{total}(\text{time step})?

Last edited by Thomasbr; September 13, 2016 at 10:00.
Thomasbr is offline   Reply With Quote

Old   September 15, 2016, 08:32
Default
  #13
Member
 
Thomas B
Join Date: Apr 2016
Location: Germany
Posts: 30
Rep Power: 2
Thomasbr is on a distinguished road
I finally managed to do what I wanted to, that is, to get a .csv file with the time (in my case variable name = TimeVar) and the value of h_\text{tot} (in my case variable name = AAlphaGesVar) for each time. This might interest someone, so I describe what I did (I learnt a bit of Perl too):

data.csv looks like this:

Code:
9.89989028e-004, 5.02314758e+000
1.02000998e-003, 5.10743713e+000
1.05003000e-003, 5.00016737e+000
1.07995002e-003, 4.82792759e+000
1.10997004e-003, 4.82947874e+000
...
To get this .csv file I wrote this .cse file:

Code:
COMMAND FILE:
CFX Post Version = 16.0
#Enter your version of CFX Post here
END

!use strict;
!use warnings;

!open (OUTFILE, ">", "data.csv");


!for (my $i=34; $i<=169; $i++)
!{
# Start for loop to load different time step
# One need to modify it based on his/her need

!my $resstp=$i;
DATA READER:DATA READER
Current Timestep = $resstp
END
> load

EXPORT:
# export data to test1.csv
ANSYS Export Data = Element Heat Flux
ANSYS Reference Temperature = 0.0 [K]
ANSYS Specify Reference Temperature = Off
ANSYS Supplemental HTC = 0.0 [W m^-2 K^-1]
BC Profile Type = Inlet Velocity
Export Connectivity = Off
Export Coord Frame = Global
Export File = test1.csv
Export Geometry = Off
Export Node Numbers = Off
Export Null Data = Off
Export Type = Generic
Export Units System = Current
Export Variable Type = Current
Include File Information = Off
Include Header = Off
# One can turn header off if it is wanted
Location List = P22
#The value of my variables does not depend on the location, so I put any point here, just modify it based on your need
Null Token = 0
Overwrite = On 
# One should turn the Overwrite On
Precision = 8
Separator = ", "
Spatial Variables = X,Y,Z
Variable List = TimeVar, AAlphaGesVar
Vector Brackets = ()
Vector Display = Scalar
END
>export

!open (INFILE, "<", "test1.csv");
!print OUTFILE <INFILE>;
# copy data in test1.csv to output file, which is data.csv
!close INFILE;
!}
!close OUTFILE;
adapted from the script http://www.eureka.im/3771.html


Under CFX Post I clicked on "Session" then on "Play Session" and selected the .cse file. After a couple minutes the file data.csv was written.

Last edited by Thomasbr; September 15, 2016 at 10:41.
Thomasbr is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Read Error ansys CFX fcabrales CFX 3 April 18, 2011 18:21
Can you post a blade data points file example??? Nicola NUMECA 0 September 21, 2007 11:38
Export AreaAve data at each time step in CFX Post Kumar CFX 2 August 22, 2007 12:32
(CFX POST) Rotational Speed ARJUN CFX 9 July 13, 2006 20:38
How to save cell set post data in to a file Negin CD-adapco 1 January 27, 2006 04:41


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