1、ANSYS 15.0 fluent udf 环境变量的设置初学 udf,还没进入主题就被 udf 问题搞死了, 摸索了一两天终于让我搞出了点名堂,本人用的是 ANSYS 15.0 和 vc 10.0.不多说,先把ANSYS 和 vc 都装上,网上有教程安装的,一步步来别跳步。最好把 vc6也装一下, 因为里面有的东西设置环境变量要用到。 先不要打开软件。设置环境变量:1. C:Program FilesANSYS Incv150fluentntbinwin64 目录下双击setenv和 remenv 2.设置环境变量:INCLUDE C:Program Files (x86)Microsoft
2、 Visual Studio 10.0VCinclude;C:Program Files (x86)Microsoft SDKsWindowsv7.0AInclude; LIB C:Program Files (x86)Microsoft Visual Studio 10.0VClibamd64;C:Program Files (x86)Microsoft SDKsWindowsv7.0ALibx64;C:Program Files (x86)Microsoft Visual Studio 10.0VCatlmfclib; PATH C:Program Files (x86)Microsoft
3、 Visual Studio 10.0VCbinamd64;C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDE; 找个 udf 文件,注意 udf 是支持三维还是二维的,打开 fluent , 设置工作目录。如下:接着就是编译了,不用打开 case的,直接就可以 define . 如果出现什么 xcopy .我们找到 C:WindowsSystem32 里面的 xcopy 复制到C:Program Files (x86)Microsoft Visual Studio 10.0VCbin ;C:Program Files (x8
4、6)Microsoft Visual Studio 10.0VCbinamd64 ;如果出现 “ size_t ” : 重定义;不同的基类型,可能是你的 udf 文件有问题。如果实在不行,按照下面的环境变量重新设置一下,重启电脑。INCLUDE C:Program Files (x86)Microsoft Visual Studio 10.0VCinclude;C:Program Files (x86)Microsoft SDKsWindowsv7.0AInclude; LIB C:Program Files (x86)Microsoft Visual Studio 10.0VClibamd6
5、4;C:Program Files (x86)Microsoft SDKsWindowsv7.0ALibx64; C:Program Files (x86)Microsoft Visual Studio 10.0VCatlmfclib; PATH C:Program Files (x86)Microsoft Visual Studio 10.0VCbin;C:Program Files (x86)Microsoft Visual Studio 10.0VCbinamd64;C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDE;C
6、:Program Files (x86)Microsoft Visual Studio 10.0Common7Tools;c:program filesansys incv150fluentntbinwin64 4.1 Problem with nmake According to the manual, I wrote a C code, saved it in my working folder , added it, clicked Build. and then I saw this: (system “copy “C:PROGRA1ANSYSI1v140fluent“fluent14
7、.0.0sr cmakefile_nt.udf “examplewin642dmakefile“ “) 1 file(s) copied. (chdir “example“)() (chdir “win642d“)() nmake is not recognized as an internal or external command, operable program or batch file. nmake is not recognized as an internal or external command, operable program or batch file. Done.4
8、.2 Solution to the nmake problemWithout any detail, the problem is caused because nmake.exe cannot be found. The solution is to start Fluent from the x64 version of the Visual Studio 2013 Command Prompt: 1. Open the Start screen (press Windows button on your keyboard) 2. Type Visual Studio Tools , c
9、lick the folder . 3. In the folder click and start VS2013 x64 Cross Tools Command Prompt 4. Navigate to your working folder , i.e. the folder where your case and data files are (.cas ) and after that paste the address of your Fluent executable, i.e. add to the end of the Path variable ;C: 7. Add to
10、the end the folder where the vcvarsx86_amd64.bat file of your Visual Studio 12 is found. By default this is: ;C:Program Files (x86)Microsoft Visual Studio 12.0VCbinx86_amd64 8. Click OK and OK your way out of the My computer properties. You are all set hopefully. This will enable you to start fluent
11、 by simply typing the command “fluent“ in your command prompt. You can also add the 2D and 3D executables separately to the Path variable. 8. Remarks and disclaimerI would like to emphasize that I am in no way an expert in CFD/C+/UDFs/Windows SDK, only a beginner user . I do not take any responsibil
12、ity for anything described or suggested on this page, or any damage caused by following these steps. This is merely a summary of my experiences with my system, and I cannot guarantee that the solutions will work in any other setup (or with this setup on other systems). However , I do hope that some
13、will find it useful and some people will save many hours of searching for the solutions. Kind regards, 用户变量FLUENT_INC c:program filesansys incv140fluent ICEM_ACN C:Program FilesANSYS Incv140icemcfdwin64_amd include d:Program Files (x86)Microsoft Visual Studio 10.0VCinclude;C:Program Files (x86)Micro
14、soft SDKsWindowsv7.0AInclude; lib d:Program Files (x86)Microsoft Visual Studio 10.0VClibamd64;C:Program Files (x86)Microsoft SDKsWindowsv7.0ALibx64 MSDevDir D:Program Files (x86)Microsoft Visual StudioCommonMSDev98 Path d:Program Files (x86)Microsoft Visual Studio 10.0VCbinamd64;d:Program Files (x86
15、)Microsoft Visual Studio 10.0Common7IDE; PVX_INSTALL_DIR D:proe_GB_kuMONLibs TEMP %USERPROFILE%AppDataLocalTemp TMP %USERPROFILE%AppDataLocalTemp 系统变量ADSK_3DSMAX_x64_2014 C:Program FilesAutodesk3ds Max 2014 ANSYS_SYSDIR winx64 ANSYS_SYSDIR32 win32 ANSYS140_DIR C:Program FilesANSYS Incv140ANSYS ANSYS
16、LIC_DIR C:Program FilesANSYS IncShared FilesLicensing AWP_LOCALE130 en-us AWP_ROOT140 C:Program FilesANSYS Incv140 CADOE_DOCDIR140 C:Program FilesANSYS Incv140CommonFileshelpen-ussolviewer CADOE_LIBDIR140 C:Program FilesANSYS Incv140CommonFilesLanguageen-us CM2014DIR C:Program Files (x86)Common File
17、sAutodesk SharedMaterials ComSpec %SystemRoot%system32cmd.exe D:Program Files (x86)Microsoft Visual StudioVC98Bin; C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDE; D:Program Files (x86)Microsoft Visual StudioVC98Lib; C:Program Files (x86)Microsoft SDKsWindowsv7.0ALibx64 DEVMGR_SHOW_DETAI
18、LS 1 FP_NO_HOST_CHECK NO ICEMCFD_ROOT140 C:Program FilesANSYS Incv140icemcfd IDTCOMMON C:Program FilesCommon FilesIDT ILBDIR C:Program Files (x86)Common FilesAutodesk SharedMaterials ILMDIR C:Program Files (x86)Common FilesAutodesk SharedMaterials include d:Program Files (x86)Microsoft Visual Studio
19、 10.0VCinclude;C:Program Files (x86)Microsoft SDKsWindowsv7.0AInclude; lib d:Program Files (x86)Microsoft Visual Studio 10.0VClibamd64;C:Program Files (x86)Microsoft SDKsWindowsv7.0ALibx64 LSTC_LICENSE ANSYS MONLIBS_DIR D:proe_GB_kuMONLibs NUMBER_OF_PROCESSORS 4 OS Windows_NT P_SCHEMA C:Program File
20、sANSYS Incv140AISOLCADIntegrationParasolidPSchema path d:Program Files (x86)Microsoft Visual Studio 10.0VCbinamd64;d:Program Files (x86)Microsoft Visual Studio 10.0Common7IDE; PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC pro_library_dir D:proe_GB_ku PROCESSOR_ARCHITECTURE AMD64 PROCESSOR_IDENTIFIER Intel64 Family 6 Model 42 Stepping 7, GenuineIntel PROCESSOR_LEVEL 6 PROCESSOR_REVISION 2a07 PSModulePath %SystemRoot%system32WindowsPowerShellv1.0Modules TEMP C:temp TMP C:temp VS100COMNTOOLS D:Program Files (x86)Microsoft Visual Studio 10.0Common7Tools