CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF (https://www.cfd-online.com/Forums/fluent/37336-udf.html)

Vinod July 21, 2005 05:21

UDF
 
Hello, I just want to know how to create a logarithmic profile in the inlet plane of the domain using UDF. I tried by using C prog and hook it into fluent and seems its doesn't work.please look over the prog...

#include "udf.h" DEFINE_PROFILE(velocity_profile,t,i)

{

real x[ND_ND]; /* hold the position vector */

real z;

real U=0.68; /* Frictional velocity (UABL )*/

real k=0.42; /*Von-karman constant */

real z0=0.03; /*Ground roughness length*/

real tmp=0; face_t f;

begin_f_loop(f,t)

{

F_CENTROID(x,f,t);

z = x[1];

tmp=(z+z0)/z0;

F_PROFILE(f,t,i) = (U/k)*log(tmp); /*lag-law */

} end_f_loop(f,t) }

Please help me to solve this problem Regards, Vinod

Sham July 21, 2005 21:24

Re: UDF
 
#include "udf.h" #include "math.udf"

/* This UDF defines a positive, steady current profile that varies with depth. */ /* Velocity U = 0.38m/s Re=1.423x10^5*/

#define Ur 0.02044 /* reference current velocity (m/s)*/ #define Zo 0.0003 /* bottom roughness parameter */

DEFINE_PROFILE(ux_steady_current, thread, index) {

real x[ND_ND]; /* this will hold the position vector */

real y;

face_t f;

begin_f_loop(f, thread)

{

F_CENTROID(x, f, thread);

y = x[1];

if ((y+Zo)>0) F_PROFILE(f, thread, index) = (Ur/0.4)*log((y+Zo)/Zo);

else F_PROFILE(f, thread, index) = 0.0;

}

end_f_loop(f, thread) }


All times are GMT -4. The time now is 06:09.