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

udf problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 15, 2004, 00:11
Default udf problem
  #1
shan
Guest
 
Posts: n/a
hi, I am trying to solve a problem in Fluent, and I define some "interior" surfaces zone in computational domain for the convenience of post processing. After calculation, I would like to take the contour plots and get the surface integrals at those surfaces. So, I have written a udf to get the pressure value at the certain surface with mass flow average. I found that the UDF can work well at boundary inlet or outlet surface while at those surfaces defined as interior type the UDF can not work. I am really confused.

I would greatly appreciate for your help.

#include ¡°udf.h¡±

DEFINE_ON_DEMAND(calculate_pre) {

Domain *d;

Thread *t;

face_t f;

int ID = 4;

/* ID is the zone number,which can be set as the number of the boundary inlet surface or that of the interior surface*/

real p_s = 0; /*static pressure*/

real p_s_temp = 0;

real massflow = 0;/*total mass flow rate at the surface*/

d = Get_Domain(1);

t = Lookup_Thread(ID);

begin_f_loop(f, t) {

p_s_temp += F_P(f, t) * F_FLUX(f, t);

massflow += F_FLUX(f, t);

}

end_f_loop(f, t)

p_s = p_s_temp / massflow;

printf("p_s = %f", p_s);

}
  Reply With Quote

Old   March 15, 2004, 04:41
Default Re: udf problem
  #2
FJ
Guest
 
Posts: n/a
Hi,

We are not able to get any values at interior(defalut interior type) via UDF. As your remarks, boundaries are O.K. We can get it.

FJ
  Reply With Quote

Old   March 15, 2004, 05:00
Default Re: udf problem
  #3
shan
Guest
 
Posts: n/a
Thanks for your response. As you know,we can get those values at the certain surfaces ,including interior type surfaces, with "Report/Surface Integrals..." command in FLUENT. Could you please tell me how FLUENT calculate that value?

In the UDF file,Can I get the value obtained from "Report" command.

I really need your hlep. Thanks in advance.
  Reply With Quote

Old   March 15, 2004, 21:06
Default Re: udf problem
  #4
FJ
Guest
 
Posts: n/a
Hi,

The value of "Report/Surface Integrals..." is calculated by interpolated values and this interpolation scheme is linear interpolation. So this value is not exact value .

"Report-Fluxes" at boundaries, the exact values are calculated . This function calculates really exact flux value from Fluent solver's values.

If you want to get exact value at specified face, you have to put a certain face at that place with GAMBIT or other preprocessor.

In Fluent, this operation can be done. With "Grid-Seprate-Cells" ,you can separate of your grid(default interior) .Fluent will makes a certain face in your grid and it's named as a new interior ,automatically. (Your grid is tet mesh , the separated interior will be a serrated face).

Then ,you select the new interior face in the panel of "Report-Fluxes" .The exact value is calulated.

This is the only way to get the values. Via UDF, any interior values can not be got.

Thank you

FJ
  Reply With Quote

Old   March 16, 2004, 04:11
Default Re: udf problem
  #5
shan
Guest
 
Posts: n/a
so, you mean,in the udf file, I can not get the exact values that calculated from "Report-Fluxes".

you konw, those exact values will be shown in the console window. and I have to copy the values from the console window for postprocessing. That is so inconvenient for me since there are so many cases.

Whether there has a method that can exported those values to a txt file?

Thank you in advance, FJ

shancfd
  Reply With Quote

Old   March 17, 2004, 01:20
Default Re: udf problem
  #6
FJ
Guest
 
Posts: n/a
Hi,

Yes. If an interior face, we can not get exact values.

I had the same problem before as well. To avoid it, I put the interior boundary(iterior face) when making mesh and made a udf to write external file.

The UDF's algorithm is calculating average values between C0, C1(adjucent cell at the interior). This calculated value is not so bad compared with "Report-Fluxes" in case of using hex mesh. In case of tet mesh , the error becomes a little large. I think this reason is the algorithm to calculating average values. If face vector components are used in average calculation, this error will be small, probably

Thank you

FJ
  Reply With Quote

Old   March 17, 2004, 03:01
Default Re: udf problem
  #7
shan
Guest
 
Posts: n/a
FJ, I greatly apperacite your help. Your expericnce is very precious to me. I will try it again with your method.

Thanks and regards,

shancfd
  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
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 06:05
Problem with my udf july Fluent UDF and Scheme Programming 3 June 20, 2010 06:56
UDF problem mansha goraya FLUENT 0 October 29, 2007 00:31
udf compiling problem akr FLUENT 3 August 22, 2007 07:14
UDF problem chiseung FLUENT 4 January 10, 2002 09:58


All times are GMT -4. The time now is 17:46.