24小时热门版块排行榜    

查看: 1010  |  回复: 5

唏哩哈啦

新虫 (初入文坛)

[交流] udf小程序的求助 已有5人参与

#include"udf.h"
#include"mem.h"
#define p_pretotal 350000
#define pcr 185000
#define R 287.06
#define k 1.4
#define T 300
DEFINE_ADJUST(on_demamd_avg,d)
{
        real p_sum = 0;
        real p;
        real v = 0;
        real r = 0,tem;
        real V;
        real xc[ND_ND];
        Thread *t;
        face_t f;
        Domain *d;
        d = Get_Domain(1); /*获取液态区域的网格 */
        t=Lookup_Thread(d,12);/* 找到出口截面的线指针(ID在fluent中的phase找的) */
         /* 单元循环 */
               begin_f_loop(f,t)
                           {
                                   F_CENTROID(xc,f,t); /* 将网格坐标存入数组xc中 */
                               p_sum = F_P(f, t);   
                               if(p_sum<=p_pretotal)
                   {   
                        if(p_sum>=pcr)
                            {
                                F_U(f,t)=sqrt((2*k*R*T/(k-1))*pow((1-(p_sum/p_pretotal)),(k-1)/k));
                             }
                                            else
                               F_U(f,t)=sqrt(k*R*T*pow((p_sum/p_pretotal),(k-1)/k));
                    }
                                        else
                       F_U(f,t)=0;   
                           }
                end_f_loop(f,t);
}
求高人指点一下udf 啊  主要功能就是获取某个区域网格上的压力,通过压力的比较得到相应的速度表达式
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

keeep0394

新虫 (正式写手)


小木虫: 金币+0.5, 给个红包,谢谢回帖
F_U(f,t)可以这样用?

发自小木虫IOS客户端
2楼2016-04-21 00:05:17
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

段晓霞

新虫 (小有名气)


小木虫: 金币+0.5, 给个红包,谢谢回帖
adjust 函数中的数字不能直接写成整数,应该写成0.0,1.0……

发自小木虫Android客户端
天道酬勤
3楼2016-04-21 07:27:22
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

idooooo

新虫 (初入文坛)


小木虫: 金币+0.5, 给个红包,谢谢回帖
F_U(f,t)是不是只能返回值 而不能修改值啊 你自己看看
4楼2016-04-24 11:04:39
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

胡杨之殇

金虫 (职业作家)


小木虫: 金币+0.5, 给个红包,谢谢回帖
adjust宏的用途或者作用是啥?

发自小木虫Android客户端
5楼2016-04-24 12:51:17
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

shuai_1314

捐助贵宾 (小有名气)


小木虫: 金币+0.5, 给个红包,谢谢回帖
Domain *d
Pointer to the domain over which the adjust function is to be applied. The domain argument provides access to all cell and face threads in the mesh. For multiphase flows, the pointer that is passed to the function by the solver is the mixture-level domain.
上面是FLuent帮助,这个d指向的是mixture-level domain,你的程序里面又将液态的赋给d,这个不对吧,你再好好看看多相流的udf帮助。我没编过DEFINE_ADJUST,就当是提个醒,可能也不太对
率真随性的射手
6楼2016-04-24 19:54:49
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 唏哩哈啦 的主题更新
普通表情 高级回复 (可上传附件)
信息提示
请填处理意见