how can I correct the udf?
Hi,everyone. My udf has several errors as blow:
..\..\src\adjust.c(3) : error C2061: syntax error : identifier 'DEFINE' ..\..\src\adjust.c(3) : error C2059: syntax error : ';' ..\..\src\adjust.c(3) : error C2143: syntax error : missing '{' before '' ..\..\src\adjust.c(3) : error C2059: syntax error : '' ..\..\src\adjust.c(54) : error C2065: 'thread' : undeclared identifier ..\..\src\adjust.c(54) : error C2223: left of '>storage' must point to struct/union ..\..\src\adjust.c(56) : error C2223: left of '>storage' must point to struct/union ..\..\src\adjust.c(80) : error C2065: 'thread' : undeclared identifier ..\..\src\adjust.c(80) : error C2223: left of '>storage' must point to struct/union ..\..\src\adjust.c(82) : error C2223: left of '>storage' must point to struct/union and the udf itself as below: #include "udf.h" DEFINE_ADJUST(print_f_centroids, domain) real FUDMI(f,thread,0) { Thread *thread; face_t f; real force1=0.,force2=0.; int ID = 13; Thread *t= Lookup_Thread(domain, ID); { begin_f_loop(f, thread) { F_AREA(A,f,thread); force1+=F_P(f, thread)*NV_MAG(A); return force1; } end_f_loop(f, thread) } int ID=16; Thread *thread = Lookup_Thread(domain, ID); { begin_f_loop(f, thread) { F_AREA(A,f,thread); force2+=F_P(f, thread)*NV_MAG(A); return force2; } end_f_loop(f, thread) } F_UDMI(f,thread,0)=force1force2; printf("F_UDMI(f,thread,0) = %f ", F_UDMI(f,thread,0)); } DEFINE_CG_MOTION(moveface,dt,vel,omega,time,dtime) { Thread *t; face_t f; real NV_VEC (A); real dv; static real v_prev=0.0; /* 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 change in velocity, i.e., dv = F * dt / mass velocity update using explicit Euler formula */ dv=dtime*F_UDMI(f,t,0)/0.05; v_prev+=dv; Message("time=%f,x_vel=%f,F_UDMI(f,t,0)=%f\n",time ,v_prev,F_UDMI(f,t,0)); /* set xcomponent of velocity */ vel[0]=v_prev; } DEFINE_CG_MOTION(moveface1,dt,vel,omega,time,dtime ) { Thread *t; face_t f; real NV_VEC (A); real dv; static real v_prev=0.0; /* 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 change in velocity, i.e., dv = F * dt / mass velocity update using explicit Euler formula */ dv=dtime*F_UDMI(f,t,0)/0.05; v_prev+=dv; Message("time=%f,x_vel=%f,F_UDMI(f,t,0)=%f\n",time ,v_prev,F_UDMI(f,t,0)); /* set xcomponent of velocity */ vel[0]=v_prev; } could anyone give me some suggestion ? thanks a lot. 
the function FUDMI(f,thread,0) is already defined !
I'm not sure, but try to remove the line real FUDMI(f,thread,0).
P.S. however, I think a ";" is missing in such line : FUDMI(f,thread,0) 
Thanks for your reply.
I use "real F_UDMI(f,thread,0)" to make a subfunction . can not it work? just now,I compiled it again ,the error becomes ..\..\src\adjust.c(3) : error C2059: syntax error : 'type' ..\..\src\adjust.c(34) : fatal error C1903: unable to recover from previous error(s); stopping compilation. can not it work? 
what confused me is that for the ID function , the purpose of accessing the force of the wall , is this format write ?
In my model, there are 3 faces need to calculate the force , should I write all of the 3 subfuctions in one bracket like the udf I uploaded ? can you give me some example of the same type? I will appreciate you very much! 
sorry but I have never used F_UDMI.
I've juste use DEFINE_ADJUST to sum some variables during unsteady run but what can I say is that I think you make a confusion between "," and ";" real force1=0.,force2=0.; => real force1=0.; force2=0.; In C, all instructions must be closed by a ";" good luck 
Thanks a lot!
I have delete the real F_UDMI,and now it indicates other errors. I think it is allowable to define multiparemeters in a parellel line with ,and a ; at the end of the line. also, the console indicate that the DEFINE_ADJUST could not be used to ruturn a parameter,so I cancle the macro also , instead, put the conmmand to the macro of DEFINE_CG_MOTION. 
1 Attachment(s)
you can define a variable in your C program.
I don't know if it can help you but in the file joined here, I defined the mean of U,V et P every 10 irerations (it was an unsteady run) :  I defined a variable CMPT and 3 UDM : U, V and P  these variables can then be visibles in casedata 
Thanks ,I get it that use C_UDMI can get the data translating from the DEFINE_ADJUST.but I still feel that the configuration is in babelism,would you give me some suggestion?

sorry but I don't understand your request: if you want to measure forces on faces, you will need F_UDMI instead of C_UDMI ?!

did u find ur way to avoid the " left of storage must point to struct/union" ...i am facing similar errors

All times are GMT 4. The time now is 21:56. 