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

Fluent & matlab

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 4, 2009, 05:23
Default Fluent & matlab
  #1
Member
 
Join Date: Mar 2009
Posts: 39
Rep Power: 17
Fabio is on a distinguished road
Hi all' i would like to export some data of my simulation to matlab, i've choosen the ascii format is that correct? Thanks in advance.
Fabio is offline   Reply With Quote

Old   May 4, 2009, 06:15
Default
  #2
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,195
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Hi,

that's the right choice but in that way you have no control
on the format.

You could consider the following UDF:

/************************************************** ********************
UDF for output
************************************************** ********************/
#include "udf.h"
DEFINE_ON_DEMAND(output)
{
Domain *d;
real x[ND_ND];
real x0, y0, z0, u, v, w;
real p;
FILE *fp;
Thread *t;
cell_t c;
d = Get_Domain(1);
fp = fopen("data.txt","w");
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
C_CENTROID(x,c,t);
ND_SET(x0, y0, z0, x[0], x[1], x[2]);
ND_SET(u, v, w, C_U(c, t), C_V(c, t), C_W(c, t));
p = C_P(c,t);
fprintf(fp, "%14.12f %14.12f %14.12f ", x0, y0, z0);
fprintf(fp, "%18.16f %18.16f %18.16f %18.16f\n", u, v, w, p);
}
end_c_loop(c,t)
}
fclose(fp);
}

however, not all the variables available through the "export" gui command
are available in a UDF so the export in ASCII could be your only choice.

Regards
sbaffini is offline   Reply With Quote

Old   May 4, 2009, 12:13
Default
  #3
Member
 
Join Date: Mar 2009
Posts: 39
Rep Power: 17
Fabio is on a distinguished road
Thank for the answer, if i have understood well you use the UDF to choose wich varible to export.
I have done this through the menu provided in fluent under File\rightarrowExport...
I'm interest in some DPM variables ti plot as an integral in the time variable.
Fabio is offline   Reply With Quote

Old   July 24, 2009, 05:38
Default
  #4
Member
 
Join Date: Mar 2009
Posts: 39
Rep Power: 17
Fabio is on a distinguished road
Hi, which is the easyest wat to read an ASCII file which contains a text header. I need them to do a plot 2D or 3D i haven't decided yet. At the moment i'm using MATLAB, any other way?
Thanks in advance.
Fabio is offline   Reply With Quote

Old   July 24, 2009, 07:42
Default
  #5
New Member
 
divyam
Join Date: Jun 2009
Posts: 7
Rep Power: 17
divyatman is on a distinguished road
you can use the software Origin. it has an option to import ASCII files and a GUI for plotting all kind of graphs
divyatman is offline   Reply With Quote

Old   August 24, 2009, 14:16
Default
  #6
Member
 
Join Date: Mar 2009
Posts: 39
Rep Power: 17
Fabio is on a distinguished road
Hi, after a bit of time i'm done with calculating the integral in MATALAB. Now i got a 2830x6 matrix, where columns 2 to 4 are the coordinates of the nodes on the control surface mesh, column 6 is the integrated quantity. I would like to make a contour plot, by assigning the proper value to each node, but i'm not able to get back the original circular shape of the surface that i got in FLUENT when i have solved the case. Do you got any advice to postprocess my result in the correct way?

If something is not clear i will try to explain better.

P.S. The problem is that in MATLAB i'm non able to take the coordinates couple by couple and assign the proper value to the node represented by them, more simply get the positions of the nodes in the proper way under MATLAB.

Last edited by Fabio; August 25, 2009 at 06:19.
Fabio 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
Stopping a Fluent batch job AND saving the data! Possible? Volker Pawlik FLUENT 13 December 28, 2020 05:16
linking matlab and fluent Nair FLUENT 23 January 12, 2020 19:55
Two questions on Fluent UDF Steven Fluent UDF and Scheme Programming 7 March 23, 2018 04:22
Comparing Fluent Time dependent result with Patran venigall FLUENT 0 January 13, 2007 20:30
Advanced Turbulence Modeling in Fluent, Realizable k-epsilon Model Jonas Larsson FLUENT 5 March 13, 2000 04:27


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