Writing UDF (DEFINE_PROFIL) for two surfaces
I am a little bit confused, UDF is a new thing for me, never tried it (never need it) but now i have to calculate something different.
The matter is a two different size surfaces inside some space (as on sketch), each has different temperature profil.
I have tried to write UDF code in order to set proper termal distribution along two surfaces and only the upper one is evenly distributed, for bottom surface it is completly incorrect (I had a negative temperatures what is impossible for my case).
I think the problem can lies on coordinates taken into consideration for both surfaces.
Maybe for cases including more than one UDF functions (for couple things in Fluent) syntax looks completly different... I do not know, did not find that in UG.
I appreciate for any help or tips.
enclosured code and sketch:
Have a nice day
I cant understand what ur model is,but i can told u that:
x= x coordinate
x= y coordinate
x= z coordinate.
define_profile is used to specify values in BCs and as i can find out lines 1,2 r interior, and i think it's not correct to use this macro here. if u wanna specify temp in part of ur studied domain u can use define-adjust profile to do this.
in addition u can test ur udf with printf() to see the answers in fluent graph window.
F_PROFILE(f,thread,index)=191.8 + 178.474*y;
the bold is important
Thank you for your reply,
Sketch was a rough interpretation of my work. My project is a plate heat exchanger with sophisticated shape of corrugations. I am trying to obtain a much simpler model of it trying to set a proper (analytical results) temperatures along the fluid flow. Actual those lines are rectangular shapes of plates.
From the UDF UG examples chapter I know that 0,0 coordinates should be on the middle of surface, in my case 0,0 is at the bottom left end of outlet surface. Can this be a problem? I used F_centroid because i thought that UDF will take those coordinates as an origin for calculation, but the temperature distribution is not the same like in my code.
I have tried to put:
but Fluent says that F_profile is undeclared
I am experienced with Fortran, but nonetheless it has a little bit different syntax
I found the reason. In UDF all variables must be in SI i.e. temperature in K, I set it in C grad.
The second one was the length y. I thought that y in formula is (current surface length)/2 but it looks like y = the whole length.
i'm not experienced with heat transfer. and i dont know what do u want to do and if it is correct or not. but i think can help u to write this udf.
at first, u wanna specify temp in line 1&2,is it right?
if it is, so line 1&2 are intereior/thread and as i told u, ]u cant use f_profile(it is used with define_macro to specify values in boundary conditions,there is 3 arg in this macro f,t,i and the third one refer to type of your boundary for example if it is pressure outlet,it is refered to p value and here u dont have any thing that arg i is refer to it and it's why printf show u nothing )to specify temp in these lines.
u need to use define_adjust to do it. and how?
u have 2 option:
1. u can specify line 1 &2 as a interior(u can do it in gambit;e.g u can split your base figure with a right plane and specify the interior/interface as a wall. when u run your model in fluent,fluent automatically create a wall shadow and u can change wall to interior ).in this case there is a macro,Thread *t=Lookup_Thread(domain,ID), that can use it to find the thread ID(interior line) and u can use macro C_T(f,t) and i'm not sure if u can use F_T(f,t) in interior to define the temp of that cell/face centroid.
2.u can define an interior(e.g interior for x coordinate and in here a constant value for y coordinate).
i'm going to write a udf like the first one(but for pressure) and if u want i can share it with u in few days(maybe hours).
read the define boundary condition in just one cell face thread for some information about the macros.
about ur question, i think there is no problem, because i dont think there is any dependence between them,macro f-profile get the coordinates of the centroid and it's not depend on where the origin coordinate system is,and in addition u can test it with printf("aaaaaaaa:%f\n",y)
u can use this simple udf to get the centroid(if lines 1&2 have been defined in control panel and had ID no.)
int ID=line 1 or 2 ID;/*u can get the ID in define boundary condition panel
UDF is still beyond my comprehension, but I made a progress, though I have just started to learn it.
|All times are GMT -4. The time now is 23:23.|