程序直接复制粘贴过来的,只是把C_UDMI 的表达式改了一下,放大了一些倍数,期望这样显示的数值大一些。将该UDF程序用到外掠平板的流动与换热算例中,迭代完成后UDM显示不出云图,全部数值都为0,是怎么回事?UDF程序如下:
/**********************************************************************
UDF to calculate temperature field function and store in
user-defined memory. Also print min, max, avg temperatures.
***********************************************************************/
#include "udf.h"
DEFINE_ON_DEMAND(on_demand_calc)
{
Domain *d; /* declare domain pointer since it is not passed as an
argument to the 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 ANSYS 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) = 100 * temp;
}
end_c_loop(c,t)
}
}
外掠平板的温度场如下。按理说UDM显示出来的云图应该和温度场类似啊,求大神赐教!
![最基础的UDF问题:Fluent算例完成后,后处理时为什么无法显示UDM的云图?]()
外掠平板温度场.JPG |