How to start Fluent with Matlab??
I am working on a problem that will need to start Fluent with Matlab. I am wondering if this is possible. If yes, how to do that?
What I want to do can be described as follow:
1. Run Matlab to obtain the B.C. for Fluent;
2. Start Fluent with Matlab (how to write this command in .m file?), use the calculated B.C. from previous step and run Fluent journal file;
3. Export calculated Fluent result;
4. Fluent results will be read by Matlab .m file;
5. Continute the following Matlab calculation; If necessary, run Fluent again.
UDF file may be needed.
How can I do that? It seems like we can do that.
so, is quiet easy, I do that every day, but depends on your version of the programs and if is a 3d or 2d problem. By the way, I do this:
1) You write the part of the *.m file which calculate the BC or any other parameter as you want.
2) The second part of the program write a *.txt file used as a journal file for Gambit (see the Matlab guide how to write *.txt files).
3) Launch Gambit in Batch mode with the command:
! C:\Gambit\ntbin\ntx86\gambit.exe -inp *.txt
4) With the same commands above write the Journal file for Fluent.
5) Launch Fluent in batch mode with the command:
! fluent fluent 3ddp -g -i "C:\Admin\Desktop\*.jou"
6) In the fluent journal provide the necessary commands to plot *.txt files of the results.
7) Read this results with Matlab (see the guide hot to do it).
8) And restart the loop or process them.
The Gambit and Fluent journal language is not easy to explain in a single post like this.
Luca, HIT (Harbin, China)
Im trying to do the same procedure in MATLAB
I have this function that writes the journal file and Im trying to open fluent in that function but the command "!fluent-3ddp" or even
! C:\Program files\ANSYS Inc\...\fluent.exe -3ddp
The thing is when I dont add anything after the fluent path it works fine and the fluent window pops up, but as soon as I add "-3ddp" or "-i" or anything else it wont work anymore and give me this error
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Do u have any suggestion?
I appreciate your help.
Try to put the the path into a string "", such as "C:\Program files\ANSYS Inc\blablabla\fluent.exe -3ddp"
thanks for your reply
I used "system" command and used " too
You can script Fluent directly from Matlab without having to create Fluent journal ,start Fluent in batch mode and then shutdown Fluent. The process of starting/shutting down Fluent can be quite expensive.
I will recommend the following steps
1.Start Matlab on Matlab machine
2.Start Fluent on Fluent machine in server mode (add -aas option)
3.Connect Matlab with Fluent
4. Compute B.C for Fluent in Matlab
5. Apply BC for Fluent in Matlab
6. Ask Fluent to perform CFD simulation from Matlab
7. Ask Fluent to provide calculated results from Matlab
8. Continue to follow Matlab calculation
9. Repeat steps 3 to 8 as needed to perform Fluent-Matlab simulation
10. Shutdown Fluent from Matlab when not needed.
This way you will have a remote Fluent-Matlab simulation, without having to start/shutdown Fluent and load/save Fluent cases or data.
Also your whole simulation logic will be in one place, in your Matlab code that will issue both Matlab and Fluent commands.
For more references about the technique follow the instructions in my following CFD-online post:
I hope this helps.
|All times are GMT -4. The time now is 01:47.|