# Set UDS on wall...

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

 July 24, 2014, 10:03 Set UDS on wall... #1 Senior Member   Phoevos Join Date: Mar 2009 Posts: 104 Rep Power: 17 Hi to everyone, I am trying to calculate the material derivative of a quantity in the near wall vicinity (i.e. at the 1st cell from the wall) and, for post processing reasons, I want to plot it on the wall surface. The simulation is mixture multiphase, with 2 phases. So I built the following UDF: Code: ``` DEFINE_ADJUST(calculate_dadt,d) { real time_step, dvofdt_e, dvofdt_m; int n; Thread *t, *tf; cell_t c; face_t f; d = Get_Domain(1); /* mixture domain if multiphase */ time_step = CURRENT_TIMESTEP; 　 thread_loop_c (t,d) { begin_c_loop(c,t) { C_UDSI(c,t,2) = 0; dvofdt_e = (C_UDSI(c,t,0)-C_UDSI_M1(c,t,0))/time_step; dvofdt_m = dvofdt_e +C_U(c,t)*C_UDSI_G(c,t,0)[0] +C_V(c,t)*C_UDSI_G(c,t,0)[1] +C_W(c,t)*C_UDSI_G(c,t,0)[2]; C_UDSI(c,t,2) = dvofdt_m; 　 /* set UDS on the wall */ c_face_loop(c,t,n) { tf = C_FACE_THREAD(c,t,n); f = C_FACE(c,t,n); if (THREAD_ID(tf) == 8) { F_UDSI(f,tf,2) = C_UDSI(f,tf,2); } } } end_c_loop(c,t) } 　 } ``` As you can see in the UDF, I calculate the material derivative of the UDS with index 0 and store it to a new UDS with index 2. Then, I try to put the values of the UDS 2 on the faces of a specific boundary, with ID 8. The problem is that even if I compile successfully my UDS, load it, run fluent without any problem, the UDS returns a zero value on the wall, while the UDS value at the adjacent cell is different from zero; the aforementioned representation is done by nodal and cell values - nodal values on the boundary are zero, whereas cell values are different from zero.. I have to mention that, since I do not want to solve for the UDS, but only to calculate gradients, I exclude it from Solution Controls -> Equations, however I hook the above UDF as a DEFINE_adjust UDF. Does anyone have any idea how can I instruct Fluent to copy the cell values of the desired UDS on selected wall boundaries? Thanks in advance..

 July 24, 2014, 21:48 #2 Senior Member   Join Date: Aug 2011 Posts: 421 Blog Entries: 1 Rep Power: 21 First of all, Code: `F_UDSI(f,tf,2) = C_UDSI(f,tf,2); ` is equivalent to "x = x". It seems that you meant Code: `F_UDSI(f, tf, 2) = C_UDSI(c, t, 2);` It could be more efficient if you use a combination of Code: `Lookup_Thread, F_C0, THREAD_T0` outside of cell loop instead of doing face loop inside of cell loop.

 July 25, 2014, 05:57 #3 Senior Member   Phoevos Join Date: Mar 2009 Posts: 104 Rep Power: 17 Blackmask you are absolutely right! I was confused with the thread/cell/face indexes that's way it did not work. Now it works as it should! I will think about implementing it the way you proposed, instead of looping all cells... Thanks a lot.