Linking FLUENT with visual C++ (Tested on 32Bit OS)
Tags compile, linking, udf, visual c++
In general, there are 2 different ways to link FLUENT with VC++. In both methods, we need to add fluent to system path which can be easilly done via executing "setenv.exe" which is in FLUENT installation folder.
1) non-permanent method:
In this method, we need to launch FLUENT by VC++ command prompt (which can be found in tools folder of VC++) by simply typing fluent.
In this method, we have to launch FLUENT in this manner whenever we want to compile a UDF.
2) permanent method:
In this method we can link FLUENT with VC++ forever and FLUENT can be started normally via double-clicking its shortcut! The below instruction should be done once and then everything would be OK for further use.
- add below variables to path (user variables):
C:\Program Files\Microsoft Visual Studio 8(Here is your version)\VC\bin;
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
- Finally, add the new variables to the system variables.
variable name : INCLUDE
variable value : C:\Program Files\Microsoft Visual Studio 8\VC\include
variable name : LIB
variable value : C:\Program Files\Microsoft Visual Studio 8\VC\lib
Obviously, the above paths are just examples; you have to find corresponding folder paths in your system and then add them accordingly.
PS: To change or add new variables to your system path follow this:
get properties of "my computer" -> advance system settings -> environment variables.
Enjoy!
1) non-permanent method:
In this method, we need to launch FLUENT by VC++ command prompt (which can be found in tools folder of VC++) by simply typing fluent.
In this method, we have to launch FLUENT in this manner whenever we want to compile a UDF.
2) permanent method:
In this method we can link FLUENT with VC++ forever and FLUENT can be started normally via double-clicking its shortcut! The below instruction should be done once and then everything would be OK for further use.
- add below variables to path (user variables):
C:\Program Files\Microsoft Visual Studio 8(Here is your version)\VC\bin;
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
- Finally, add the new variables to the system variables.
variable name : INCLUDE
variable value : C:\Program Files\Microsoft Visual Studio 8\VC\include
variable name : LIB
variable value : C:\Program Files\Microsoft Visual Studio 8\VC\lib
Obviously, the above paths are just examples; you have to find corresponding folder paths in your system and then add them accordingly.
PS: To change or add new variables to your system path follow this:
get properties of "my computer" -> advance system settings -> environment variables.
Enjoy!
Total Comments 4
Comments
-
Hello Amir,
I am extremely excited after reading your thread which corresponds a little to my concern i.e. CFD Automation.
I am a Novice here and I know that I will not take much time to understand the basics of it.
May I know which programming language is accepted by Fluent and CFX?
And do we write UDF to solver alone or can be written to meshing and boundary conditions?
Thanking you.Posted June 20, 2012 at 09:47 by sumit_raised -
Quote:Hello Amir,
I am extremely excited after reading your thread which corresponds a little to my concern i.e. CFD Automation.
I am a Novice here and I know that I will not take much time to understand the basics of it.
May I know which programming language is accepted by Fluent and CFX?
And do we write UDF to solver alone or can be written to meshing and boundary conditions?
Thanking you.
The programming language for FLUENT is C and it can be used to have some modifications in both solvers or BCs. but for automation you will need an input file (journal file) which can be generated via any program.
Bests,
AmirPosted June 20, 2012 at 09:55 by Amir -
Hello Amir
Thank you for your comments but I tried the second method many times and no healing was found. I received the below error continuously:
'nmake' is not recognized as an internal or external command,operable program or batch file.
P.s: I have a windows 7 professional 64 bit with Fluent 64 bit. I also installed both Visual Studio 8 and 10 versions.
I simply added the four addresses (according to my case) to environment variable and then executed the file "Setenv.exe". Regarding to the first method, I didn't find "tools folder" in my VC++, so I just tried the second method.
I'll be very very grateful if you give me a hand to get rid of this problem. I can interpret my UDF file but because it's a big one I need to compile it.
Good luckPosted April 3, 2013 at 04:08 by A CFD free user -
Quote:Hello Amir
Thank you for your comments but I tried the second method many times and no healing was found. I received the below error continuously:
'nmake' is not recognized as an internal or external command,operable program or batch file.
P.s: I have a windows 7 professional 64 bit with Fluent 64 bit. I also installed both Visual Studio 8 and 10 versions.
I simply added the four addresses (according to my case) to environment variable and then executed the file "Setenv.exe". Regarding to the first method, I didn't find "tools folder" in my VC++, so I just tried the second method.
I'll be very very grateful if you give me a hand to get rid of this problem. I can interpret my UDF file but because it's a big one I need to compile it.
Good luck
Firstly, you can find VC++ tools and command prompt from start menu and program list. If it's not useful, you have to use other tools in 64bit OS, I think you've got to use SDK too. As stated, these procedures were tested on 32bit OS; so you can find more precise notes for your purpose.
Take a look here: (http://www.cfd-online.com/Wiki/Fluen...ows_7_64bit.3F)
Bests,Posted April 3, 2013 at 06:13 by Amir
Updated May 25, 2013 at 06:04 by Amir