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

How to calculate velocity at cell face?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 6, 2012, 22:55
Default How to calculate velocity at cell face?
  #1
New Member
 
Trent
Join Date: Nov 2012
Posts: 3
Rep Power: 13
tjmartian is on a distinguished road
Currently I am looping over all the cells in my 2-D 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.
tjmartian is offline   Reply With Quote

Old   November 7, 2012, 01:42
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
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:
Originally Posted by tjmartian View Post
Currently I am looping over all the cells in my 2-D 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.
gearboy is offline   Reply With Quote

Old   November 8, 2012, 00:45
Default
  #3
New Member
 
Trent
Join Date: Nov 2012
Posts: 3
Rep Power: 13
tjmartian is on a distinguished road
Thank you, I hadn't seen those macros before. I think I can get what I need from there.
tjmartian is offline   Reply With Quote

Reply

Tags
face cells, velocity components

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
A function to calculate gradient in a cell Ballal Siemens 0 June 9, 2012 00:07
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 13:06
Compare 2D axi-symmetric and 3D. Is OpenFOAM calculate the velocity wrong? RalphS OpenFOAM 6 November 13, 2010 20:51
How to calculate gradient of pressure and velocity on an outlet face skabilan OpenFOAM Running, Solving & CFD 2 December 8, 2008 17:26
DPM velocity at cell face Szabolcs Varga FLUENT 1 September 16, 2004 07:30


All times are GMT -4. The time now is 06:47.