CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   UDF: PROFILE + SOURCE (http://www.cfd-online.com/Forums/fluent/49158-udf-profile-source.html)

Nuno September 1, 2008 15:31

UDF: PROFILE + SOURCE
 
Hi people im a newbie of Fluent and i want put the profile of velocity on x direccion and a source term on x-momentum. So i copied the exemples of Fluent Manual. I did two files, one for profile (profile.txt) and other for source (source.txt). On Fluent i selected the Fluid and chose the source term. I chose on Boundary Conditions for inlet the velocity profile. So, when i Interpreted the its all ok but when i select Iterate appear the follow error: xmom_source:wrong return type: void udf function expect. My flow is turbulent and the fluid is air. How i can fixed that. Thank you for all help

#include "udf.h" /* must be at the beginning of every UDF you write */

DEFINE_PROFILE(x_velocity,thread,index) { real x[ND_ND]; /* this will hold the position vector */ real y; face_t f;

begin_f_loop(f,thread) /* loops over all faces in the thread passed

in the DEFINE macro argument */

{

F_CENTROID(x,f,thread);

y = x[1];

F_PROFILE(f,thread,index) = 1.5*pow(y/42,0.14);

} end_f_loop(f,thread) } ********SOURCE********* #include "udf.h"

#define C2 100.0

DEFINE_SOURCE(xmom_source, c, t, dS, eqn) { real x[ND_ND]; real con, source; C_CENTROID(x, c, t); con = C2*0.5*C_R(c, t)*x[1]; source = -con*fabs(C_U(c, t))*C_U(c, t); dS[eqn] = -2.*con*fabs(C_U(c, t)); return source; }



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