2016-02-19 240 views
0

我一直在研究液體在飛機液滴罐內的運動。對於我最初的情況,流體正在來回移動。對於這種情況,我使用了下面的代碼,但正在產生錯誤。FLUENT-區域運動UDF錯誤

zone_motion.c ..\..\src\zone_motion.c(7) : error C2100: illegal indirection 
..\..\src\zone_motion.c(11) : error C2100: illegal indirection 
..\..\src\zone_motion.c(14) : error C2109: subscript requires array or pointer type 
..\..\src\zone_motion.c(14) : error C2100: illegal indirection 
..\..\src\zone_motion.c(14) : error C2109: subscript requires array or pointer type 
..\..\src\zone_motion.c(14) : error C2109: subscript requires array or pointer type 

如何修改此代碼?

#include "udf.h" 
DEFIINE_ZONE_MOTION(fmotion, omega, axis, origin, velocity, time, dtime) 
{ 
if(time<10) 
{ 
    *omega=10; 
} 
else 
{ 
    *omega=0; 
} 
N3V_D(velocity,=,0.01*sin(*omega*time), 0.0, 0.0); 
} 

任何幫助將不勝感激。 謝謝

+0

zone_motion.c .. \ .. \ SRC \ zone_motion.c(7):錯誤C2100:非法的間接 .. \ .. \ SRC \ zone_motion.c(11):錯誤C2100 :非法間接 .. \ .. \ src \ zone_motion.c(14):錯誤C2109:下標需要數組或指針類型 .. \ .. \ src \ zone_motion.c(14):錯誤C2100:非法間接尋址 .. \ .. \ src \ zone_motion.c(14):錯誤C2109:下標需要數組或指針類型 .. \ .. \ src \ zone_motion.c(14):錯誤C2109:下標需要數組或指針類型 – shivakumar

+0

在問題本身中添加錯誤。 –

回答

0

我可能不會幫你,但也許別人會發現這個有用的。我有一個類似於你的問題的工作代碼。該代碼在域名上逐漸增加,並在達到最大值後保持不變。享受:

#include "udf.h" 

DEFINE_ZONE_MOTION(fmotion2,omega,axis,origin,velocity,time,dtime) 
{ 
float omega_max, t_end, ramp, rpm; 

omega_max=314.0; 
t_end=10.0; 
ramp=omega_max/t_end; 
velocity[0]=0.0; 
velocity[1]=0.0; 
velocity[2]=0.0; 

origin[0]=-0.1; 
origin[1]=-0.1; 
origin[2]=0.0; 

axis[0]=0.0; 
axis[1]=0.0; 
axis[2]=1.0; 

    if (CURRENT_TIME < t_end) 
    { 
    *omega = ramp * CURRENT_TIME; 
    //print("Current omega value %fn",*omega); 
    } 
    else 
    { 
    *omega = omega_max; 
    } 
    return; 
} 
+0

無論這些有用或不是,你應該只發布問題的適當答案,沒有別的 –