fluent 如何udf控制多入口逐個(gè)進(jìn)氣? 20
有2個(gè)進(jìn)氣口,如何控制入口1進(jìn)氣1s然后關(guān)閉,入口2進(jìn)氣1s然后關(guān)閉,然后循環(huán)作用。嘗試學(xué)udf控制,但失敗了(從效果圖看還是兩個(gè)口同時(shí)進(jìn)氣)。請(qǐng)教大神們?nèi)绾尉帉?xiě)udf或有什么招。
我的udf如下:
#include "udf.h"
DEFINE_PROFILE(inlet1_pressure, thread, position)
{
real t;
face_t f;
begin_f_loop(f, thread)
{
t=RP_Get_Real("flow-time");
if (0<t<=1 || 2<t<=3)
{
F_PROFILE(f,thread,position) = 300000;
}
else
{
F_PROFILE(f,thread,position) = 0;
}
}
end_f_loop(f,thread)
}
DEFINE_PROFILE(inlet2_pressure, thread, position)
{
real t;
face_t f;
begin_f_loop(f, thread)
{
t=RP_Get_Real("flow-time");
if (1<t<=2 || 3<t<=4)
{
F_PROFILE(f,thread,position) = 300000;
}
else
{
F_PROFILE(f,thread,position) = 0;
}
}
end_f_loop(f,thread)
}





















程序if語(yǔ)句錯(cuò)了,寫(xiě)成如下格式就行
begin_f_loop(f, thread)
{
if (t>0&&t<=0.5 )
{
F_PROFILE(f,thread,position) = 400000;
}
else if (t>2&&t<=2.5 )
{
F_PROFILE(f,thread,position) = 400000;
}
else if (t>4&&t<=4.5 )
{
F_PROFILE(f,thread,position) = 400000;
}
else if (t>6&&t<=6.5 )
{
F_PROFILE(f,thread,position) = 400000;
}
else if (t>8&&t<=8.5 )
{
F_PROFILE(f,thread,position) = 400000;
}
else if (t>10&&t<=10.5 )
{
F_PROFILE(f,thread,position) = 400000;
}
else if (t>12&&t<=12.5 )
{
F_PROFILE(f,thread,position) = 400000;
}
else if (t>14&&t<=14.5 )
{
F_PROFILE(f,thread,position) = 400000;
}
else if (t>16&&t<=16.5 )
{
F_PROFILE(f,thread,position) = 400000;
}
else if (t>18&&t<=18.5 )
{
F_PROFILE(f,thread,position) = 400000;
}
else
{
F_PROFILE(f,thread,position) = 0;
}
}
end_f_loop(f,thread)