CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   udf problem (http://www.cfd-online.com/Forums/fluent/33235-udf-problem.html)

 shan March 15, 2004 01:11

udf problem

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;

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);

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);

}

 FJ March 15, 2004 05:41

Re: udf problem

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

 shan March 15, 2004 06:00

Re: udf problem

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.

 FJ March 15, 2004 22:06

Re: udf problem

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

 shan March 16, 2004 05:11

Re: udf problem

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?

shancfd

 FJ March 17, 2004 02:20

Re: udf problem

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

 shan March 17, 2004 04:01

Re: udf problem

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

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