# Seek help in writing UDF

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

 June 12, 2007, 09:05 Seek help in writing UDF #1 Jack Martinez Guest   Posts: n/a Hello everybody I seek urgent help in writting a UDF. I need to write a UDF that can extract temperature at the boundary wall face and an adjacent cell centroid in interior. The difference of these temperature is used with heat flux data (that has also to be extracted) at the boundary wall to calculate the heat transfer coefficient (HTC) over one particular face. This heat transfer coefficient (HTC) will then be exported to a C++ program for further calculations. OR If there is some alternate way (using GUI or other) by which we can calculate the heat transfer coefficient (calculated with-in FLUENT) over a boundary face and can export it in a C++ program without using any TEXT USER INTERFACE (EXCEL; WORD; NOTEPAD file), this procedure then has to be repeated to calculate HTC over all the faces on the boundary.. Can someone please extend some help in writing this UDF. Thanks in advance. Jack.

 June 12, 2007, 19:29 Re: Seek help in writing UDF #2 Tomasz Bednarz Guest   Posts: n/a This should help, kindest regards, Tomasz d = Get_Domain(1); tf = Lookup_Thread(d,Face_Id); tc = Lookup_Thread(d,Cell_Id); c0=F_C0(f,tf); begin_f_loop(f,tf) { face_wall_value = F_T(f,tf); neubouring_cell_value = C_T(c0,tc); } end_f_loop(f,tf)

 June 13, 2007, 03:16 Re: Seek help in writing UDF #3 Jack Martinez Guest   Posts: n/a Hello Mr. Berdnarz Thank you very much for your prompt reply. Regarding your solution posted, kindly clarify my few queries:- 1. To my understanding, You have included separate Lookup_Thread for extracting thread pointer for wall face and the adjacent cell but the zone_id which, we need to define for using this Macro, is available only for wall faces (= zone_id at the particular boundary) how can we get the zone_id for adjacent cells. 2. Kindly suggest me some Macro to extract the wall heat flux at the same boundary face (Face_Id). 3. Do you have idea about script using which we can transfer the computed results, using this UDF, in the solver directly to a C++ program. please give some input on:- if we define a UDS for HTC and store it in UDM... will there be a possibity of accessing this HTC in other program while the solver is still running.

 June 13, 2007, 10:30 Re: Seek help in writing UDF #6 Tomasz Bednarz Guest   Posts: n/a Hi Jack, > 1. Does the face_ID & cell_ID hold different values? : In that case how can we get the zone_ID for the cells. ' Of course they are not the same... You can check ID in Fluent when defining BC for instance... > 2. If same, then then what is the advantage of using two no, they are not the same... > Please give some more input on "run Fluent having paths correctly defined for the compiler. then do your UDF in install visual studio, and there you have batch file which runs all env variables... from command prompt run fluent and you are there > I need to transfer HTC values calculated on the face values after every iteration/time step to the C++ compiler. shoudn't be a problem... please refer to the manual - you have examples and almost ready solutions there, regards, Tomash

 June 13, 2007, 11:51 Re: Seek help in writing UDF #7 Nitesh Goyal Guest   Posts: n/a Hi Ok, if the zone id for cell is different then that of face at boundary, which one you would suggest to assign to the cell adjacent to the wall, the zone id of fluid or zone_id of interior. I checked in BC panel, they hold different ids. I have to run my case in LINUX system. So I would be really thankful if you may please suggest me how to specify the path in FLUENT for GNU compiler to compile my UDF and also whether a dynamic library is neccesary or optional to link it with LINUX. Regarding Exporting the HTC values, which example are you refering to. I checked the UDF manual 6.3 but couldn't find the appropriate manual in which they have mentioned any details about computing the HTC values or exporting values from solver to other compiler for post-processing. Thanks in advance Regards Jack Martinez.

 June 13, 2007, 11:56 Re: Seek help in writing UDF #8 Jack Martinez Guest   Posts: n/a Oh, I used my Friends computer so the message appeared with his name.

 June 13, 2007, 21:42 Re: Seek help in writing UDF #9 Tomasz Bednarz Guest   Posts: n/a again: id_face should be your wall's zone id id_cell should be your fluid's zone id Linux: under Linux you don't need to care about setting env variables as it is under XP. only be sure, that gcc/gc++ compiler is in your path... The procedure of compiling in fluent is then the same... There are many examples of getting face values... writing them to the file then is not a big deal... for instance to save x location and the temperature: begin_f_loop(f,t) { F_CENTROID(xc,f,t); fprintf(fout, "%.8f\t%.8f\t", xc[0], F_T(f,t)); ... Hope it helps,

 June 14, 2007, 10:24 Re: Seek help in writing UDF #10 Jack Martinez Guest   Posts: n/a Below mentioned is the UDF I hace conceptualised but due to problem in compiler I couldn't check it yet. Please give some input on it... d=Get_Domain(1); t = Lookup_Thread(d,Face_Id); begin_f_loop(f,t) { c0 = F_C0(f,t); t0 = F_C0_THREAD(f,t); temp_wall = F_T(f,t); temp_grad = C_T_G(c0,t0)[1]*C_VOLUME(c0,t0); heat_flux = k_cond*temp_grad; if(!FLUID_THREAD_P(t0)) return; temp_adj = C_T(c0,t0); h = heat_flux/(temp_wall â€" temp_adj); /*printf("Temp_Wall: %g\n Temp_Cell_Centroid: %g \n HTC: %g",temp_wall, temp_adj, htc);*/ } end_f_loop(f,t) } Looking forward for ur comment.. Also please let me know do u have experience with running Fluent in Batch Mode. I have some basic queries in that Regards Jack Martinez...

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Geisel Fluent UDF and Scheme Programming 5 June 21, 2010 08:38 ardalan soleymani FLUENT 0 July 11, 2007 01:09 Sandilya FLUENT 0 May 31, 2007 12:03 KKLAU FLUENT 1 April 6, 2004 23:58 umesh FLUENT 1 June 13, 2003 04:20

All times are GMT -4. The time now is 23:43.