how to compiled udf ?
hi all
i do have no idea about udf, udf1: #include "udf.h" static real v_prev = 0.0; DEFINE_CG_MOTION(piston,dt,vel,omega,time,dtime) { Thread *t; face_t f; real NV_VEC(A); real force, dv; /* reset velocities */ NV_S(vel, =, 0.0); NV_S(omega, =, 0.0); if (!Data_Valid_P()) return; /* get the thread pointer for which this motion is defined */ t = DT_THREAD(dt); /* compute pressure force on body by looping through all faces */ force = 90.0; begin_f_loop(f,t) { F_AREA(A,f,t); force += F_P(f,t) * NV_MAG(A); } end_f_loop(f,t) /* compute change in velocity, i.e., dv = F * dt / mass velocity update using explicit Euler formula */ dv = dtime * force / 50.0; v_prev += dv; Message ("time = %f, x_vel = %f, force = %f\n", time, v_prev, force); /* set x-component of velocity */ vel[0] = v_prev; } it can be compiled like that: http://b51.photo.store.qq.com/http_i...c6b9&a=57&b=51 http://b58.photo.store.qq.com/http_i...0cde&a=58&b=58 but udf 2: #include "udf.h" #include "unsteady.h" #include "memory.h" #include "stdlib.h" #include "stdio.h" DEFINE_CG_MOTION(movewall,dt,vel,omega,time,dtime) { Thread *t; cell_t c; real cx,cy; //CArray<real,real&> vx,vy; int i; int n=0; //if(!Data_Valid_P()) //return; t=DT_THREAD(dt); cx=0; cy=0; begin_c_loop(c,t) { //vx.Add(C_U(c,t)); //vy.Add(C_U(c,t)); cx=cx+C_U(c,t); cy=cy+C_V(c,t); n++; } end_c_loop(c,t); cx=cx/n; cy=cy/n; cx=0; cy=0.05; vel[0]=cx; vel[1]=cy; //Message("\n n=%d, vx=%f, vy=%f\n",n,vel[0],vel[1]); } it can not be compiled : http://b58.photo.store.qq.com/http_i...f0ca&a=58&b=58 http://b51.photo.store.qq.com/http_i...cc25&a=52&b=51 is anyone can help me? thanks. |
I can't see pictures about error:-(
|
Quote:
i have slover that problem |
All times are GMT -4. The time now is 08:03. |