CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

How to set more than one UDF?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   August 14, 2013, 09:30
Default How to set more than one UDF?
  #1
New Member
 
Alex Lozovskiy
Join Date: Aug 2013
Posts: 11
Rep Power: 3
majinsaha is on a distinguished road
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.
majinsaha is offline   Reply With Quote

Old   August 15, 2013, 03:15
Default
  #2
New Member
 
alireza
Join Date: May 2013
Location: shiraz
Posts: 11
Rep Power: 4
alireza9359300 is on a distinguished road
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)
}

-----------------------------------------------
alireza9359300 is offline   Reply With Quote

Old   August 15, 2013, 03:42
Default
  #3
New Member
 
Alex Lozovskiy
Join Date: Aug 2013
Posts: 11
Rep Power: 3
majinsaha is on a distinguished road
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.
majinsaha is offline   Reply With Quote

Reply

Tags
udf

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ICEM] ICEM Scripting Issues tylerplowright ANSYS Meshing & Geometry 17 June 3, 2012 21:23
Instalation on ubuntu 710 basilwatson OpenFOAM Installation 17 March 16, 2012 21:16
How to set a udf like this? aleisia Fluent UDF and Scheme Programming 0 March 29, 2011 21:50
Installation problems indy OpenFOAM Installation 7 April 3, 2009 09:40
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08


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