- **FLUENT**
(*http://www.cfd-online.com/Forums/fluent/*)

- - **results of transient analysis**
(*http://www.cfd-online.com/Forums/fluent/116891-results-transient-analysis.html*)

results of transient analysis2 Attachment(s)
Hi,
I am doing transient analysis. the temperature profile was hooked to Fluent as UDF file (attached the graph of the profile), which the range of temperature is between ~11C to ~27C. this profile considered as a convection boundary condition to the model. the results after 2 step with sizing of 10sec gives me temepraute of min -50C and max 26C. why its happen? any helps ? regards, |

Quote:
(1) The profile you specified is in degrees centigrade, this should be in Kelvin. You need to convert the equation to the kelvin equivalent. (2) It looks like your geometry is TOOOO large. From the graph, highest temperature is about 25.5 degree C at the geometry location 10.3 kilometres! You should be sure of what the dimensions are. To debug, try the following (adapted from your code) /************************************************** ********************* udfexample.c UDF for specifying transient temperature profile boundary condition ************************************************** **********************/ #include "udf.h" /*Remove this after debug*/ int stopper=1; DEFINE_PROFILE(Temp_Profile, thread, position) { real x[ND_ND]; /* this will hold the position vector */ real y; real theProfile; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; theProfile= (2e-12*y*y*y)-(2e-7*y*y)+(0.0029*y)+11.238; /* Are you using a double precision solver? 2e-12 is almost zero..just thinking */ if(stopper<20) {/*Dont hang my computer trying to print too much :) */ /*This will print the temperature profile Note the units used! */ CX_Message("Location y=%E (m) Temp.= %3.3f (Kelvin) \n", y,theProfile); stopper++; } F_PROFILE(f, thread, position) =theProfile; } end_f_loop(f,thread) } |

Thank you very much for the reply,
I changed the temperature formula to Kelvin for such a case. still the temperature variations are too much strange! indeed, my geometry is small with boundary dimensions of 200mm by 200mm by 200mm. I guess, there is some things wrong with my code! as I understood from your texts " It looks like your geometry is TOOOO large. From the graph, highest temperature is about 25.5 degree C at the geometry location 10.3 kilometres! You should be sure of what the dimensions are" the graph which is presented the temperature versus "TIME" (not dimension of the supposed model) In fact, I taking to account to control the time with time steps and sizing through the Fluent I am doing right? maybe here is my problem! in this situations I must be have UDF file with both temperature and time ? if so, how to do this? need help please, |

Quote:
If the x-Axis of the figure you attached is a time axis, then you have attached the wrong profile. From what you wrote, it seems you want to create a boundary profile that varies with time and perhaps with the face coordinate. eg theProfile=theProfile(y,t); where y is face coordinate and t is the current time. If that is true, then you need to know the following and adjust appropriately: x[ND_ND] means get the system of the solution, in your case, ND_ND would tell your code, it is a 3D case. Therefore, in the cartesian coordinate system, x[0] is the x-axis, x[1] is the y-axis and x[2] is the z-axis respectively. Calling, F_CENTROID(x,f,thread) in that loop and making y=x[1] will help you get the y axis coordinate for the boundary where you are hooking the UDF. It is not the time! You can modify the code by following this hypothetical example. T=255y^2+0.04t (y is the y-axis, and t is the current time) That is a parabolic temperature profile that changes with time. #include "udf.h" #include "mem.h" /*Remove this after debug*/ int stopper=1; DEFINE_PROFILE(Temp_Profile, thread, position) { real x[ND_ND]; /* this will hold the position vector */ real y; real theProfile; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; t = CURRENT_TIME; theProfile= 255.0*pow(y,2.)+0.04*t ; /*Note the .0 after 255 */ if(stopper<20) {/*Dont hang my computer trying to print too much */ /*This will print the temperature profile Note the units used! */ CX_Message("Location y=%E (m) Temp.= %3.3f (Kelvin) Flow time =%g \n", y,theProfile,t); stopper++; } F_PROFILE(f, thread, position) =theProfile; } end_f_loop(f,thread) } -------------NB It is possible you are doing your work in a too complicated way than is actually required. You should first test with constant boundary conditions before using a UDF. Eg Set the Temp. to 350K and see if it is still giving crap results. If it is doing that, then make sure you have a good mesh and set the other boundary conditions right. Good luck with it. |

1 Attachment(s)
Thank you very much for your effort on my problem,
As you suggest in my case, I did several analysis with constant temperatures (eg. 10C, 15C, 20C) and it gives lojical results through the model. regarding to check the Fluent results I am seeking for analytical solutions in this stage. Regarding to your second suggestion, how can I be sure about the mesh ? I mean, what parameter needed to be evaluate due to the mesh performance on the model structure ? I just create the mesh according to some tutorials and so on. don't you mean that, I should change the dimension of the mesh or change in the methods of the meshing to see the effect on the results ? give me your feedback on this question please, my problem is 3D model which is compose of solid and air parts, I want to impose the temperature profile (corresponding formula) to the boundary condition as convention load to boundary surfaces of the model, am I doing right way? About the code that supposed to be use for my purpose: I have an error "parse error" it belong to "theProfile=(2.0e-12*pow(y,3.)-(2.0e-7*pow(y,2.)+(0.0029*pow(y,1.)+(284.39);" when I write the formula according to this :"theProfile=(2e-12*y*y*y)-(2e-7*y*y)+(0.0029*y)+(284.39);" the error will be solved. is there any difference between this two formula ? as you suggested I should write like the first one. when the second written formula used I have an error belong to this line " { CX_Message("Location y=%E (m) Temp.= %3.3f (Kelvin) Flow time =%g \n", y,theProfile); stopper++; }" which its "Error: C:\\Users\\Mohammad\\Desktop\\Solidwork-ANSYS-FLUENT\\TransientTempProfile.C: line 44: function "CX_Message" not found (pc=174)" #include "udf.h" #include "mem.h" int stopper=1; DEFINE_PROFILE(Temp_Profile, thread, position) { real x[ND_ND]; real y; real theProfile; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; theProfile=(2.0e-12*pow(y,3.)-(2.0e-7*pow(y,2.)+(0.0029*pow(y,1.)+284.39; if(stopper<20) { CX_Message("Location y=%E (m) Temp.= %3.3f (Kelvin) Flow time =%g \n", y,theProfile); stopper++; } F_PROFILE(f, thread, position) =theProfile; } end_f_loop(f,thread) } another question that I have, when I am using transient analysis, its possible to give sizing and time steps before calculation in Fluent. so in this such a way, the temperature profile should be writen as time dependent again ? Sorry for presenting a lot of questions... regards, |

The "parser error" occurs because the parenthesis are not balanced.
theProfile=(2.0e-12*pow(y,3.))-(2.0e-7*pow(y,2.))+(0.0029*pow(y,1.))+(284.39); Use the 'pow' function is more powerful but they do not make much difference here. Try to use Message0 instead of CX_Message and modify the format string according to the number of arguments, i.e., Message0("Location y=%E (m) Temp.= %3.3f (Kelvin) \n", y, theProfile); Regarding to your last question, I am confused, whether the temperature is a function of y or a function of t? |

1 Attachment(s)
Thank you very much for the reply,
Regarding to the change in the below line of the code: CX_Message("Location y=%E (m) Temp.= %3.3f (Kelvin) Flow time =%g \n", y,theProfile); with Message0("Location y=%E (m) Temp.= %3.3f (Kelvin) \n", y, theProfile); the error not solved ": line 45: function "CX_Message" not found (pc=184)." due to answer your question "Regarding to your last question, I am confused, whether the temperature is a function of y or a function of t? "the temperature in a function of time as its shown in the graph attached to this post. am I doing right? in deed, I want to use this "temperature-time" profile as convection load in boundary condition to the 3D model at outer surfaces. please provide feedback on this issues, regards, |

My bad. The "Message" function could not be used for interpreted UDF. So just comment that line out.
As you said, the temperature is a function of time. Then you should change this line y = x[1]; to y = CURRENT_TIME; Also note that your analysis type should be transient analysis. |

Thank you very much for the guidance,
I did the changes and its hooked to Fluent. A point that I couldn't understand the reason of why we must use Kelvin unit instead of Celsius for the temperature at UDF file ? Many thanks, |

According to the fluent user's guide:
You must always define the following in SI units, regardless of the unit system you are using: – Boundary profiles – Source terms – Custom field functions – Data in externally-created XY plot files – User-defined functions |

Quote:
would you please tell me what does mean, when we change y = x[1]; to y = CURRENT_TIME; ? the current time will be called from where ? does it means that, the current time is from time steps ? as I have defined Temperature-Time variation by formula. I want to have exact profile (independent profile of time steps or any things). how to have it ? regards, |

All times are GMT -4. The time now is 15:10. |