Fluent-Matlab Linking
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, |
Fluent in Matlab
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? |
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. |
UDF compilation
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.
|
Quote:
|
Little more work
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 :) |
use rpvar as parameter, so you don't need to recompile your code
|
All times are GMT -4. The time now is 23:41. |