
[Sponsors] 
November 6, 2012, 23:55 
How to calculate velocity at cell face?

#1 
New Member
Trent
Join Date: Nov 2012
Posts: 3
Rep Power: 6 
Currently I am looping over all the cells in my 2D geometry to find u and v at each cell; however, at the corners and boundaries where I am getting recirculation, the math isn't coming out correctly using the u and v values taken from Fluent. I would assume that the velocity at the centroid is just interpolated from the face velocities so I am trying to find a way to use the velocities at the faces instead; is there a way to do this? I tried writing this quick code to test this but I am getting a Fluent access error when I try to run it:
#include"udf.h" #include"metric.h" #include"stdio.h" #include"math.h" #include"stdlib.h" #include"mem.h" DEFINE_ADJUST(velocity_profile_face,d) { Thread *t; face_t f; real cent[2]; double centr_x, centr_y; double vel_x, vel_y; thread_loop_f(t,d) { begin_f_loop(f,t) { F_CENTROID(cent,f,t); centr_x = cent[0]; centr_y = cent[1]; vel_x = F_U(f,t); vel_y = F_U(f,t); printf("%f, %f\n", vel_x, vel_y); } end_f_loop(f,t) } } After reading some other threads I saw that this only works for boundaries so I may not be able to do it this way. Is there a way I can get this to work? If not are there any other macros that will help me do what I want? If not I may need to play around with the math and see if I can get it to work better instead. Thanks for your help. 

November 7, 2012, 02:42 

#2  
Senior Member
Ji Junjie
Join Date: Feb 2010
Location: Shanghai, China
Posts: 109
Rep Power: 9 
F_U, F_V are only valid for boundary.
For those face in the domain, you can use the averaged value of F_C0 and F_C1. Quote:


November 8, 2012, 01:45 

#3 
New Member
Trent
Join Date: Nov 2012
Posts: 3
Rep Power: 6 
Thank you, I hadn't seen those macros before. I think I can get what I need from there.


Tags 
face cells, velocity components 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
A function to calculate gradient in a cell  Ballal  CDadapco  0  June 9, 2012 00:07 
channelFoam for a 3D pipe  AlmostSurelyRob  OpenFOAM  3  June 24, 2011 13:06 
Compare 2D axisymmetric and 3D. Is OpenFOAM calculate the velocity wrong?  RalphS  OpenFOAM  6  November 13, 2010 21:51 
How to calculate gradient of pressure and velocity on an outlet face  skabilan  OpenFOAM Running, Solving & CFD  2  December 8, 2008 18:26 
DPM velocity at cell face  Szabolcs Varga  FLUENT  1  September 16, 2004 07:30 