CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   UDF (http://www.cfd-online.com/Forums/fluent/27661-udf.html)

Ulrich May 9, 2000 03:42

UDF
 
Hi, why it's not possible to compile these function.

#include "udf.h"

Thread *t; cell_t c; int i;

DEFINE_UDS_FLUX(massen_fluss,face,thread,eqn) { #define omega 100.; #define epsilon 0.37;

double alpha,radius; double x[ND_ND]; double F[ND_ND];

F_CENTROID(x,face,thread); alpha = atan2(x[0],x[2]); radius = sqrt(pow(x[0],2.)+pow(x[2],2.)); F[0] = epsilon*(F_U(face,thread)+radius*omega*sin(alpha)) ; F[1] = F_V(face,thread); F[2] = epsilon*(F_W(face,thread)+radius*omega*cos(alpha)) ; return F[eqn]; }

The compiler message is:

Error: all.c: line 20: Syntax error. Error: all.c: line 20: invalid type for pointer dereference: double.

Thangs for help,

Ulrich

Joakim Majander May 9, 2000 08:37

Re: UDF
 
One reason could be, that you have defined x as double while it should be real, which is float, if you are using a single-precission version of Fluent.

Joakim

Ulrich May 9, 2000 10:29

Re: UDF
 
Thank you Joakim, but if I define x as real, then I get the same compiler message.

Ulrich

Chris May 12, 2000 12:12

Re: UDF
 
You should use real rather than double for x and F, but the problem is the semicolons ";" after the #define values.

#define is a cpp (C PreProcessor) statement that does simple textual substitution -

where ever it see omega in the text it is replacing it with "100.;"

That is terminating your statements prematurely. The code should look like this:

<CODE>

#include "udf.h"

DEFINE_UDS_FLUX(massen_fluss,face,thread,eqn) {

#define omega 100.

#define epsilon 0.37

double alpha,radius;

real x[ND_ND], F[ND_ND];

F_CENTROID(x,face,thread);

alpha = atan2(x[0],x[2]);

radius = sqrt(pow(x[0],2.)+pow(x[2],2.));

F[0] = epsilon*(F_U(face,thread)+radius*omega*sin(alpha)) ;

F[1] = F_V(face,thread);

F[2] = epsilon*(F_W(face,thread)+radius*omega*cos(alpha)) ;

return F[eqn];

} </CODE>

seyed November 7, 2002 04:11

Re: UDF
 
Hi I have a question that is; in the fluent for a axisymmetric problem,is F_W (drfined at the UDF)equal with swirl velocity (defined at the fluent)? Thanks seyed


All times are GMT -4. The time now is 17:34.