CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   How to find the cells adjacent to the wall? (

aam May 7, 2009 07:01

How to find the cells adjacent to the wall?

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???



Daniel Tanner May 7, 2009 07: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"
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)
C_UDMI(c,ct,0) = 0.0;

/* Loop over all faces on wall */
t = Lookup_Thread(d, Zone_ID);
/* 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;

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

This is exactly what I needed too, works perfect!

aam May 15, 2009 05:15

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



gemini May 19, 2009 15:40

Following may be useful;

loop over all cells over domain
loop over all faces of cell
This cell is next to a boundary face
do the stuff here

good luck June 27, 2017 13:56

please can you send me the manual what u read?
many thanks dear

MayTheFlowBeWithYou June 28, 2017 09: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 03:50.