找回密码
 注册
查看: 2988|回复: 2

[原创]UDF连接Fortran程序

[复制链接]
发表于 2008-2-2 21:35:16 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

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]
发表于 2009-5-31 18:18:53 | 显示全部楼层
我照楼主的步骤做了,怎么还是不行呀,还有呀,fluent6.3帮助上上的步骤怎么跟楼主的不太一样呀,他的好像是修改makefile文件,不是修改user-nt.udf文件呀?
发表于 2009-9-23 16:59:24 | 显示全部楼层
看帮助文档上面,自己考虑的结果是:
windows下面修改user-nt, Linux 下面修改makefile文件,不知对不?
fortran的obj文件在windows下面是 .obj
帮助文档也说的不是很明确,举的例子好像就是linux下面的。

[ 本帖最后由 wxymax 于 2009-9-23 09:01 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表