| 10 | 1/1 | 返回列表 |
| 查看: 3471 | 回復(fù): 9 | ||
huanghuang36銅蟲 (小有名氣)
|
[求助]
UDF 改為并行計算
|
|
我的UDF 在單機(jī)下能正常使用,但是并行不是需要改一下語句嘛,本人愚鈍,照著教程改了改但是一直不對,希望高人能幫忙指點(diǎn)一下,不勝感激啊 如下是我的UDF:主要使用的就是CG_MOTION #include #include "udf.h" #include "math.h" real r_movefluid; DEFINE_CG_MOTION(moveface, dt, cg_vel, cg_omega, time, dtime) { Thread *t; face_t f; real x0,y0,r; real v0; real v; real omega=M_PI; real theta=omega*time; real x[ND_ND]; t = DT_THREAD(dt); begin_f_loop(f,t) { F_CENTROID(x,f,t); x0=x[0]; y0=x[1]; r=sqrt(pow(x0,2)+pow(y0,2)); } end_f_loop(f,t) v0=omega*r; r_movefluid=r; if (time>=0 && time<=M_PI/(180*omega)) v=0; else if (time<=8*M_PI/(180*omega)) v=12.96*(theta-(M_PI/180))*omega/(7*pow(M_PI,2)); else if (time<=10*M_PI/(180*omega)) v=0.072*omega/M_PI; else if (time<=29*M_PI/(180*omega)) v=(0.072*omega/M_PI)-12.96*(theta-M_PI/18)*omega/(19*M_PI*M_PI); else if (time<=31*M_PI/(180*omega)) v=0; cg_vel[0]=v*cos(theta)-v0*sin(theta); cg_vel[1]=v*sin(theta)+v0*cos(theta); cg_vel[2]=0; cg_omega[0]=0; cg_omega[1]=0; cg_omega[2]=omega; } DEFINE_CG_MOTION(rotate, dt, cg_vel, cg_omega, time, dtime) { real omega=M_PI; cg_omega[2]=omega; } DEFINE_CG_MOTION(movefluid, dt, cg_vel, cg_omega, time, dtime) { real v0; real v; real omega=M_PI; real theta=omega*time; v0=omega*r_movefluid; if (time>=0 && time<=M_PI/(180*omega)) v=0; else if (time<=8*M_PI/(180*omega)) v=12.96*(theta-(M_PI/180))*omega/(7*pow(M_PI,2)); else if (time<=10*M_PI/(180*omega)) v=0.072*omega/M_PI; else if (time<=29*M_PI/(180*omega)) v=(0.072*omega/M_PI)-12.96*(theta-M_PI/18)*omega/(19*M_PI*M_PI); else if (time<=31*M_PI/(180*omega)) v=0; cg_vel[0]=v*cos(theta)-v0*sin(theta); cg_vel[1]=v*sin(theta)+v0*cos(theta); cg_vel[2]=0; cg_omega[0]=0; cg_omega[1]=0; cg_omega[2]=omega; } 剛注冊的,目前只有兩個金幣,呵呵,不好意思啊~~ |
新蟲 (初入文壇)
銅蟲 (小有名氣)
| 在每段程序 最前頭加上 #if !RP_HOST 最末尾加上#endif 即可 |
銅蟲 (小有名氣)
銅蟲 (小有名氣)
新蟲 (正式寫手)
銀蟲 (小有名氣)

| 10 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 一志愿深大,0703化學(xué),總分302,求調(diào)劑 +4 | 七月-七七 2026-03-21 | 4/200 |
|
|---|---|---|---|---|
|
[考研] 材料求調(diào)劑 +3 | @taotao 2026-03-21 | 3/150 |
|
|
[考研] 0703化學(xué)297求調(diào)劑 +3 | Daisy☆ 2026-03-20 | 3/150 |
|
|
[考研] 307求調(diào)劑 +3 | 余意卿 2026-03-18 | 3/150 |
|
|
[考研] 302求調(diào)劑 +12 | 呼呼呼。。。。 2026-03-17 | 12/600 |
|
|
[考研] 336求調(diào)劑 +5 | rmc8866 2026-03-21 | 5/250 |
|
|
[考研] 286分人工智能專業(yè)請求調(diào)劑愿意跨考! +4 | lemonzzn 2026-03-17 | 7/350 |
|
|
[考研] 0856材料專碩353求調(diào)劑 +3 | NIFFFfff 2026-03-20 | 3/150 |
|
|
[考研] 一志愿山大07化學(xué) 332分 四六級已過 本科山東雙非 求調(diào)劑! +3 | 不想理你 2026-03-16 | 3/150 |
|
|
[考研] 310求調(diào)劑 +3 | baibai1314 2026-03-16 | 3/150 |
|
|
[考研] 299求調(diào)劑 +6 | △小透明* 2026-03-17 | 6/300 |
|
|
[考研]
|
.6lL 2026-03-18 | 8/400 |
|
|
[考研] 311求調(diào)劑 +5 | 冬十三 2026-03-18 | 5/250 |
|
|
[考研] 一志愿中南化學(xué)(0703)總分337求調(diào)劑 +8 | niko- 2026-03-19 | 9/450 |
|
|
[考研] 本人考085602 化學(xué)工程 專碩 +19 | 不知道叫什么! 2026-03-15 | 21/1050 |
|
|
[考研]
|
不想起名字112 2026-03-19 | 3/150 |
|
|
[考研] 本科鄭州大學(xué)物理學(xué)院,一志愿華科070200學(xué)碩,346求調(diào)劑 +4 | 我不是一根蔥 2026-03-18 | 4/200 |
|
|
[考研] 0703化學(xué) 305求調(diào)劑 +4 | FY_yy 2026-03-14 | 4/200 |
|
|
[考研] [導(dǎo)師推薦]西南科技大學(xué)國防/材料導(dǎo)師推薦 +3 | 尖角小荷 2026-03-16 | 6/300 |
|
|
[考研] 304求調(diào)劑 +5 | 素年祭語 2026-03-15 | 5/250 |
|