|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
想实现每隔0.04秒更新一系列温度边界条件(本来温度是一系列数值,为简单简化成了温度与Z轴的坐标值的函数关系式)。编写了成了下面这段UDF程序,但是运行不起,自己编程比较弱,觉得逻辑或者编码有问题,请大侠们指点。多谢。
#include "udf.h"
#define Z0 517.213
#define a 2.398
#define b 1.4
#define c -0.0154
#define d -0.0072
DEFINE_PROFILE(unsteady_temperature,thread, position)
{ real x[ND_ND];
face_t f;
float z;
real t;
int n,i;
n=1;
begin_f_loop(f, thread)
{
t = RP_Get_Real("flow-time");
i=t*100;
if(i%4==0)
begin_f_loop(f, thread)
{
F_CENTROID(x,f,thread);
z = x[2];
F_PROFILE(f,thread,position)=Z0+a*80.0*t+b*2.0*(27.747-z)+c*6400.0*t*t+d*4.0*(27.747-z)*(27.747-z);
n=n+1;
}
end_f_loop(f, thread)
else F_PROFILE(f,thread,position)=Z0+a*80.0*t+b*2.0*(27.747-z)+c*6400.0*t*t+d*4.0*(27.747-z)*(27.747-z);
}
end_f_loop(f, thread)
} |
|