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

Data Transferring and initialization between MATHLAB and FLUENT

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 8, 2018, 04:39
Default Data Transferring and initialization between MATHLAB and FLUENT
  #1
Senior Member
 
Mehdi Asghari
Join Date: Feb 2010
Posts: 127
Rep Power: 16
Asghari_M is on a distinguished road
Hello all.

I need to initialize and transfer some data between MATHLAB and FLUENT in a loop state according to the attached algorithm (image).

In the every time step, a re-initialization is accomplished by MATHLAB and results are fed to the FLUENT as input.

Then, after the flow simulations in FLUENT section, the fluid flow data and some parameters are exported to the MATHLAB section in the next time step as inputs for MATHLAB.

However, I don't know whether it is feasible or not. Does everyone know how to call and transfer data between these two software?

Also, if everybody has access to an example/examples describing these schemes, please share it here or via private message.

Thanks a lot for any attention.

M.Asghari
Attached Images
File Type: jpg MATHLAB-FLUENT.jpg (47.7 KB, 26 views)
Asghari_M is offline   Reply With Quote

Old   December 9, 2018, 18:27
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,763
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Initialize means something specific in Fluent. Why are you initializing every time-step? Then there's no point in doing a transient simulation and taking time-steps.


Be specific on what it is you want to accomplish.


You are saying I want matlab to do something then Fluent to do something then matlab to do something. Without knowing what that something is, no one can help you.


Fluent can export many things into text files that matlab can read. For more advanced scenarios, matlab can even directly access the fluent cortex and have access to all of Fluent's runtime information... So yes it's possible.


Being a high level programming language, I can imagine that yes you can code something in a format that Fluent can read.


But nobody here has any clues on how to help you.


The answer is yes, it's possible. But good luck finding out how!
LuckyTran is offline   Reply With Quote

Old   December 10, 2018, 04:13
Default
  #3
Member
 
Peter Maroul
Join Date: May 2018
Posts: 52
Rep Power: 8
Pmaroul is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
Initialize means something specific in Fluent. Why are you initializing every time-step? Then there's no point in doing a transient simulation and taking time-steps.


Be specific on what it is you want to accomplish.


You are saying I want matlab to do something then Fluent to do something then matlab to do something. Without knowing what that something is, no one can help you.


Fluent can export many things into text files that matlab can read. For more advanced scenarios, matlab can even directly access the fluent cortex and have access to all of Fluent's runtime information... So yes it's possible.


Being a high level programming language, I can imagine that yes you can code something in a format that Fluent can read.


But nobody here has any clues on how to help you.


The answer is yes, it's possible. But good luck finding out how!
Since, the user exits FLUENT in the every time step, it is necessary to save the last time step data for the MATLAB solver. Not really starting the solution in the time step (T=0) in each time. This concept is usually called Re-initialization in the programming.
Pmaroul is offline   Reply With Quote

Old   December 10, 2018, 05:29
Default
  #4
Senior Member
 
Mehdi Asghari
Join Date: Feb 2010
Posts: 127
Rep Power: 16
Asghari_M is on a distinguished road
In the general text format, the command lines are presented as follows:

1- The mesh generation& the initialization in the time =0

2- A do loop command as follows:

2-1 MATLAB running (by data files in 2-2 section or initialization step ) and generating some case data

2-2 FLUENT running by case files generated into the 2-1 section (last step)& generating some data Files


3- Updating the time step: Tnew= T last+ deltaT (physical Time)

4 If unsteady simulations are enough and convergence is ok,

4-1: break do loop command and END
Else if

4-2 : Returning to Section 2

This is a text version of my algorithm.

However, I don't know which programming language/languages is/are used for this purpose.
Asghari_M is offline   Reply With Quote

Old   December 10, 2018, 11:13
Default
  #5
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,763
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Quote:
Originally Posted by Pmaroul View Post
Since, the user exits FLUENT in the every time step, it is necessary to save the last time step data for the MATLAB solver. Not really starting the solution in the time step (T=0) in each time. This concept is usually called Re-initialization in the programming.

Yes I understood that the concept that is initializing at every time-step and how stupid of an idea it was. Coincidentally, that's not what they're trying to do!



Quote:
Originally Posted by Asghari_M View Post

2-1 MATLAB running (by data files in 2-2 section or initialization step ) and generating some case data

2-2 FLUENT running by case files generated into the 2-1 section (last step)& generating some data Files
You just re-wrote everything in pseudo-code.

