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/)
-   -   How to set more than one UDF? (http://www.cfd-online.com/Forums/fluent-udf/122205-how-set-more-than-one-udf.html)

majinsaha August 14, 2013 10:30

How to set more than one UDF?
 
Is there a way to define UDFs for more than one boundary condition?
I prepare several files in a form
Code:

/**********************************************************************
unsteady_pressure.c
UDF for specifying a transient pressure profile boundary condition
***********************************************************************/

#include "udf.h"

DEFINE_PROFILE(unsteady_pres, thread, position)
{
  face_t f;
  real t = CURRENT_TIME;

  begin_f_loop(f, thread)
  {
    double a = 101000*t;
    if (a>101000) a = 101000;
    F_PROFILE(f, thread, position) = a;
  }
  end_f_loop(f, thread)

}

only changing "unstead_pres" into some other name and the value of a. Fluent only sees the udf I interpreted last! I cannot make him see three different functions.
So I assume I need to put all my different functions intended for different boundaries in just one file. How should I do that? Are there any examples? Thanks.

alireza9359300 August 15, 2013 04:15

you can use your udf files in a file like this
it was tested.
-------------------------------
#include "udf.h"

DEFINE_PROFILE(inlet_x_velocity, 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)= 20.- y*y/(.0745*.0745)*20.;
}
end_f_loop(f,thread)
}
DEFINE_PROFILE(unsteady_velocity, thread, position)
{
face_t f;
begin_f_loop(f, thread)
{
real t = RP_Get_Real("flow-time");
F_PROFILE(f,thread,position)= 2000.+ 100*t;
}
end_f_loop(f,thread)
}

-----------------------------------------------

majinsaha August 15, 2013 04:42

I already find out the reason. I should have put all three boundary conditions in just one file, with three different functions DEFINE_PROFILE. Befoe I tried to create a separate file for each, which was a mistake.
Thanks for your time.


All times are GMT -4. The time now is 18:11.