CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   a way to find out wall-neighboring cells? (http://www.cfd-online.com/Forums/fluent/29732-way-find-out-wall-neighboring-cells.html)

Christian May 8, 2002 05:52

a way to find out wall-neighboring cells?
 
hello!

i want to find out the cell-ID of all wall-neighboring cells and declare them as a variable. I have written the following UDF, but I don't know how to find out if it works, because i have no idea how to view the cell-ID or the cells.

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

cell_t c; cell_t c0; cell_t c1; face_t f; Domain *domain; Thread *t;

DEFINE_ON_DEMAND(cell_check) { begin_f_loop(f, t)

{

cell_t c0 = F_C0(f, t);

if (c0 == NULL)

{

cell_t c1 = F_C1(f, t);

}

} end_f_loop(f, t) }

1. Does anybody know how i can check if it works? 2. Maybe you know that it won't work and have other proposals, please tell me!

Thanks in advance, Christian

Johnix May 8, 2002 21:46

Re: a way to find out wall-neighboring cells?
 
Why not work? It seems perfect!!!

The way to test it is to try cases... lol

Christian May 9, 2002 04:55

Re: a way to find out wall-neighboring cells?
 
tested it ==> segmentation violation. I knew it seemed perfect, but that`s the way perfect things work. I can imagine there is an error produced at the inlet/outlet boundary conditions. by the way, the command `NULL`is defined in FLUENT anyway?

Christian

Johnix May 9, 2002 05:59

Re: a way to find out wall-neighboring cells?
 
<html> <body>
Have you defined the thread var f globally? Sounds you like global definition...lol

If not or f is not assigned correctly, there must be a problem with your function, DEFINE_ON_DEMAND(cell_check). "segmentation violation" means you are refering an mem address out of the stack or heap, and this suggest you an easy way to debug it: try to test the value of the pointer var. Since there is no debugger in Fluent, some printf statements may help.

NULL is OK, since it's an internal macro of C compiler defined in, for example, stdio.h. If you are still not sure about it, you can use if((ulong)c0==0)...

Enjoy your debugging~~~

<font size=5 face=script color=#0000FF>Johnix</font>


</body> </html>

Christian May 10, 2002 08:30

Re: a way to find out wall-neighboring cells?
 
Thanks a lot, Johnix!


All times are GMT -4. The time now is 14:19.