CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF for mass flow profile (http://www.cfd-online.com/Forums/fluent-udf/101929-udf-mass-flow-profile.html)

 delaneyluke May 17, 2012 07:27

UDF for mass flow profile

Hi,

I am new at writing UDF's and need help with a UDF for a mass flow profile on an outlet plane.
The mass flow varies along the x-direction across the plane by the following formula
tsat-((0.75*(tout-tin)*y^2)+(1.75*(tout-tin)*y)+tin)

The UDF i have written is as follows

#include "udf.h"

DEFINE_PROFILE (mass_profile, t i)
{
real x[ND_ND];
real y;
face_t f;
int tsat=35;
int tin=32.78;
int tout=34.44;
begin_f_loop (f,t)
{
F_CENTROID (x,f,t);
y = x[2];
F_PROFILE = tsat-((0.75*(tout-tin)*y^2)+(1.75*(tout-tin)*y)+tin);
}
end_f_loop (f,t)
}

Keep getting "line 1 : parse error" when trying to interpret the UDF into Fluent

Any help appreciated

Regards
Luke

 Guava Wang May 23, 2012 21:55

Quote:
 Originally Posted by delaneyluke (Post 361642) Hi, 　 DEFINE_PROFILE (mass_profile, t i) { real x[ND_ND]; real y; face_t f; int tsat=35; int tin=32.78; int tout=34.44; begin_f_loop (f,t) { F_CENTROID (x,f,t); y = x[2]; F_PROFILE = tsat-((0.75*(tout-tin)*y^2)+(1.75*(tout-tin)*y)+tin); } end_f_loop (f,t) } Keep getting "line 1 : parse error" when trying to interpret the UDF into Fluent Any help appreciated Regards Luke
Line 1 should be like that
DEFINE_PROFILE (mass_profile, t ,i)
there miss "," in this macro

 t.krishnamohan May 23, 2012 22:45

#include "udf.h"

DEFINE_PROFILE (mass_profile, t i)
{
real x[ND_ND];
real y;
face_t f;

/* define temp as float/ real

int tsat=35;
int tin=32.78;
int tout=34.44;

begin_f_loop (f,t)
{
F_CENTROID (x,f,t);

/* y=x[1]; to get the y cood

y = x[2];

/* F_PROFILE(f, t, i)

F_PROFILE = tsat-((0.75*(tout-tin)*y^2)+(1.75*(tout-tin)*y)+tin);
}
end_f_loop (f,t)
}

Keep getting "line 1 : parse error" when trying to interpret the UDF into Fluent

Any help appreciated

Regards
Luke

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