|
[Sponsors] |
March 5, 2020, 17:06 |
Fluent-Matlab Linking
|
#1 |
New Member
Mohammadreza
Join Date: May 2019
Posts: 5
Rep Power: 6 |
Hello,
I want to run Fluent with Matlab and read a journal file with it. so I write this command in Matlab file: system('"D:\program file\Ansys 18.2\ANSYS Inc\v182\fluent\ntbin\win64\fluent.exe" 2d -t5 -i ******'); where ****** is the name of my journal file. The journal file contains a UDF compiling step. when I run Fluent in my system without using Matlab everything works fine, but when I using the Matlab, Fluent can't compile the UDF file properly. What's the problem? thanks, |
|
March 6, 2020, 03:29 |
Fluent in Matlab
|
#2 |
Senior Member
|
Fluent requires access to C compiler for compilation of UDF. This has to be made available when starting Fluent from within Matlab. I am not sure Matlab is up for it. So, there are at least two solutions
1. Compile the UDF a priori and let Fluent load it 2. Interpret the UDF, provided the UDF does not have elements that require compilation, such as structures Though not directly relevant, may I know the objective of linking Matlab and Fluent?
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
March 6, 2020, 05:38 |
|
#3 | |
New Member
Mohammadreza
Join Date: May 2019
Posts: 5
Rep Power: 6 |
Quote:
I have a CFD optimization problem so I want to link them. Do you know how I can compile a UDF with Visual Studio before using it in Fluent? I try it but VS could not compile a UDF. |
||
March 6, 2020, 05:58 |
UDF compilation
|
#4 |
Senior Member
|
VS is required to compile the UDF but VS alone cannot do it. Solution is to start Fluent from the VS Command Prompt and then compile it. Once compiled, you can use it any time.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
March 6, 2020, 06:14 |
|
#5 |
New Member
Mohammadreza
Join Date: May 2019
Posts: 5
Rep Power: 6 |
I have a parameter in the UDF that must be changed in the optimization procedure so, in every iteration, I have a different UDF!
|
|
March 6, 2020, 08:12 |
Little more work
|
#6 |
Senior Member
|
Then, you have to start VS Command Prompt from Matlab and start Fluent from within that.
Another option is to ensure that Fluent can find VS compiler. Fluent uses a file udf.bat that has paths given for VS compiler. If the path in the file is correct, Fluent started from anywhere can compile a UDF. If it is not, then Fluent has to be started from within VS prompt. A more sophisticated solution would be to define that variable as rp-var in Fluent. UDF can pick value of rp-var. That way, you don't have to compile the UDF again and again. Same UDF will work with different values of variable; that's the objective of coding, isn't it
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
March 9, 2020, 01:11 |
|
#7 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
use rpvar as parameter, so you don't need to recompile your code
__________________
best regards ****************************** press LIKE if this message was helpful |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Interfacing Matlab & Fluent: Loading case file | srsel6 | FLUENT | 4 | November 15, 2023 16:26 |
linking matlab and fluent | Nair | FLUENT | 23 | January 12, 2020 18:55 |
Method to set environment variables for linking ANSYS Fluent 19.1 and visual studio 1 | renrenxiong | ANSYS | 0 | November 13, 2019 07:17 |
force to wait MATLAB for running parallel fluent in batch mode | a.latifi | Main CFD Forum | 1 | May 9, 2013 16:44 |
Compiling and linking UDS in FLUENT 4.5 | Raja Banerjee | FLUENT | 1 | August 3, 2000 00:07 |