fluentudf环境变量的设置.docx
《fluentudf环境变量的设置.docx》由会员分享,可在线阅读,更多相关《fluentudf环境变量的设置.docx(11页珍藏版)》请在冰豆网上搜索。
fluentudf环境变量的设置
ANSYS15.0fluentudf环境变量的设置
初学udf,还没进入主题就被udf问题搞死了,摸索了一两天终于让我搞出了点名堂,本人用的是ANSYS15.0和vc10.0.不多说,先把ANSYS和vc都装上,网上有教程安装的,一步步来别跳步。
最好把vc6也装一下,因为里面有的东西设置环境变量要用到。
先不要打开软件。
设置环境变量:
1.C:
\ProgramFiles\ANSYSInc\v150\fluent\ntbin\win64目录下双击setenv和remenv
2.设置环境变量:
INCLUDE
C:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\include;C:
\ProgramFiles(x86)\MicrosoftSDKs\Windows\v7.0A\Include;
LIB
C:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\lib\amd64;C:
\ProgramFiles(x86)\MicrosoftSDKs\Windows\v7.0A\Lib\x64;C:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\atlmfc\lib;
PATH
C:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\bin\amd64;C:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\Common7\IDE;
找个udf文件,注意udf是支持三维还是二维的,打开fluent,设置工作目录。
如下:
接着就是编译了,不用打开case的,直接就可以define….
如果出现什么xcopy….我们找到C:
\Windows\System32里面的xcopy复制到
C:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\bin;
C:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\bin\amd64;
如果出现“size_t”:
重定义;不同的基类型,可能是你的udf文件有问题。
如果实在不行,按照下面的环境变量重新设置一下,重启电脑。
INCLUDEC:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\include;C:
\ProgramFiles(x86)\MicrosoftSDKs\Windows\v7.0A\Include;
LIBC:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\lib\amd64;C:
\ProgramFiles(x86)\MicrosoftSDKs\Windows\v7.0A\Lib\x64;C:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\atlmfc\lib;
PATHC:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\bin;C:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\bin\amd64;C:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\Common7\IDE;C:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\Common7\Tools;c:
\programfiles\ansysinc\v150\fluent\ntbin\win64
4.1Problemwith'nmake'?
Accordingtothemanual,IwroteaCcode,saveditinmyworkingfolder,addedit,clickedBuild...andthenIsawthis:
1file(s)copied.
(chdir"example")()
(chdir"win64\2d")()
'nmake'isnotrecognizedasaninternalorexternalcommand,
operableprogramorbatchfile.
'nmake'isnotrecognizedasaninternalorexternalcommand,
operableprogramorbatchfile.
Done.
4.2Solutiontothe'nmake'problem
Withoutanydetail,theproblemiscausedbecausenmake.execannotbefound.ThesolutionistostartFluentfromthex64versionoftheVisualStudio2013CommandPrompt:
1.Openthe?
Startscreen?
(pressWindowsbuttononyourkeyboard)
2.Type'VisualStudioTools',clickthefolder.
3.Inthefolderclickandstart'VS2013x64CrossToolsCommandPrompt'
4.Navigatetoyourworkingfolder,i.e.thefolderwhereyourcaseanddatafilesare(.cas&.dat).
6.MakesurethatontheEnvironmenttab'SetupCompilationEnvironmentforUDF'isticked.Thedefaultaddressisfine.
StartingFluentthiswayshouldsolvethe'nmake'problemandthecompilationmessageshouldlooklikethis:
1file(s)copied.
(chdir"exex")()
(chdir"win64\2d")()
#Generatingud_io1.h
velocity_profile.c
#Generatingudf_names.cbecauseofmakefilevelocity_profile.obj
udf_names.c
#Linkinglibudf.dllbecauseofmakefileuser_nt.udfudf_names.objvelocity_profile.obj
Copyright(C)MicrosoftCorporation.Allrightsreserved.
Creatinglibrarylibudf.libandobjectlibudf.exp
Done.
5.1Problemwithx64system
IncaseyoudonothaveMicrosoftVisualStudio2013ExpressthenlikelyyoutriedstartingFluentfromthe'VisualStudioCommandPrompt(2010)'oranyotherpreviousversionofVScommandprompt.ItislikelythatyouencounteredaproblemwhenclickingLoad,specificallythisone:
TheUDFlibraryyouaretryingtoload(libudf)isnotcompiledfor2donthecurentplatform(win64).
Thesystemcannotfindthefilespecified.
X:
\libudf\win64\2d\libudf.dll
ThereasonofthiserroristhatpreviousversionsofVisualStudioare32bitanddonotworkwithyourx64versionofFluent.YouprobablygoogledtheproblemandfoundadvicetostartFluentfromthecommandpromtoftheSDK(SoftwareDevelopmentKit)7.0/7.1instead,orfromthecommandpromptofthe.NETFramework.Unfortunately,asMicrosoftstatesontheirwebsiteatthe?
WindowsSDK8.1downloadpage:
"TheWindowsSDKnolongershipswithacompletecommand-linebuildenvironment.Youmustinstallacompilerandbuildenvironmentseparately.Ifyourequireacompletedevelopmentenvironmentthatincludescompilersandabuildenvironment,youcandownloadVisualStudio2013,whichincludestheappropriatecomponentsoftheWindowsSDK."
Olderversionsofthe.NETFrameworkandSDKdonotseemtoworkproperlyonWindows8.1([citationneeded],justmyexperience?
?
).Ialsofoundoutthatwithaworkingx64SDKinstalledyoucanstartthesimplewindowscommandprompt(cmd.exe)withtheproperenvironmentalvariablesusingacmd.exe/k""command,whichIfailedtogettowork.
5.2Solutiontotheproblemofx64system
ThesolutiontothisistostartFluentfromthex64commandprompt'VS2013x64CrossToolsCommandPrompt'asdescribedin(4.1)insteadofpreviousversionsofVSorSDK/.NETcommandprompts.
6.1Problemwithmath.h
AnotherproblemoccurredevenafterIhadeverythingsetup.Thisproblemwasreportedbycfd-onlineuserKITetimaaswellin?
thisforumtopic.
Theverysimpleccodetoinitializethevelocityontheinletboundarytoagivenvelocityprofiledidnotcompile,andthefollowingerrormessageappeared:
C:
\ProgramFiles(x86)\MicrosoftVisualStudio12.0\VC\INCLUDE\math.h(482):
errorC2059:
syntaxerror:
','
C:
\ProgramFiles(x86)\MicrosoftVisualStudio12.0\VC\INCLUDE\math.h(482):
errorC2143:
syntaxerror:
missing')'before'constant'
C:
\ProgramFiles(x86)\MicrosoftVisualStudio12.0\VC\INCLUDE\math.h(482):
errorC2143:
syntaxerror:
missing'{'before'constant'
C:
\ProgramFiles(x86)\MicrosoftVisualStudio12.0\VC\INCLUDE\math.h(482):
errorC2059:
syntaxerror:
'constant'
C:
\ProgramFiles(x86)\MicrosoftVisualStudio12.0\VC\INCLUDE\math.h(482):
errorC2059:
syntaxerror:
')'
Done.
Icouldnotfigureoutexactlywhatistheproblem,butitseemsthattheheaderfilemath.hprovidedbyVS2013hassomemistakes,orsomehowisn'tcompatiblewithFluent14(andFluent14.5).
FirstItriedtogivethemath.hheaderfilefortheUDFmyselfintheHeadersection(seeFigureabove),however,thecompilerstillusedthemath.hfilethatislocatedinC:
\ProgramFiles(x86)\MicrosoftVisualStudio12.0\VC\include.
6.2Solutiontotheproblemwithmath.h
1.Keepthesoftwareinstalledonyourcomputer,butalsoinstall?
MicrosoftVisualC++2010Express
2.Gotothefollowingfolder:
C:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\include
3.Fromthisfoldercopythemath.hfileto
C:
\ProgramFiles(x86)\MicrosoftVisualStudio12.0\VC\include
4.StartFluentasdescribedabovein(4.2).NowyouwillbeusingVS2013ascompilerbutthemath.hfilefromVS2010,whichworkedfineforme.
7.SettingtheEnvironmentalVariables?
Manypagesthatyoufinddealingwiththeproblemgivesuggestionslike"makesureyourenvironmentalvariablesareset".However,itisnotclearhowtodothat.Isucceededfinallyatmakingitwork,however,beforethatImanagedtoruinmyWindowsandIneededanetworkregistryoperationtofixit,sofirstofall:
0.?
DONOTDELETEORMODIFYWHATISALREADYINTHE'PATH'VARIABLE.
1.Rightclickon?
'Mycomputer'/'ThisPC'?
andclick?
'Properties'
2.Ontheleftsideofthescreenclick?
'Advancedsystemsettings'
3.Onthebottomclick?
'Environmentalvariables'
4.InthebottomboxlookfortheVariablenamed?
'Path',selectitandclick?
'Edit'
5.Becarefulnottomodifyanythingthatisalreadythere.
6.Attheend,putasemicolon(;)andafterthatpastetheaddressofyourFluentexecutable,i.e.addtotheendofthePathvariable
;C:
\
7.Addtotheendthefolderwherethe'vcvarsx86_amd64.bat'fileofyourVisualStudio12isfound.Bydefaultthisis:
;C:
\ProgramFiles(x86)\MicrosoftVisualStudio12.0\VC\bin\x86_amd64
8.ClickOKandOKyourwayoutoftheMycomputerproperties.Youareallsethopefully.
Thiswillenableyoutostartfluentbysimplytypingthecommand"fluent"inyourcommandprompt.Youcanalsoaddthe2Dand3DexecutablesseparatelytothePathvariable.
8.Remarksanddisclaimer
IwouldliketoemphasizethatIaminnowayanexpertinCFD/C++/UDFs/WindowsSDK,onlyabeginneruser.Idonottakeanyresponsibilityforanythingdescribedorsuggestedonthispage,oranydamagecausedbyfollowingthesesteps.Thisismerelyasummaryofmyexperienceswithmysystem,andIcannotguaranteethatthesolutionswillworkinanyothersetup(orwiththissetuponothersystems).
However,Idohopethatsomewillfinditusefulandsomepeoplewillsavemanyhoursofsearchingforthesolutions.
Kindregards,
用户变量
FLUENT_INC
c:
\programfiles\ansysinc\v140\fluent
ICEM_ACN
C:
\ProgramFiles\ANSYSInc\v140\icemcfd\win64_amd
include
d:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\include;C:
\ProgramFiles(x86)\MicrosoftSDKs\Windows\v7.0A\Include;
lib
d:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\lib\amd64;C:
\ProgramFiles(x86)\MicrosoftSDKs\Windows\v7.0A\Lib\x64
MSDevDir
D:
\ProgramFiles(x86)\MicrosoftVisualStudio\Common\MSDev98
Path
d:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\bin\amd64;d:
\ProgramFiles(x86)\MicrosoftVisualStudio10.0\Common7\IDE;
PVX_INSTALL_DIR
D:
\proe_GB_ku\MONLibs\
TEMP
%USERPROFILE%\AppData\Local\Temp
TMP
%USERPROFILE%\AppData\Local\Temp
系统变量
ADSK_3DSMAX_x64_2014
C:
\ProgramFiles\Autodesk\3dsMax2014\
ANSYS_SYSDIR
winx64
ANSYS_SYSDIR32
win32
ANSYS140_DIR
C:
\ProgramFiles\ANSYSInc\v140\ANSYS
ANSYSLIC_DIR
C:
\ProgramFiles\ANSYSInc\SharedFiles\Licensing
AWP_LOCALE130
en-us
AWP_ROOT140
C:
\ProgramFiles\ANSY