CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   How to find the cells adjacent to the wall? (https://www.cfd-online.com/Forums/fluent-udf/64326-how-find-cells-adjacent-wall.html)

aam May 7, 2009 06:01

How to find the cells adjacent to the wall?
 
Hi,

I am beginning with the UDFs. I need to store some data only in the centers of the cells adjacent to the wall. I identified my wall thread using Lookup_Thread. Now if I loop in this thread it shows me the 2d cells of the wall.

My question is, how to get the information on the first layer of the cells inside the domain???

Thanks

a.

Daniel Tanner May 7, 2009 06:31

Try the example below. First I initialise all cells to zero and then give the cells adjacent to the wall a value of 2. You can use the display-contour graphics to display the result. Remember to set 1 udm space and to initialise it and use the execute_on_demand option to execute this routine.

#include "udf.h"
DEFINE_ON_DEMAND(Test)
{
Domain *d; /* Get the domain using Fluent utility */
face_t f;
cell_t c, c0;

Thread *t, *t0, *ct;

int Zone_ID = 5; /* Zone Id can be seen in the Boundary Conditions Panel, for me 5 = Wall */
d = Get_Domain(1);

/* Initialise Cells */
/* this loops over all cells and lets the UDM = 0 */
thread_loop_c(ct, d)
{
begin_c_loop(c,ct)
{
C_UDMI(c,ct,0) = 0.0;
}
end_c_loop(c,ct)
}

/* Loop over all faces on wall */
t = Lookup_Thread(d, Zone_ID);
begin_f_loop(f,t)
{
/* c0 and t0 identify the adjacent cell */
c0 = F_C0(f, t);
t0 = THREAD_T0(t);
/* this loops over all cells adjacent to wall and lets the UDM = 2.0 */
C_UDMI(c0, t0, 0) = 2.0;
}
end_f_loop(f,t)
}

O.D.Y. May 7, 2009 08:44

This is exactly what I needed too, works perfect!

aam May 15, 2009 04:15

Thanks, It worked perfectly... Should've read the manual more

Regards

a.

gemini May 19, 2009 14:40

Hi
Following may be useful;

loop over all cells over domain
{
loop over all faces of cell
{
if (BOUNDARY_FACE_THREAD_P(t))
{
This cell is next to a boundary face
do the stuff here
}
}
}

good luck

alburkatyhasan@yahoo.com June 27, 2017 12:56

please can you send me the manual what u read?
alburkatyhasan@yahoo.com
many thanks dear

MayTheFlowBeWithYou June 28, 2017 08:53

He refers to the ANSYS Fluent manual, its build into your copy of the ANSYS software.


All times are GMT -4. The time now is 11:10.