软件环境:
系统:windows10
软件:Fluent 2022 R2 +Visual Studio 2019
流程:
(首先是VS2019最好是默认路径安装并且路径中不能有中文)
倘若vs2019不是默认路径安装的话,需要在fluent的udf.bat文件中修改一下你的路径,这个很简单,所有的教程都有这个,此文字主要描述问题,不作赘述。
step0:安装好vs2019+fluent 2022 R2(建议先安装fluent 然后进入它的udf.bat文件中看看这个版本支持到vs多少,比如我这个就fluent就支持到vs2019最高了,2022不支持,所以我下载了2019)
step1:修改好之后,创建.c文件,然后copy一个没问题的udf内容之后,在导入.c文件的时候大概率会遇到一个经典问题:
造成这个问题的原因有很多,你的原因和我的原因可能不一样,但是术有万千而道不变。
方法是不变的,那就是尽量多的搜罗错误信息,尤其是有路径的错误信息。比如我这个里面有一条信息很关键,说是在xxxx/libudf.dll缺失,网上的大部分方法是get不到这个问题的,但是这是软件实实在在给出的。所以求道的能力是很关键的。
step2:把dll文件copy到相应的文件夹里的时候,可以正常导入(build),但是在load的时候报错了,具体情况如下:
关于这个问题,我在尝试了好久,查阅了国内外论坛之后发现了一段比较专业的总结,如下:
It appears that libudf is not located in the same folder as case file; it is not necessary but if it is not the case, then you have to provide full path to load. Second, go inside libudf and check if it has .dll files inside 3d_host 3d_node folders. If not, then library is not compiled. If it exists, then just copy libudf to the folder where case exists, use only the name of the library while loading, and it should work. If it does not, then please share a complete message showing compiling and loading.
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.
由于专业性和严谨性,不对此总结作出翻译(我不是不会,我能读懂,但是怕翻译错)。我的问题就是It appears that libudf is not located in the same folder as case file,我的.c文件没有和libudf文件在一个文件夹里。
到此篇文章的原创内容结束了,接下来会附加一些连接帮助大家解决问题.
UDF Error at Node 0: Error code: 126 -- CFD Online Discussion Forums
Fluent UDF 调试时中文乱码问题不优雅解决_fluent udf乱码-CSDN博客
四十九、Fluent UDF编译正确的流程_fluentudf程序-CSDN博客