How to make Matlab wait for complete process of Ansys Fluent?

5 views (last 30 days)
I trying to link Matlab with Ansys Fluent, but when I use the command "!fluent..." in Matlab the script don't wait for the final process of Fluent. How can I make it? I need the result files of Fluent to continue the work.
Thanks, Rafael
  1 Comment
sina salahshour
sina salahshour on 6 Nov 2022
Dear Rafael Stange,
I want to link matlab with Ansys Fluent do you know any documentation without AAS toolbox?
Best Regards,

Sign in to comment.

Answers (1)

Nhan Nguyen
Nhan Nguyen on 29 Nov 2018
Edited: Nhan Nguyen on 29 Nov 2018
Hello Rafael,
I don't know much about ANSYS Fluent. But I have some experience with ABAQUS.
To check if a ABAQUS simulation is done or not we can read a .sta file (or .log flle).
Usually, its name is Job-1.sta where Job-1 is the name of the ABAQUS job.
The job is done If the two end-lines of the file contains the following string
THE ANALYSIS HAS COMPLETED SUCCESSFULLY
Belows is a small script to do that verification. Hope that it will help you.
Best regards,
Nhan
idletime = 0;
flag = 1;
while flag
fid = fopen('Job-1.sta','r');
while ~feof(fid)
tline1 = fgets(fid);
tline2 = fgets(fid);
keystr = 'THE ANALYSIS HAS COMPLETED SUCCESSFULLY';
if contains(tline1,keystr ) || contains(tline2,keystr)
flag = 0;
fprintf('Running time = %d (s)\n',idletime)
break;
end
end
fclose(fid);
pause(1);
idletime = idletime + 1;
if idletime > 600 % 10 minutes
fprintf('Waste idle time = %d (s)\n',idletime)
error ('Too slow simulation (> 10 minutes). Please recheck your code');
end
end
  2 Comments
André Elvas
André Elvas on 3 May 2021
Thank you so much, I was going crazy trying to guess the Abaqus simulation time with a simple "pause()". This helped me a lot!
SorMun
SorMun on 16 Nov 2023
Hello Rafael
you can use the Matlab aas toolbox to connect to local/remote Fluent session
The toolbox is now availabe for download from Mathworks File Exchange at
You can stream the Fluent commands from your Matlab script. When you are done streaming you can shutdown Fluent from matlab using the terminate command
Sorinb

Sign in to comment.

Categories

Find more on Parallel Computing in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!