CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Data Transferring and initialization between MATHLAB and FLUENT (https://www.cfd-online.com/Forums/fluent-udf/212754-data-transferring-initialization-between-mathlab-fluent.html)

Asghari_M December 8, 2018 03:39

Data Transferring and initialization between MATHLAB and FLUENT
 
1 Attachment(s)
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

LuckyTran December 9, 2018 17:27

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!

Pmaroul December 10, 2018 03:13

Quote:

Originally Posted by LuckyTran (Post 718546)
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.

Asghari_M December 10, 2018 04:29

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.

LuckyTran December 10, 2018 10:13

Quote:

Originally Posted by Pmaroul (Post 718577)
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 (Post 718602)

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.

Asghari_M December 10, 2018 12:27

Quote:

Originally Posted by LuckyTran (Post 718654)
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 December 10, 2018 12:39

Quote:

Originally Posted by LuckyTran (Post 718654)
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?

AlexanderZ December 10, 2018 20:06

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 December 12, 2018 04:49

Coupling FLUENT with MATLAB
 
1 Attachment(s)
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?

AlexanderZ December 12, 2018 05:13

https://www.cfd-online.com/Forums/fl...ab-fluent.html

best regards

Asghari_M January 17, 2019 11:22

Is it possible running Fluent 6.3.26 through Matlab 6.5?
 
Hello again .

I tried running the Fluent by Matlab via following link:

https://www.cfd-online.com/Forums/fl...ab-fluent.html

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.


All times are GMT -4. The time now is 23:44.