CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Source-Code (http://www.cfd-online.com/Forums/fluent/42520-source-code.html)

 Peter October 10, 2006 10:15

Source-Code

Hello,

I get some error-messages if I compile the following source-code of my udf. Perhaps some of you have an idea what's wrong. I would be glad about each help. Thanks.

Here are the error-messages: implicite declaration of function Berechnung_1 implicite declaration of function Berechnung_2 conflicting types for Berechnung_1 conflicting types for Berechnung_2

DEFINE_PROFILE(inlet_x_velocity,t,i) { real x[3]; face_t f; real y;

begin_f_loop(f,t) {

F_CENTROID(x,f,t);

y=x[1];

F_PROFILE(f,t,i)=Berechnung_1(); } end_f_loop(f,f) }

real Berechnung_1()

{

static real X=0.0; /*Position des Wasserspiegels in der Kapillare*/

static real U=0.0; /*Geschwindigkeit des Wasserspiegels in der Kapillare*/

real X1,X2,X3,X4;

real U1,U2,U3,U4;

real F1,F2,F3,F4;

real Delta_t; /*Zeitschritt in Sekunden*/

Delta_t=CURRENT_TIMESTEP;

X1=X;

U1=U;

F1=Berechnung_2(X1,U1);

X2=X+(U1*Delta_t)/2;

U2=U+(F1*Delta_t)/2;

F2=Berechnung_2(X2,U2);

X3=X+(U2*Delta_t)/2;

U3=U+(F2*Delta_t)/2;

F3=Berechnung_2(X3,U3);

X4=X+U3*Delta_t;

U4=U+F3*Delta_t;

F4=Berechnung_2(X4,U4);

X=X1+(Delta_t/6)*(U1+(2*U2)+(2*U3)+U4);

U=U1+(Delta_t/6)*(F1+(2*F2)+(2*F3)+F4);

return U;

}

real Berechnung_2(real C,real D)

{

real K;

#define g 9.8 /*Erdbeschleunigung*/

#define x_0 0.02 /*Eintauchtiefe*/

#define nu 0.000000893 /*Kinematische Viskositaet*/

#define rK 0.0004 /*Radius der Kapillare*/

#define sigma 0.072 /*Oberflaechenspannung*/

#define cos_theta 1.0 /*cos des Kontaktwinkels = cos(theta*3,1416/180) */

#define rho 997.0 /*Dichte*/

K=(-((C*g)/(C+x_0)) - ((D*D)/(C+x_0))) - (((8*nu)/((rK*rK)*D)) + ((2*sigma*cos_theta)/(rho*(rK*(C+x_0)))));

return K;

}

 Ahmed October 10, 2006 19:07

Re: Source-Code

1- Why your first line has two #include on the same line and what to include !! 2- Take all the #define to the top of the file or have them as Real e.g. real g=9.8; etc 3- Keep a C language primer handy

 Peter October 11, 2006 06:10

Re: Source-Code

Ive done what you've said and it works. Thx for your help.

 All times are GMT -4. The time now is 05:54.