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 loop the outer cells of the volume cell zone? (https://www.cfd-online.com/Forums/fluent-udf/186167-how-loop-outer-cells-volume-cell-zone.html)

gzsakuraz April 12, 2017 05:28

How to get cell adjacent to another thread?
 
Hi,
I have been working for several days. I have 3 cell zones.
their arrangement: surface(ID=42)/volume(ID=60)/volume
The problem is I want to get face area(that point to surface) and volume of the cells that ONLY adjacent to surface(ID=42).
Here is my effort. So I started with looping all faces in ID=42 which is the surface and check whether c1 has thread number equal to 60.


Please help me :)

#include "udf.h"
#include "mem.h"
DEFINE_EXECUTE_AT_END(execute_at_end){
Domain *d;
face_t f, f0;
cell_t c, c1;
Thread *t, *t1, *ct;
int Zone_ID = 42; /* ice outer = 42 */
d = Get_Domain(1);
real A[], area=0;
/* Loop over all faces on ice outer(surface) */
t = Lookup_Thread(d, Zone_ID);
begin_f_loop(f,t)
{
/* c0 and t0 identify the adjacent cell */
t1 = THREAD_T1(t); //return number of thread (ice layer = 60)
if (t1==60){
c1 = F_C1(f, t0); //return cell index of opposite thread to 42 which is 60
F_AREA(A,f,t);//area vector on the surface
area = NV_MAG(A);//magnitude of the area
}
end_f_loop(f,t)
}
}

swpnl9282@gmail.com April 12, 2017 13:46

I think you are doing in right way

Sent from my Moto G (4) using CFD Online Forum mobile app


All times are GMT -4. The time now is 17:50.