找回密码
 注册
查看: 1757|回复: 1

新手问题:求解惑

[复制链接]
发表于 2010-11-16 10:59:42 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
看了解释,还是不懂thread 确切的含义。
比如下面,在所有Cell里循环跟在整个Thread里循环有什么具体的含义?
Thread里循环不就包含了Cell循环了吗:
#include "udf.h"

DEFINE_ON_DEMAND(on_demand_calc)

Domain *d;   /* declare domain pointer since it is not passed a  */
             /* argument to DEFINE macro                         */
{
   real tavg = 0.;
   real tmax = 0.;
   real tmin = 0.;
   real temp,volume,vol_tot;
   Thread *t;
   cell_t c;
   d = Get_Domain(1);     /* Get the domain using Fluent utility */

   /* Loop over all cell threads in the domain */
   thread_loop_c(t,d)
     {

     /* Compute max, min, volume-averaged temperature */

     /* Loop over all cells  */
     begin_c_loop(c,t)
       {
         volume = C_VOLUME(c,t);   /* get cell volume */
         temp = C_T(c,t);          /* get cell temperature */

         if (temp < tmin || tmin == 0.) tmin = temp;
         if (temp > tmax || tmax == 0.) tmax = temp;

         vol_tot += volume;
         tavg += temp*volume;

       }
     end_c_loop(c,t)

     tavg /= vol_tot;

     printf("\n Tmin = %g   Tmax = %g   Tavg = %g\n",tmin,tmax,tavg);

     /* Compute temperature function and store in user-defined memory*/
     /*(location index 0)                                            */

     begin_c_loop(c,t)
       {
         temp = C_T(c,t);
         C_UDMI(c,t,0) = (temp-tmin)/(tmax-tmin);
       }
     end_c_loop(c,t)

     }
}
 楼主| 发表于 2010-11-16 12:44:44 | 显示全部楼层
吃完饭顶顶有益身体健康
求达人帮助~
感激不尽
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表