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

Calculating the centre of a surface

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By syavash

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 17, 2012, 13:11
Default Calculating the centre of a surface
  #1
Member
 
Join Date: Sep 2012
Location: FL
Posts: 79
Rep Power: 14
victoryv is on a distinguished road
I need to find centroid of multiple boundaries to implement in equation in UDF. I want Fluent to calculate the coordinates (x,z) of the centroid. I have written a code for area weighted centroid. I am getting an error. Can someone tell me what am I doing wrong?
( I think its with the A(). I need to calculate area in xz planes. Is it right?)

/* Calculating the centroid of the Boundary*/
begin_f_loop(f, thread)
{
F_CENTROID(p,f,thread);
F_AREA(A,f,thread);
a = (p[0]*A[1])+a;
b= (p[2]*A[1])+b;
}
end_f_loop(f, thread)

begin_f_loop(f, thread)
{
F_AREA(A,f,thread);
d = A[1] + d;
}
end_f_loop(f, thread)
k=a/d;l=b/d;

Last edited by victoryv; October 17, 2012 at 17:59.
victoryv is offline   Reply With Quote

Old   October 17, 2012, 20:27
Default
  #2
Senior Member
 
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18
syavash is on a distinguished road
Quote:
Originally Posted by victoryv View Post
I need to find centroid of multiple boundaries to implement in equation in UDF. I want Fluent to calculate the coordinates (x,z) of the centroid. I have written a code for area weighted centroid. I am getting an error. Can someone tell me what am I doing wrong?
( I think its with the A(). I need to calculate area in xz planes. Is it right?)

/* Calculating the centroid of the Boundary*/
begin_f_loop(f, thread)
{
F_CENTROID(p,f,thread);
F_AREA(A,f,thread);
a = (p[0]*A[1])+a;
b= (p[2]*A[1])+b;
}
end_f_loop(f, thread)

begin_f_loop(f, thread)
{
F_AREA(A,f,thread);
d = A[1] + d;
}
end_f_loop(f, thread)
k=a/d;l=b/d;
The problem is right here, if you want to access Area magnitude of a boundary face, you have to implement this macro:
area=NV_MAG(A);
instead of "A[1]"
Goodluck
letsroll likes this.
syavash 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
[Gmsh] Problem with Gmsh nishant_hull OpenFOAM Meshing & Mesh Conversion 23 August 5, 2015 03:09
Calculating the Wall Shear Stress Gradient over surface 123catty456 Main CFD Forum 1 October 1, 2012 23:27
killed "snappyHexMesh" parkh32 OpenFOAM Pre-Processing 2 April 8, 2012 18:12
mass flow rate on the Iso-clip surface & interior Sunil Gupta FLUENT 0 April 22, 2008 10:29
user surface in post xinzhangabc CFX 0 February 24, 2005 07:29


All times are GMT -4. The time now is 20:58.