UDF temperature profile
Hello every body.
I have a geometry with inlet dimension of z=1.2 and y=2.46 at the inlet. I want to define an inlet temperature profile at the inlet using UDF. the temperature varies along the y coordinate. #include "udf.h" DEFINE_PROFILE(inlet_x_temperature, thread, position) { real x[ND_ND]; /* this will hold the position vector */ real y; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; F_PROFILE(f, thread, position) = ...; } end_f_loop(f, thread) } But I got error. "floating point exception" this is simple sketch of the geometry: I think something with the coordinate should be the problem. could any body help me? Moreover I read somewhere that it is possible to define the boundary with the coordinated. for instance I have two array y = [0.2 0.4 ... 2.4] t = [21 15 ... 18] then I can define a temperature inlet profile based on the y coordinate and temperature array. Any idea? thanks. 
Which formula describes your function? Without knowing what you put instead of the "..." in
F_PROFILE(f, thread, position) = ...; no one can guess what is causing the error. 
Sorry.
I think it is not important!! F_PROFILE(f, thread, position) = 19.59+0.532*y+0.36*y*y0.157*y*y*y; 
Wait a minute: When does the error occur?
When you try to interpret/compile your UDF or during the solution process? What are the possible values y can have, i.e. what is the physical extent of the boundary? 
I got error at the beginning of simulation process, no error for interpret/compile.
y values start from zero to 2.46 (the y dimension of the geometry). I have a data array for y and temperature as below: y = [0.2 0.4 0.6 ... 2.2 2.4] temp = [19 20 20.4 .... 19.54 20] So the UDF should specify this temperature profile at the inlet varied in y direction. see the above figure. 
I guess that the problem arises from the °C/K difference.
Fluent expects the output of UDFs to be in SIUnits. Therefore, the output of the UDF is interpreted as a Temperature between 21 and 23 K. This might be inconsistent with the initial values you provide, causing the solution to diverge. For the definition of BCs via arrays: Fluent can read (and write) profiles for boundary conditions. The easiest way to get familiar with is is to write such a profile at the boundary condition of interest. From the file created, you can derive the necessary file format to provide profile data. 
Hello and thanks a lot for your helpful hint.
I change my equation to SIUnits and everything done. just few questions: could you please briefly describe what theses lines means. real x[ND_ND]; /* this will hold the position vector */ what "this will hold the position vector" exactly mean? also real y; face_t f; F_CENTROID(x,f,thread); y = x[1]; for instance y = x[1]; if I change it to y = x[0]; then what is going on? if my temperature varies along the Z or X coordinate, then how should I change the code? I am quite familiar with C programming. I understand the loop. just I have problem with the coordinated and so on. thanks. 
Glad I could help.
Lets take a look at your further questions. x[ND_ND] is an array of dimension 2 if you are running the 2D solver and dimension 3 if you are running the 3D solver (which is obviously the case). Accordingly, x[0] corresponds to the xposition, x[1] is the y position and x[2] is the z position. Now the comment "this will hold the position vector" should become clear. with "real y" you define a variable of type real with the name y. Usual syntax... face_t f : same thing, f appears in the loop arguments. The exact definition can be found in the UDF manual. F_CENTROID(x,f,thread); Here you evaluate the position of the face centroid and assign it to the variable x. y=x[1]; This step is a bit redundant. You might aswell use x[1] in the following equation directly. It just makes the equation look better and maybe saves some computing time. 
Hello again and thanks for your helpful answer.
Just one more questions. How can I use two profile simultaneously? when I add the second one, then the first is vanished and I cannot use it anymore in the boundary setting! For instance I want to use both velocity and temperature profile at the inlet at the same time. first I have interpreted the velocity and then, when I interpreted the temperature profile, then the first one in not available in the boundary setting to select. what should I do? thanks. 
Did you try to put both UDFs in one text file?
Then when interpreting the file, both UDFs should be available. 
Great!
It works. thank you so much. 
hi
i need a udf for a project work. I'm quite new to this area and have a very short time frame for completing this work. so i really need your help. I need a linearly varying temperature profile boundary condition to be applied on the circular face of a cylinder.temperature varies from 25 to 50 degrees from bottom to top. diameter of circle is 470 mm . Can you help me??? 
"Linearly varying" with respect to which variable?
Could you make a small sketch of what you need? 
thanx for replying . consider a horizontal cylinder. on one of its circular faces i need this temperature variation from bottom to top. http://www.filesnack.com/files/ch9qollj

Since you refuse to be more descriptive, I have to make some assumptions ;)
With "degrees" you mean °C, so I change the temperature variation from 298K323K. The xaxis coincides with the axis of the cylinder and the yaxis is from "bottom" to "top". Thus the temperature varies linearly with the yaxis, with the highest temperature at the greatest positive yextent of the surface. Code:
#include "udf.h" 
have you seen the image i attached ?? i'm not sure if it is visible or not . else please tell me i will upload another one.

I dont see an image attached to your post.

1 Attachment(s)
i'm uploading it again. thanx for your help

Without a coordinate system, this image doesnt add much information.
Did you at least try the UDF i proposed 4 posts ago? Just change x[1] if the yaxis is not the direction in which the temperature rises. 
sorry for not mentioning the coordinates. axis of the cylinder is in z direction and temperature rise is in y direction .Does that change anything in the code?? i tried the given code and it runs without any problem. Also may i know your real name so that i can give you credits in the report i'm going to make??

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