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

Random function UDF for boundary condition

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 28, 2003, 13:10
Default Random function UDF for boundary condition
  #1
Chris
Guest
 
Posts: n/a
Hi,

Does anyone know what to write in the UDF if I would like to generate a randomly varying pressure input? Is the command

rand()

or something?

Thanks in advance
  Reply With Quote

Old   March 28, 2003, 14:08
Default Re: Random function UDF for boundary condition
  #2
Chris
Guest
 
Posts: n/a
Actually, I want to do this because I would like to obtain a frequency response of a probe that I am modeling...

I figured that if I subject the system to a random input, and generate some output files, I can process the data in MATLAB or something to plot the frequency response curve...

I hope this bit of background information helps whoever's able to give me advice!

Gracias!
  Reply With Quote

Old   March 28, 2003, 14:28
Default Re: Random function UDF for boundary condition
  #3
Alex Munoz
Guest
 
Posts: n/a
Hi Chris

I have not used a random function in a UDF, however, you must be careful rand() function in C provides a uniform random number betweem 0 to RAND_MAX=32767 (always integer). Therefore I you want to generate a random number between 0 to 1 you have to divide the rand()/RAND_MAX. Don't know forget to feed somehow a seed generator for the random number srand()

In addition if you want to generate a normal distribution function a "bell" shape, you must to use another function, which potentially you could download.

Regards

Alex

  Reply With Quote

Old   March 28, 2003, 14:39
Default Re: Random function UDF for boundary condition
  #4
Chris
Guest
 
Posts: n/a
Thanks Alex. Where could I get the "potential" download?
  Reply With Quote

Old   March 28, 2003, 16:38
Default Re: Random function UDF for boundary condition
  #5
Alex Munoz
Guest
 
Posts: n/a
My friend

type on google "random number generation in C" or something related to the type of distributio that you need gauss, binomial, poisson etc.

Regards

Alex
  Reply With Quote

Reply

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
UDF function diverging ak6g08 Fluent UDF and Scheme Programming 1 December 23, 2013 06:05
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 13:06
OpenFOAM static build on Cray XT5 asaijo OpenFOAM Installation 9 April 6, 2011 12:21
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42
Droplet Evaporation Christian Main CFD Forum 2 February 27, 2007 07:27


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