CFD Online Discussion Forums

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

Quentin February 27, 2008 06:08

UDF : problem with c_face_loop
 
Hello,

I try to find a value of velocity of the mesh before the boundary. I've already written this UDF, but I always have a SEGMENTATION VIOLATION ...

#include "udf.h" #include "mem.h"

DEFINE_PROFILE(condition_limite_haut_air_z, t, index) {

Thread *t1, *t2, *t3, *tf;

real vitesse_avant;

face_t f,f1;

cell_t c,c0,c1,c2,c3;

int n = 0;

vitesse_avant = 0;

begin_f_loop(f, t)

{

c0 = F_C0(f,t);

c1 = F_C1(f,t);

if (c1=NULL)

{

c = c0;

}

else

{

c = c1;

}

c_face_loop(c, t1, n)

{

f1 = C_NODE(c,t1,n);

tf = C_FACE_THREAD(c,t1,n);

if (f1 != f)

{

vitesse_avant = vitesse_avant + F_W(f1,tf);

}

}

vitesse_avant = vitesse_avant/3;

if (vitesse_avant < 0)

{

F_PROFILE(f, t, index) = 0;

}

else

{

F_PROFILE(f, t, index) = -vitesse_avant;

}

} end_f_loop(f, t)

}

After some researches, I've found that the problem comes from the c_face_loop. Can somebody help me?

Thanks

Quentin

Greg February 28, 2008 06:05

Re: UDF : problem with c_face_loop
 
Hello Quentin,

you use the thread pointer t1 in the c_face_loop, but I can't see the initialization of t1.

I would you use t1=Lookup_Thread(d,index); function and then a begin_c_loop(c,t1) to iterate through the cells.

Regards,

Greg


All times are GMT -4. The time now is 13:16.