|
[Sponsors] |
May 9, 2000, 04:42 |
UDF
|
#1 |
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 |
|
May 9, 2000, 09:37 |
Re: UDF
|
#2 |
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 |
|
May 9, 2000, 11:29 |
Re: UDF
|
#3 |
Guest
Posts: n/a
|
Thank you Joakim, but if I define x as real, then I get the same compiler message.
Ulrich |
|
May 12, 2000, 13:12 |
Re: UDF
|
#4 |
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> |
|
November 7, 2002, 05:11 |
Re: UDF
|
#5 |
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
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Mesh UDF | Qureshi | FLUENT | 7 | March 23, 2017 08:37 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
How to add a UDF to a compiled UDF library | kim | FLUENT | 3 | October 26, 2011 22:38 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 05:03 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |