udf編譯
A. fluent udf配置編譯報錯,急求啊,調試一天半了,要瘋了
這個是標准方法:
Fluent13+若安裝的是VS 2010, 在C盤,那麼環境變數(INCLUDE, LIB, Path)是:
32位計算機:
1,右鍵「我的電腦」—屬性—高級—環境變數
2,在fluent安裝文件夾下雙擊setenv.exe 點「是」(C:\Program Files\ANSYS Inc\v130\fluent\ntbin\setenv.exe)
INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include
LIB =C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib
Path=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
64位:位計算機:
1,右鍵「我的電腦」—屬性—高級—環境變數
2,在fluent安裝文件夾下雙擊setenv.exe 點「是」(C:\Program Files\ANSYS Inc\v130\fluent\ntbin\win64\setenv.exe)
INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include
LIB =C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\x64
Path=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
B. FLUENT中udf的程序編譯為什麼總是出現parse error
高手幫我也看一下,我抄的教程上的程序,編譯也出現語法錯誤,求指教!
#include "udf.h"
static real viscosity_0;
DEFINE_INIT(melt_setup, domain)
{
/* if memory for the particle variable titles has not been
* allocated yet, do it now */
if (NULLP(user_particle_vars)) Init_User_Particle_Vars();
/* now set the name and label */
strcpy(user_particle_vars[0].name,"melting-index");
strcpy(user_particle_vars[0].label,"Melting Index");
}
/* update the user scalar variables */
DEFINE_DPM_SCALAR_UPDATE(melting_index, cell, thread, initialize, p)
{
cphase_state_t *c = &(p->cphase);
if (initialize)
{
/* this is the initialization call, set:
* p->user[0] contains the melting index, initialize to 0
* viscosity_0 contains the viscosity at the start of a time step*/
p->user[0] = 0.;
viscosity_0 = c->mu;
}
else
{
/* use a trapezoidal rule to integrate the melting index */
p->user[0] += P_DT(p) * .5 * (1/viscosity_0 + 1/c->mu);
/* save current fluid viscosity for start of next step */
viscosity_0 = c->mu;
}
}
/* write melting index when sorting particles at surfaces */
DEFINE_DPM_OUTPUT(melting_output, header, fp, p, thread, plane)
{
char name[100];
if (header)
{
if (NNULLP(thread))
cxprintf(fp,"(%s %d)\n",thread->head->dpm_summary.sort_file_name,11);
else
cxprintf(fp,"(%s %d)\n",plane->sort_file_name,11);
cxprintf(fp,"(%10s %10s %10s %10s %10s %10s %10s"
" %10s %10s %10s %10s %s)\n",
"X","Y","Z","U","V","W","diameter","T","mass-flow",
"time","melt-index","name");
}
else
{
sprintf(name,"%s:%d",p->injection->name,p->part_id);
cxprintf(fp,
"((%10.6g %10.6g %10.6g %10.6g %10.6g %10.6g "
"%10.6g %10.6g %10.6g %10.6g %10.6g) %s)\n",
p->state.pos[0], p->state.pos[1], p->state.pos[2],
p->state.V[0], p->state.V[1], p->state.V[2],
p->state.diam, p->state.temp, p->flow_rate, p->state.time,
p->user[0], name);
}
}
C. fluent編譯UDF時候出現語法錯誤:
顯示你的語法錯誤啊
建議 每個程序語句後加 ; 這個符號
因沒有源碼 不知道是否是你的 代碼有問題。
D. fluent編譯UDF的過程中,出現了語法錯誤
你還是逐行檢查,是你編寫錯誤。
我一般習慣使用,interpreted udfs檢查,有錯誤會提示在哪行有錯誤。例如上面的圖片,我是故意寫錯的udf程序。
根據提示,從第一個錯誤檢查
E. fluent的udf編譯功能的實現需要對電腦做哪些設置,及按照什麼樣的步驟才能實現越詳細越好,求指教
首先是需要你有一個C語言編譯器,一般32位的用vc6.0就可以,64位的需要vs2008以上並需要要在安裝時自定義勾選64位庫編譯功能;然後你需要注冊編譯器的環境變數,vc6的話在安裝最後會問你的,選是就行,然後直接在fluent裡面直接可以編譯;vs好像比較麻煩,記不太清楚了,可以從網上查查,不過即使vs沒有配環境變數,問題也不大,就是要從vs的工具中選擇X64命令行(注意有兩個,好像分別針對Intel和AMD的CPU吧)輸入命令fluent -2d/3d 進入fluent,這樣也可以編譯。希望對你有幫助。
F. fluent中的UDF能用vs2010編譯嗎
當然沒有問題,所謂 UDF 編譯後就是一個 DLL 文件
使用 nmake 的話,需要先設定環境變數
可以在 cmd 中執行 Path\To\VC\vcvarsall.bat
然後敲 fluent 的啟動命令
=========================
win7 並沒什麼特殊,當然可以
G. fluent14.0 laod編譯好的udf時系統找不到指定的文件 libudf.dll
這個問題我查了很久,全部都說什麼環境變數,都是胡說八道。終於在某個地方看到一個解決方法,親測可用,能解救各大遇到同樣問題的大神:
一般遇到這個問題的時候,就是有一個cas文件,導入udf時候彈錯。以下分步解決
從自己電腦的fluent安裝目錄裡面找到fluent執行文件,取決於你裝在哪,一般路徑後面是..........ANSYS Incv194fluent tbinwin64,路徑隨著fluent版本會不一樣,自行理解。然後記下這個路徑。
從開始那裡搜索,輸入「cross」,打開類似於「VS2012 ARM Cross Tools Command Promp」的東東,通過命令行找到上面所說的那個路徑,打開fluent。彈出fluent啟動框
fluent的執行路徑可以隨意,一般是跟你udf同個文件夾。
打開fluent後read,讀入你之前一直導不進udf的那個case,此時再導入udf,成功
思路就是通過一個新的方式找到fluent的老家,通過它來打開case,這樣導入的udf可以build成功,load也成功。
撒花