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

UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 9, 2000, 03:42
Default UDF
  #1
Ulrich
Guest
 
Posts: n/a
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
  Reply With Quote

Old   May 9, 2000, 08:37
Default Re: UDF
  #2
Joakim Majander
Guest
 
Posts: n/a
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
  Reply With Quote

Old   May 9, 2000, 10:29
Default Re: UDF
  #3
Ulrich
Guest
 
Posts: n/a
Thank you Joakim, but if I define x as real, then I get the same compiler message.

Ulrich
  Reply With Quote

Old   May 12, 2000, 12:12
Default Re: UDF
  #4
Chris
Guest
 
Posts: n/a
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>
  Reply With Quote

Old   November 7, 2002, 04:11
Default Re: UDF
  #5
seyed
Guest
 
Posts: n/a
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
  Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Mesh UDF Qureshi FLUENT 7 March 23, 2017 07:37
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 22:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 04:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 04:01


All times are GMT -4. The time now is 22:29.