CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   linking matlab and fluent (http://www.cfd-online.com/Forums/fluent/43955-linking-matlab-fluent.html)

Nair March 1, 2007 12:16

linking matlab and fluent
 
I have to do an optimization on wing planform. I would like to run the optimization on matlab and the flow simulation on fluent. Does a way exist to link these softwares? My aim is to use Matlab as a "master" program and fluent as a "slave".

Seeker Phil March 1, 2007 14:16

Re: linking matlab and fluent
 
You should be able to do it pretty easily by using the shell escape character. For example:

<code> !fluent.exe </code>

It depends on what you are tryin to do - Phil


Michael B March 2, 2007 04:58

Re: linking matlab and fluent
 
Have a look at this. http://www.dansis.dk/download/Fuldautomatisk%20Optimering%20-%20Steen%20Lauridsen.pdf


Ralf Schmidt March 2, 2007 07:03

Re: linking matlab and fluent
 
hi!

here are two other links, that may help:

http://www.cfd-online.com/Forum/flue...cgi?read=35447

http://www.cfd-online.com/Forum/flue...cgi?read=45383

Ralf

Khairy March 2, 2007 12:27

Re: linking matlab and fluent
 
Hi

i think you can write a fluent journal say c:\xxxx.jou with all steps needed to be measured in fluent

from matlab ! fluent 2ddp -i "C:\xxxx.jou"

also u can use pause function from Matlab to perform modification in journal file after each optimization process

i hope this useful

Khairy

Cairo-Egypt

nair March 2, 2007 14:04

Re: linking matlab and fluent
 
Thanks for all these responses. I will try to do it with fluent journal as it seems to work.


rajesh March 20, 2007 23:20

Re: linking matlab and fluent
 
i am intersted to do the fluent matlab link can u say the procedure

thanks

rajesh March 20, 2007 23:31

Re: linking matlab and fluent
 
can u post the pdf file again please


Michael B March 21, 2007 03:13

Re: linking matlab and fluent
 
sorry. It has been removed.

Sheeren April 6, 2013 05:11

Fluent data and MATLAB
 
Hi
I have a velocity field which I got through FLUENT. now I want to calculate the pressure using the velocity data on MATLAB. I have imported the fluent data in MATLAB. I am having difficulty to pick the correct velocity of the specific node as the data is not organized with respect of either x or y coordinate.

M201170944 October 4, 2013 21:47

Quote:

Originally Posted by Sheeren (Post 418716)
Hi
I have a velocity field which I got through FLUENT. now I want to calculate the pressure using the velocity data on MATLAB. I have imported the fluent data in MATLAB. I am having difficulty to pick the correct velocity of the specific node as the data is not organized with respect of either x or y coordinate.

Hi Sheeren
Have you worked out the problem mentioned above?
I am using the Matlab to work with Fluent and meet the problem as yours too?

Sorin October 9, 2013 14:08

Hi Sheeren,

I would recommend journaling Fluent from Matlab.

I will not copy/paste my other post but I will provide the link to my other cfd-online post: http://www.cfd-online.com/Forums/flu...ab-fluent.html

You will start Fluent on your preferred Fluent machine and Matlab on your preferred Matlab machine and have them connected. Follow the steps in the post referred above.

Then, of course, you will able to code standard Matlab script mixed with Fluent scripting lines.

Fluent scripting will be implemented trough either tui.DoMenuCommand or tui.DoMenuCommandToString

To get the velocity at node you will have to execute

tui.DoMenuCommand('file export ascii ...')

The "file export ascii ..." will return the values of velocity at specific coordinates.

One of the options of the command is Location/CellCentered?. If you set that option to no the node values for velocity will be returned. Otherwhise Cell-centered values will be returned.

I would recommend checking the command in Fluent's native console first.

Just for your reference, if you use the Fluent case in the first Fluent tutorial, the next Matlab command will generate a node location report of velocities on the surface with the surface id 1.

tui.DoMenuCommand('file export ascii report.txt 1 () no x-velocity y-velocity z-velocity () no')

buffer=tui.DownloadFileToBuffer('report.txt')


The last option in the file export command has to be no for Node values and yes for Cell-centered values.

The first Matlab command will ask Fluent to generate the report, space delimited, and the second one will retrieve the report from the Fluent machine into the Matlab machine.

The content of the Matlab variable called buffer will be:

nodenumber x-coordinate y-coordinate z-coordinate z-velocity y-velocity x-velocity
1 1.152879596E-01 2.031999975E-01 6.634064950E-03 -2.968966030E-02 3.717783093E-01 4.227112606E-02
2 1.195714250E-01 2.031999975E-01 1.100432387E-18 -8.820794523E-03 3.445040882E-01 7.459304482E-02
3 1.135978848E-01 2.031999975E-01 7.346584965E-19 -1.874569058E-02 3.483363688E-01 5.241509899E-02
4 1.295439452E-01 2.031999975E-01 5.346933380E-03 7.882571779E-03 3.145299554E-01 6.067820266E-02
5 1.315185130E-01 2.031999975E-01 1.831980064E-18 5.455949809E-03 3.054272830E-01 6.991569698E-02
6 1.255449653E-01 2.031999975E-01 1.466206277E-18 1.139550121E-03 3.258269727E-01 8.162691444E-02
7 1.502135396E-01 2.031999975E-01 6.340762600E-03 9.426723234E-03 4.359190762E-01 2.245260961E-02
8 1.554126740E-01 2.031999975E-01 3.295075624E-18 4.237215500E-03 4.635384083E-01 2.144469880E-02
9 1.494391263E-01 2.031999975E-01 2.929301734E-18 4.789047409E-03 4.064534009E-01 2.660968900E-02
10 1.713656485E-01 2.031999975E-01 6.717640907E-03 5.333635490E-03 4.887778759E-01 7.551581133E-03
11 1.733332872E-01 2.031999975E-01 4.392397295E-18 2.691901056E-03 4.850952923E-01 4.341949709E-03
12 1.673597544E-01 2.031999975E-01 4.026623405E-18 2.609958639E-03 4.897836149E-01 9.937736206E-03
13 1.412532330E-01 2.031999975E-01 6.340762600E-03 1.354721840E-02 3.258499205E-01 3.310972080E-02
14 1.434655935E-01 2.031999975E-01 2.563527844E-18 6.097615231E-03 3.381870687E-01 3.366776928E-02
15 1.374920458E-01 2.031999975E-01 2.197753954E-18 7.280339953E-03 3.002582788E-01 4.857731238E-02
16 1.576804668E-01 2.031999975E-01 6.340762600E-03 6.822485011E-03 4.780743122E-01 1.799257658E-02
17 1.613862067E-01 2.031999975E-01 3.660849515E-18 2.887216164E-03 4.864223301E-01 1.562698744E-02
18 1.773391813E-01 2.031999975E-01 6.717640907E-03 5.844513420E-03 4.801833332E-01 2.978647826E-03
19 1.793068349E-01 2.031999975E-01 4.758171185E-18 3.179352498E-03 4.687085152E-01 -1.482679625E-03
20 1.886768490E-01 2.031999975E-01 5.854124669E-03 2.533855848E-03 4.385802746E-01 -6.194453221E-03
21 1.912539154E-01 2.031999975E-01 5.489718966E-18 4.006652161E-04 4.160143435E-01 -1.083826553E-02
22 1.852803677E-01 2.031999975E-01 5.123945075E-18 2.511465689E-03 4.431619346E-01 -7.344217505E-03
23 1.646601856E-01 2.031999975E-01 7.317313924E-03 5.943228491E-03 4.892514646E-01 1.254611928E-02
24 1.229127571E-01 2.031999975E-01 5.863120314E-03 -5.249480251E-03 3.434669673E-01 6.091181561E-02
25 1.355963051E-01 2.031999975E-01 5.199092906E-03 1.269620750E-02 3.007976115E-01 4.804949090E-02
26 1.833213121E-01 2.031999975E-01 7.256622892E-03 5.729522556E-03 4.623973966E-01 -1.315846923E-03
27 1.458099633E-01 2.031999975E-01 5.491864402E-03 1.017787773E-02 3.759089112E-01 2.729051746E-02
28 1.937100142E-01 2.031999975E-01 5.562217906E-03 -1.522899955E-03 4.181340933E-01 -7.305184379E-03
29 1.614051610E-01 2.031999975E-01 1.945968345E-02 1.262411010E-02 4.887210429E-01 1.180070359E-02
30 1.658221632E-01 2.031999975E-01 1.482590381E-02 1.012255251E-02 4.906893969E-01 1.141436677E-02
31 1.599482596E-01 2.031999975E-01 1.268152520E-02 1.048206538E-02 4.860492051E-01 1.469715778E-02
32 1.404936016E-01 2.031999975E-01 2.799759991E-02 1.532310992E-02 4.606435299E-01 -4.372561816E-03
33 1.349518895E-01 2.031999975E-01 3.111136146E-02 4.375991877E-03 4.634742439E-01 -1.976985298E-02

.......



Sorin

Quote:

Originally Posted by Sheeren (Post 418716)
Hi
I have a velocity field which I got through FLUENT. now I want to calculate the pressure using the velocity data on MATLAB. I have imported the fluent data in MATLAB. I am having difficulty to pick the correct velocity of the specific node as the data is not organized with respect of either x or y coordinate.


shahed.malekipour January 23, 2014 01:28

what does "-i" do?
! fluent 2ddp -i "C:\xxxx.jou"

Sorin January 28, 2014 10:29

Hi Shahed,

You can do Fluent journaling in many ways. You can journal from Matlab directly or you can journal form a file (the "-i" option).

As a rule of thumb, if the interaction with Matlab is insignificant and the Fluent run takes a considerable amount of time, I would recommend using file journaling. This option typically will take a larger amount of Matlab coding, because you have Fluent writes the output into a file and then you have to parse it to extract the information

If the exchange of information between Matlab and Fluent is reasonable, I would advise Matlab journaling. This will take less time on Matlab coding since the output of command are delivered into Matlab.

Now, to answer your question:

The "-i <filename.jou>" option on Fluent start command instructs Fluent to read and execute as a Fluent TUI command every line in the file <filename.jou>. until the end of file.

If you are executing "!fluent 2ddp -i "C:\xxxx.jou" from Matlab all outputs or errors for all commands can be eventually retrieved from a transcript file. To process it in Matlab you will then have to parse the information in the transcript file.

I would advise you though to connect with Fluent directly from Matlab, because that way you can get the output of every command after it is executed.

Sorin


All times are GMT -4. The time now is 16:31.