24小时热门版块排行榜    

查看: 488  |  回复: 0

记得旧时好

新虫 (初入文坛)

[求助] Fluent UDF 求助

目的:将计算的每一个迭代步的流量导出,并利用欧拉插值得到压力值,并赋回给Fluent作为边界条件,进行下一个迭代步的计算,一直到计算收敛,该时间步结束。
问题:仅仅在第一个时间步的时候发现压力利用欧拉迭代产生了变化,在之后的计算中压力始终等于我赋的初值。求大牛解答这是为什么。


代码如下:
DEFINE_PROFILE(DFA_outlet,thread,position)
{
        real NV_VEC(A),NV_VEC(FaceVel);
        double Q;
        face_t f;
        int i;
        real t=RP_Get_Real("flow-time";
        real tt;    // define the time in one cycle
        real w=0.8; // period of a cycle
        real p1[100]; // define the pressure after R1
        double R1,R2,C; // define electric modulus
        int TTS; // total time steps
        int h,TS; // time interval and time step

        R1=9.717571*pow(10,8),R2=3.849843*pow(10,9),C=3.712461*pow(10,-10);    // set the values of electric modulus
        TTS=100; // total time steps

        begin_f_loop(f,thread)
        {
                NV_D(FaceVel,=,F_U(f,thread),F_V(f,thread),F_W(f,thread));
                F_AREA(A,f,thread);
                Q=NV_DOT(FaceVel,A);

                //compute the pressure using the explicit Euler method

                h=w/TTS;
                tt=t-floor(t/w)*w;
                TS=floor(tt/h);
                p1[0]=12102.65-Q*R1;
                if(TS=0)
                        F_PROFILE(f,thread,position)=p1[0]+Q*R1;
                else
                        for(i=1;i<=TS;i++)
                                {
                                        p1[TS]=p1[TS-1]+h*(Q-(p1[TS-1]-1333.22)/R2)/C;
                                }
                        F_PROFILE(f,thread,position)=p1[TS]+Q*R1;
        }
        end_f_loop(f,thread)
}

@月只蓝 @beefly 发自小木虫Android客户端
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 记得旧时好 的主题更新
信息提示
请填处理意见