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/)
-   -   multiple UDFs (http://www.cfd-online.com/Forums/fluent-udf/63239-multiple-udfs.html)

mmdmov April 1, 2009 15:36

multiple UDFs
 
Hi,

I want to have an "initialization" and an "adjust" udf. when I interpret both, the first one is removed from the list.

For example my udfs are "my_init" and "my_adjust". First I interpret "my_init". Then I interpret "my_adjust", at this time "my_init" is removed from the list when I want to hook udfs.

Any ideas?

Thank you

coglione April 2, 2009 03:21

Are both UDF's embodied in one single c-file? If not put them together.

cheers

Chicken April 21, 2009 05:58

Quote:

Originally Posted by coglione (Post 211682)
Are both UDF's embodied in one single c-file? If not put them together.

cheers


Hi!
I have a question. You said that both codes should be in the same file. I am using UDF for transient velocity inlet (Y axis) and it is working, so I tried to add second UDF for parabolic velocity profile (steady flow along X axis) but still there is a problem... "Error: udfconfig.h: line 22: parse error."

Could somebody tell me how to "put them together" because it is my first time with UDF...

This is the code:

/************************************************** *********************
vprofile.c
UDF for specifying steady-state velocity profile boundary condition
************************************************** **********************/
#include "udf.h"
DEFINE_PROFILE(inlet_y_velocity, thread, position)
{
float x;
float y[3];
face_t f;
begin_f_loop(f, thread)
{
F_CENTROID(y,f,thread);
x = y[1];
F_PROFILE(f, thread, position) = 0.028 + x*x;
}
end_f_loop(f, thread)
}

/************************************************** ********************
unsteady.c
UDF for specifying a transient velocity profile boundary condition
************************************************** *********************/
#include "udf.h"
DEFINE_PROFILE(unsteady_velocity, thread, position)
{
face_t f;
real t = CURRENT_TIME;
begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) = 1.0*sin(10.*t);
}
end_f_loop(f, thread)
}


Thanks a lot.
Marcin

p.s. Separated codes work normally but together - error :|

mmdmov April 21, 2009 07:35

remove the second #include udf.h

mmdmov

Chicken April 21, 2009 07:42

Thank you very much!
It was so simple... Now it works :D

Thank you one more time.
Marcin


All times are GMT -4. The time now is 08:42.