# looping over selected / marked cells

 Register Blogs Members List Search Today's Posts Mark Forums Read

 November 22, 2012, 05:59 looping over selected / marked cells #1 Senior Member   Join Date: Mar 2010 Location: Cape Town, SA Posts: 156 Rep Power: 10 Hi everyone, just wondering if anyone can help me with this query: i would like to loop over a set of cells adjacent to a wall boundary - say the next 5 cells next to the wall, or if that is not possible, over a set of cells marked using the adaptation menu and some metric (say mesh iso-value). so far i only know about looping over the whole domain and looping over various threads, which typically only include (a single layer of) wall adjacent cells. basically, i have an expression in a UDF which i want to integrate over a finite number of cells adjacent to the wall. many thanks and best regards in advance jon Code: ```/* ============================================================================ Name : entropy_generation.c Author : Jonathan Bergh Version : Copyright : Copyright J Bergh 2012 Description : Ansys Fluent UDF to calculate entropy in C, Ansi-style ============================================================================ */ #include "udf.h" #include "mem.h" DEFINE_EXECUTE_AT_END(entropy_gen) { Domain *d; Thread *t; real S_gen_tot; real S_gen_v; real S_gen_t; cell_t c; d = Get_Domain(1); thread_loop_c(t,d) { begin_c_loop(c,t) { real temperature = C_T(c,t); real c_d; real dTdx = C_T_RG(c,t)[0]; real dTdy = C_T_RG(c,t)[1]; real dTdz = C_T_RG(c,t)[2]; real dudx = C_DUDX(c,t); real dudy = C_DUDY(c,t); real dudz = C_DUDZ(c,t); real dvdx = C_DVDX(c,t); real dvdy = C_DVDY(c,t); real dvdz = C_DVDZ(c,t); real dwdx = C_DWDX(c,t); real dwdy = C_DWDY(c,t); real dwdz = C_DWDZ(c,t); real c_k_lam = C_K_L(c,t); real c_mu_lam = C_MU_L(c,t); S_gen_t = (c_k_lam/(temperature*temperature))*((dTdx)*(dTdx) + (dTdy)*(dTdy) + (dTdz)*(dTdz)); S_gen_v = (c_mu_lam/temperature)*(2*(dudx*dudx + dvdy*dvdy + dwdz*dwdz) + (dvdx+dudy)*(dvdx+dudy) + (dwdy + dvdz)*(dwdy + dvdz) + (dudz + dwdx)*(dudz + dwdx)); S_gen_tot = S_gen_t + S_gen_v; c_d = S_gen_tot / (1.010073 * (65*65*65) / 0.040 / 300); C_UDMI(c,t,0) = c_d; } end_c_loop(c,t) } }```