CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Whar's the error in my UDF? (https://www.cfd-online.com/Forums/fluent/36283-whars-error-my-udf.html)

Jason April 6, 2005 02:47

Whar's the error in my UDF?
 
My udf is v=function(y,z,t). The err mesage is invalid type for pointer dereference: int. Anybody help me? Thanks!

/************************************************** ********************

unsteady.c UDF for specifying a transient velocity profile boundary condition

************************************************** *********************/

#include "udf.h"

DEFINE_PROFILE(unsteady_velocity, thread, position)

{

face_t f;

real t = CURRENT_TIME;

real y, z, rr, rd, D, t, x[ND_ND] ;

D=0.006 ;

begin_f_loop(f, thread)

{

F_CENTROID(x, f, thread);

y=x[1];

z=x[2];

rr=sqrt(y**2+z**2)

rd=rr*rr/D*D

if(t1>=0 && t1<=0.2)

F_PROFILE(f, thread, position) = 2*(2*t)*(1-

4*rd) ;

else

if(t1>0.2 && t1<=0.4)

F_PROFILE(f, thread, position) = 2*(3*t)*(1-

4*rd)

}

end_f_loop(f, thread)

}


P April 6, 2005 05:08

Re: Whar's the error in my UDF?
 
Where did you define t1? Can you also give the details of the error message?

Jason April 6, 2005 06:40

Re: Whar's the error in my UDF?
 
Hi,

The UDF is describe the 3-d fully-developed flow. And the velocity is changed with time v=function(y,z,t). I think the problem is about how to define the z-coodinate.

/************************************************** ********************

unsteady.c UDF for specifying a transient velocity profile boundary condition

************************************************** *********************/

#include "udf.h"

DEFINE_PROFILE(unsteady_velocity, thread, position)

{

face_t f;

real t = CURRENT_TIME;

real y, z, rr, rd, D, t, x[ND_ND] ;

D=0.006 ;

begin_f_loop(f, thread)

{

F_CENTROID(x, f, thread);

y=x[1];

z=x[2];

rr=sqrt(y**2+z**2)

rd=rr*rr/D*D

if(t>=0 && t<=0.2)

F_PROFILE(f, thread, position) = 2*(2*t)*(1-

4*rd) ;

else

if(t>0.2 && t<=0.4)

F_PROFILE(f, thread, position) = 2*(3*t)*(1-

4*rd)

}

end_f_loop(f, thread)

}


P April 6, 2005 06:57

Re: Whar's the error in my UDF?
 
Does it give some error message can you cut and paste those error message. Only then it will be possible for us to help u P

Jason April 6, 2005 10:34

Re: Whar's the error in my UDF?
 
The error message: Error: D:\fluent\CASE\pulmonary\v1.c: line 24: invalid type for pointer dereference: int.

/************************************************** ********************

unsteady.c

UDF for specifying a transient velocity profile boundary condition

************************************************** *********************/

#include "udf.h"

DEFINE_PROFILE(unsteady_velocity, thread, position)

{

face_t f;

real t = CURRENT_TIME;

real y, z, rr, rd, D, x[ND_ND] ;

D=0.006 ;

begin_f_loop(f, thread)

{

F_CENTROID(x, f, thread);

y=x[1];

z=x[2];

rr=sqrt(y**2+z**2)

rd=rr*rr/D*D

if(t>=0 && t<=0.2)

F_PROFILE(f, thread, position) = 2*(6.945*t)*(1-4*rd) ;

else

if(t>0.2 && t<=0.4)

F_PROFILE(f, thread, position) = 2*(4.23*t+0.543)*(1-4*rd) ;

}

end_f_loop(f, thread)

}


saghir April 13, 2005 05:43

Re: Whar's the error in my UDF?
 
salut si t est un variable globale temps il faut le definir comme CURRENT_TIME à toi

pUl| April 21, 2005 19:19

Re: Whar's the error in my UDF?
 
English :)


All times are GMT -4. The time now is 14:51.