Assuming Fluent converges nicely, please elaborate on what data you'd like to transfer from Fluent to matlab. Also please elaborate on what settings matlab is giving Fluent. It can be done... Everything else can be done and can be coded in matlab.
LuckyTran is offline   Reply With Quote

Old   December 10, 2018, 13:27
Default
  #6
Senior Member
 
Mehdi Asghari
Join Date: Feb 2010
Posts: 127
Rep Power: 16
Asghari_M is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
Yes I understood that the concept that is initializing at every time-step and how stupid of an idea it was. Coincidentally, that's not what they're trying to do!





You just re-wrote everything in pseudo-code.

Assuming Fluent converges nicely, please elaborate on what data you'd like to transfer from Fluent to matlab. Also please elaborate on what settings matlab is giving Fluent. It can be done... Everything else can be done and can be coded in matlab.
You just repeat my question,again.
I would not ask my question if I knew the answer to my question.
Asghari_M is offline   Reply With Quote

Old   December 10, 2018, 13:39
Default
  #7
Senior Member
 
Mehdi Asghari
Join Date: Feb 2010
Posts: 127
Rep Power: 16
Asghari_M is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
Yes I understood that the concept that is initializing at every time-step and how stupid of an idea it was. Coincidentally, that's not what they're trying to do!





You just re-wrote everything in pseudo-code.

Assuming Fluent converges nicely, please elaborate on what data you'd like to transfer from Fluent to matlab. Also please elaborate on what settings matlab is giving Fluent. It can be done... Everything else can be done and can be coded in matlab.
Anyway, maybe some programming methods/languages can be useful as follows:

1- Running in the batch mode.
2- saving Fluent data in a file and reading them by MATLAB. ( though it may be a little time consuming)

Some useful Links are presented as follows:
1-https://www.cfd-online.com/Forums/fluent/30911-running-fluent-batch-mode-windows-os.html

2-https://www.cfd-online.com/Forums/fluent/81301-use-batch-mode-run-unsteady-case.html

3-https://www.cfd-online.com/Forums/fluent-udf/196083-fluent-journal-reading-case-data-via-loop.html

4-https://www.cfd-online.com/Forums/fluent-udf/196083-fluent-journal-reading-case-data-via-loop.html

5-https://www.cfd-online.com/Forums/fluent/71016-how-link-fluent-matlab-exchange-data.html

and... .

The point is, which items can be effective and useful in my task?

Last edited by Asghari_M; December 10, 2018 at 19:28.
Asghari_M is offline   Reply With Quote

Old   December 10, 2018, 21:06
Default
  #8
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
google "fluent as server"
you may find the way, how to connect fluent with matlab.
Once connectino is done matlab is able to execute TUI commands -> so you can do a lot in Fluent

best regards
Asghari_M likes this.
AlexanderZ is offline   Reply With Quote

Old   December 12, 2018, 05:49
Default Coupling FLUENT with MATLAB
  #9
Senior Member
 
Mehdi Asghari
Join Date: Feb 2010
Posts: 127
Rep Power: 16
Asghari_M is on a distinguished road
Thanks Sirs.

According to the attached image and google search information ,Apparently, to access TUI, it should be done by FLUENT remote console. Shouldn't it?

Does anyone have tutorials for more description of coupling the FLUENT software with other programming language such as MATLAB?

Should we use Pyton if we want execute MATLAB in command line by TUI in a loop state format?
Attached Images
File Type: jpg Fluent server or remote.jpg (138.0 KB, 8 views)
Asghari_M is offline   Reply With Quote

Old   December 12, 2018, 06:13
Default
  #10
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
looking for a smart interface matlab fluent

best regards
AlexanderZ is offline   Reply With Quote

Old   January 17, 2019, 12:22
Default Is it possible running Fluent 6.3.26 through Matlab 6.5?
  #11
Senior Member
 
Mehdi Asghari
Join Date: Feb 2010
Posts: 127
Rep Power: 16
Asghari_M is on a distinguished road
Hello again .

I tried running the Fluent by Matlab via following link:

looking for a smart interface matlab fluent

However -aas command doesn't operate effectively and correctly in the software versions.

My Fluent version :6.3.26 & Matlab version : 6.5

Can anyone help me to find a practical and suitable alternative for this purpose for my software versions?

Thanks a lot again.

Last edited by Asghari_M; January 17, 2019 at 15:41.
Asghari_M is offline   Reply With Quote

Reply

Tags
iteration process, solver linking


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



All times are GMT -4. The time now is 08:39.