
[Sponsors] 
November 13, 2008, 06:42 
Area of a particular face of the cell using UDF

#1 
Guest
Posts: n/a

Hi, Can any body tell me hoe to get the area of a particular cell using UDF. Becoz my main intention is to calculate the surface integral of a scalar over a particular interior face. Any sor tof help is appreciated. Bye


November 13, 2008, 09:23 
Re: Area of a particular face of the cell using UD

#2 
Guest
Posts: n/a

Hi! In FLUENT the face area is given as the magnitude of the face normal vector. See UDFmanual chapter 3.2.4 Face Macros.
the udf macro is the following: DEFINE_ON_DEMAND(calculate_area) { Domain *d = Get_Domain(1); Thread *ft; face_t f; real area = 0.; thread_loop_f(ft,d) { begin_f_loop(f,ft) { real NV_VEC(farea); F_AREA(farea,f,ft); area = NV_MAG(farea); } end_f_loop(f,ft) } } 

March 12, 2013, 05:37 
if?

#3 
New Member

If You have the area and the pressure You can calculate the force.... But if the face has an inclination how to get the force components in the x y direction and not just normal to the face?????


March 31, 2015, 05:31 
Not working

#4 
Member
Baradwaj B S
Join Date: Jan 2015
Posts: 70
Rep Power: 2 
Dear all,
I tried the code above for calculating the surface area of a surface whose zone id is known. It is showing Area as 0.0000. I tried with both DEFINE_INIT as well as DEFINE_ON_DEMAND function. Please anybody having Idea on this help me. It will be of great help for me. Thanks in advance, Bharadwaj B S 

March 31, 2015, 07:31 

#5 
Senior Member
Join Date: Nov 2013
Posts: 677
Rep Power: 9 
The code above only calculates the area, it does not show the area. So if you used this code, I am surprised you saw a number on your screen... You probably used a different code.


March 31, 2015, 07:49 
Message()

#6 
Member
Baradwaj B S
Join Date: Jan 2015
Posts: 70
Rep Power: 2 
Dear pakk,
I used Message() function to verify the result. During initialization, It showed 0.0000. And it kept on increasing once the calculations started and continued. It never stopped. I wonder whether it is because of face looping. Pardon me and correct me if I have interpreted the facts wrongly. Thanks you, Bharadwaj B S 

March 31, 2015, 07:51 

#7 
Senior Member
Join Date: Nov 2013
Posts: 677
Rep Power: 9 
If you do Message(), nothing will return. Something should be inside the brackets.
Don't make this a puzzle hunt. If you need help, just share the code that you used, don't let us guess what you did. 

March 31, 2015, 08:00 
Code

#8  
Member
Baradwaj B S
Join Date: Jan 2015
Posts: 70
Rep Power: 2 
Dear pakk,
The code which I used for calculating area. Vectors and other needed variable I have declared globally. Quote:
Thank you, Bharadwaj B S 

March 31, 2015, 08:10 

#9 
Senior Member
Join Date: Nov 2013
Posts: 677
Rep Power: 9 
In that case, if you face area is for example 0.000001251, you would indeed see "Area is 0.0000".
If you want more accuracy in your answer, you should tell Fluent to do that. IF my memory is correct: Code:
Message("Area is %e\n",At); Code:
Message("Area is %1.15f\n",At); 

March 31, 2015, 09:20 
Thank you.

#10 
Member
Baradwaj B S
Join Date: Jan 2015
Posts: 70
Rep Power: 2 
Dear pakk,
Thank you very much for suggestion. I will try this. And let you know about results. Bharadwaj B S 

April 2, 2015, 06:06 
Working

#11  
Member
Baradwaj B S
Join Date: Jan 2015
Posts: 70
Rep Power: 2 
Dear all,
The function is working fine. I was using DEFINE_ADJUST instead of DEFINE_ON_DEMAND. Pardon me for doubting on the thread. Quote:


May 13, 2015, 07:06 

#12 
New Member
Join Date: Oct 2014
Posts: 11
Rep Power: 2 
Dear Bharadwaj B S,
i need to calculate total area of all negative valued static pressure cells on a face. Can you guide me? Thank you, 

May 13, 2015, 07:10 
info

#13 
Member
Baradwaj B S
Join Date: Jan 2015
Posts: 70
Rep Power: 2 
Dear sozen,
I cannot say I can guide you but I can help you on how to calculate the area using UDF. Can you brief me more? I will try to help. regards, Bharadwaj B S 

May 15, 2015, 02:24 

#14 
New Member
Join Date: Oct 2014
Posts: 11
Rep Power: 2 
Thank you dear Bharadwaj B S,
I've got static pressure results over a cylindrical face which contains some negligibleunphysical negative pressure values. All literature studies set these negative values to zero by using UDF. I actually need to calculate surface integral for [pressure=0...p_max] with neglected negative values. I checked that fluent calculates surface integral = surface average * area But this integrated calculation still contains all zeroed area and it disturbs the calculation. So if I'd gotten this zeroed area I could calculate integrals manually only for positive area. Thanks in advance.. Sozen Last edited by sozen; May 18, 2015 at 06:41. 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Face Area  Corentin  FLUENT  2  April 9, 2008 11:33 
how to get cell face area in RADPRO.F  cthsieh  CDadapco  1  January 2, 2007 09:53 
how to get cell face area and U in registers  chinayu  CDadapco  3  May 16, 2006 08:47 
cell velocity U and its cell face area  Chinayu  CDadapco  0  May 6, 2006 22:44 
Face area  gg  FLUENT  0  June 30, 2003 04:18 