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. |
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) } |
This is exactly what I needed too, works perfect!
|
Thanks, It worked perfectly... Should've read the manual more
Regards a. |
Hi
Following may be useful; loop over all cells over domain { loop over all faces of cell} good luck |
|
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. |