CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Set UDS on wall...

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 24, 2014, 10:03
Default Set UDS on wall...
  #1
Senior Member
 
Phoevos
Join Date: Mar 2009
Posts: 104
Rep Power: 17
fivos is on a distinguished road
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..
fivos is offline   Reply With Quote

Old   July 24, 2014, 21:48
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
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.
blackmask is offline   Reply With Quote

Old   July 25, 2014, 05:57
Default
  #3
Senior Member
 
Phoevos
Join Date: Mar 2009
Posts: 104
Rep Power: 17
fivos is on a distinguished road
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.
fivos is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
correction of Grub after installing Windows XP and 8 immortality Lounge 20 January 5, 2014 17:41
[snappyHexMesh] determining displacement for added points CFDnewbie147 OpenFOAM Meshing & Mesh Conversion 1 October 22, 2013 09:53
Help with GNUPlot Renato. Main CFD Forum 6 June 6, 2007 19:51
UDS flux through wall and interior face. shuqin FLUENT 2 July 29, 2006 03:54
what the result is negatif pressure at inlet chong chee nan FLUENT 0 December 29, 2001 05:13


All times are GMT -4. The time now is 23:25.