CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

how to compiled udf ?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 14, 2010, 23:42
Question how to compiled udf ?
  #1
New Member
 
zhangzhiyan
Join Date: Jul 2010
Location: Urumqi CHINA
Posts: 16
Rep Power: 7
zzyan is on a distinguished road
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:



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 :



is anyone can help me?

thanks.
__________________
In learning and straightway practising is there not pleasure also? When friends gather round from afar do we not rejoice? Whom lack of fame cannot vex is not he a gentleman?
zzyan is offline   Reply With Quote

Old   November 15, 2010, 06:55
Default
  #2
Member
 
lehoang_mai's Avatar
 
User_CFD
Join Date: Mar 2010
Posts: 48
Rep Power: 7
lehoang_mai is on a distinguished road
I can't see pictures about error:-(
lehoang_mai is offline   Reply With Quote

Old   November 19, 2010, 02:53
Smile
  #3
New Member
 
zhangzhiyan
Join Date: Jul 2010
Location: Urumqi CHINA
Posts: 16
Rep Power: 7
zzyan is on a distinguished road
Quote:
Originally Posted by lehoang_mai View Post
I can't see pictures about error:-(
thank You lehoang_mai
i have slover that problem
__________________
In learning and straightway practising is there not pleasure also? When friends gather round from afar do we not rejoice? Whom lack of fame cannot vex is not he a gentleman?
zzyan is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
I want to use pressure of 1 face in udf that compiled on other face iman_1844 Fluent UDF and Scheme Programming 3 June 10, 2010 12:55
Why udf can not be compiled in my pc? Xinqiang FLUENT 0 June 10, 2009 14:32
difference between udf compiled and udf interprete chandra sekhar FLUENT 2 April 11, 2006 00:04
how to quit compiled or interprited UDF tian FLUENT 0 April 8, 2003 23:53


All times are GMT -4. The time now is 06:28.