CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF-temperature profile (http://www.cfd-online.com/Forums/fluent-udf/116712-udf-temperature-profile.html)

ahvz April 23, 2013 14:34

UDF-temperature profile
 
Hi all,

I had input the below file to the FLUENT as boundary condition. why its not work ? where is my mistake? I know its not work becuase after analysis the fluent used constant temperature (its default value).


start the program:


#include "udf.h"

DEFINE_PROFILE(Temp_Profile, thread, position)
{
face_t f;
real x[ND_ND]; /* this will hold the position vector */
real y;

begin_f_loop(f, thread)
{
F_CENTROID(x,f,thread);
y = x[0];
F_PROFILE(f, thread, position) = (9e-5*y*y*y*y*y)-(0.0038*y*y*y*y)+(0.028*y*y*y)+(0.3856*y*y)-(2.3528*y)+11.456;

}
end_f_loop(f,t)
}

A CFD free user April 23, 2013 16:34

Hey
I suppose you need to change y=x[0] to y=x[1]. C language recognize
x=x[0]
y=x[1]
z=x[2]
Try it

ahvz April 23, 2013 18:08

Thank you very much for the reply,

still the same problem...

Regards,

blackmask April 23, 2013 21:49

How do you hook your UDF? Does y vary at the boundary your UDF is hooked to?

By the way, although
end_f_loop(f,t)
only serves as dummy placeholder, for clearness it should be rewritten as
end_f_loop(f, thread)

ahvz April 24, 2013 05:02

1 Attachment(s)
Hi,

I am trying to do transient analysis. the attached file shows what I want to write at UDF file which is temperature versus time. for now I prepared the below C program:

first, I am not sure the program is true.

second, if its true why after interrupting its attached to program but its not work ( I know because the default value considered automatically by the Fluent during the analysis process).

start the UDF file :


#include "udf.h"

DEFINE_PROFILE(Temp_Profile, thread, position) /* Temp_profile is alternative, thread is boundary,
{
face_t f;
real x[ND_ND]; /* this will hold the position vector */
real y;

begin_f_loop(f, thread)
{
F_CENTROID(x,f,thread);
y = x[1];
F_PROFILE(f, thread, position) = (-9e-27*y*y*y*y*y*y)+(2e-21*y*y*y*y*y)-(2e-16*y*y*y*y)+(1e-11*y*y*y)-(2e-7*y*y)+0.0009*y+9.4751;

}
end_f_loop(f,thread)
}


any helps?


thanks,

A CFD free user April 29, 2013 12:51

Hey
I didn't take your point by saying " if its true why after interrupting its attached to program but its not work ( I know because the default value considered automatically by the Fluent during the analysis process)", but I think you need to try this:
1- There should be a space between face_t and f. Don't neglect that.
2- Try to define your variable as float.
3- Change " position" to "index".
I don't see anything weird in your code any more longer. By the way, are you trying to write a code to define a periodic temperature profile? A friend of mine has the same problem. If so, I suppose you should change your code and consider the periodic profile as well.
I look forward to hearing more.

ahvz April 29, 2013 13:00

thank you for the reply,


All times are GMT -4. The time now is 03:31.