|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
[这个贴子最后由lyk302在 2008/02/02 09:37pm 第 1 次编辑]
[watermark]本人初学fluent,昨天看过一篇“如何在UDF中调用FORTAN子程序”的帖子还有fluent udf帮助文件后,试了一下午才把fortran的obj文件和fluent连接在一起。今天把整个过程整理了一下,来给新人作为参考,避免时间的浪费。有什么不足之处,还忘高人指点。具体怎么用c的宏调用fortran程序,还请参考“如何在UDF中调用FORTAN子程序”一贴。
下面有些路径是根据我自己的程序安装路径。
1)set environment variables for Fluent, C++, Fortran;
2)put sorce code file into ..\src folder, put compiled fortran .obj files into ..\ntx86\2d folder, copy sed.exe, user_nt.udf and makefile_nt.udf to the same folder as compiled fortran .obj files; (this two folders are created by yourself, you can put them under your case folder).
3)modify user_nt.udf file {follow the instructions. e.g. USER_OBJECTS = test.obj this obj file is the complied fortran .obj file ,SOURCES = $(SRC)test_use.c(c source file that is in the \src fold), VERSION = 2d(your model dimension), PARALLEL_NODE = none;
4)change the name of file makefile_nt.udf to makefile, modify makefile, (add this line "FLUENT_INC= D:\Fluent.Inc" below "UDFDATA = udf_names.c";
* 5)You might need to copy all the .lib files under Fortran\lib fold to folder D:\Fluent.Inc\fluent6.3.26\ntx86\Fortran_lib (this folder is created by myself) change this line "LIBS = /Libpath:$(FLUENT_INC)\fluent$(RELEASE)\$(FLUENT_ARCH)
\$(VERSION)" in the makefile file to "LIBS = /Libpath:$(FLUENT_INC)\fluent$(RELEASE)\$(FLUENT_ARCH)\$(VERSION)
D:\Fluent.Inc\fluent6.3.26\ntx86\Fortran_lib\*.lib"
6)Type "nmake" in the command line console, make sure the console is displaying the right path that is including your files such as: "makefile",".obj","sed.exe".
7)Put the generated .dll file with your .cas and .data files together.
* Step 5 is not necessary, if you met this: LINK : fatal error LNK1104: cannot open file "dfor.lib", do it.
[/watermark] |
|