CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

how to write UDF to define 2 profiles at inlet?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 1, 2003, 08:12
Default how to write UDF to define 2 profiles at inlet?
  #1
emma
Guest
 
Posts: n/a
Hi,all!

I want to give the velocity and at the same time pressure profile at inlet of a 2-D geometry. How can I write the right UDF? With which macro? Or is there any solution to this issue except UDF? Hope somebody can help me.

Emma
  Reply With Quote

Old   December 1, 2003, 09:07
Default Re: how to write UDF to define 2 profiles at inlet
  #2
Andrew Garrard
Guest
 
Posts: n/a
You can right a UDF to give a profile for velocity or pressure at the inlet and this is relativly simple. Are you sure you wish to specify both a pressure and velocity profile. It is normal pactice to specify either the velocity or the pressure at one boundary and get the code to calculate the result of the other variable. However, if you wish to set both and think you will obtian a physical result I would use a define profile for the velocity inlet and a define adjust to set the pressure, it would be something like this:

#include "udf.h"

DEFINE_PROFILE(inlet_vel, thread, i)

{

face_t f;

begin_f_loop(f, thread)

{

F_PROFILE(f, thread, i) = [function for the velocity inlet profile];

}

end_f_loop(f, thread)

}

DEFINE_ADJUST(pressure, d)

{

face_t f;

Thread *thread = Lookup_Thread(d, [inletID]);

begin_f_loop(f, thread)

{

F_P(f, thread) = [function of Pressure];

}

end_f_loop(f, thread)

}

I haven't checked or compiled it so have a play with it.
  Reply With Quote

Old   December 2, 2003, 08:16
Default Re: how to write UDF to define 2 profiles at inlet
  #3
emma
Guest
 
Posts: n/a
Hi Andrew,

Thanks a lot for your helpful advice! I tried it with the DEFINE_ADJUST macro to define the pressure on inlet. It's successfully interpreted and also hooked. I defined the pressure as a sinusoidal signal, which has a frequency of 100 Hz and the average is about 100 bar. But when I checked the monitor-surface result of this pressure, it's not sinusoidal and the average value is only 16 bar. What did I set wrongly? Or is it really a very bad practice to set the velocity and the presure profiles at the same place?

Regards,

Emma
  Reply With Quote

Old   December 2, 2003, 08:43
Default Re: how to write UDF to define 2 profiles at inlet
  #4
Andrew Garrard
Guest
 
Posts: n/a
This post was made recently:

http://www.cfd-online.com/Forum/fluent.cgi?read=16464

which explains it quite nicley.

As for the problem with the UDF, is your problem time dependant, as you mention 100Hz, if so you may need extra terms in your UDF.
  Reply With Quote

Old   December 4, 2003, 12:23
Default Re: how to write UDF to define 2 profiles at inlet
  #5
ccc
Guest
 
Posts: n/a
hi emma,

I am considering if it is possible to create new boundary types in fluent. Since we can set three velocity components on a face, I think giving two velocity components and pressure on the boundary should be proper.

However, what ap has said seems right and I am a little confused now.

good luck.

  Reply With Quote

Old   January 30, 2011, 06:22
Default define a surface or line source from FLUENT
  #6
Member
 
CJ
Join Date: Jun 2009
Posts: 34
Rep Power: 17
solefire is on a distinguished road
looks fine
solefire is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Missing math.h header Travis FLUENT 4 January 15, 2009 12:48
Help: using udf to define direction Bo FLUENT 1 July 16, 2008 07:47
Reaction Rate in UDF mahdi FLUENT 2 August 7, 2007 09:31
Urgent! Help on UDF to set inlet velocity Ray Hong FLUENT 4 December 30, 2005 13:32
How define porous media as INLET? Harry Qiu FLUENT 2 April 13, 2001 17:34


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