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

Random number generator

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

Like Tree2Likes
  • 2 Post By flames

Reply
 
LinkBack Thread Tools Display Modes
Old   April 19, 2010, 03:04
Default Random number generator
  #1
New Member
 
Ahmad
Join Date: Apr 2010
Posts: 7
Rep Power: 7
ASaidZ is on a distinguished road
Hi all
I am wondering if anyone can help me to use the random number generator to select some cells on a boundary and to give them different boundary condition.
Thanks
AsaidZ
ASaidZ is offline   Reply With Quote

Old   April 19, 2010, 10:57
Default
  #2
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 10
DoHander is on a distinguished road
Here you have an example of how to use the C random number generator:

http://www.cplusplus.com/reference/c.../cstdlib/rand/

you can easily adapt this code to your problem.

Do
DoHander is offline   Reply With Quote

Old   April 19, 2010, 15:41
Default
  #3
New Member
 
Ahmad
Join Date: Apr 2010
Posts: 7
Rep Power: 7
ASaidZ is on a distinguished road
Thanks a lot for your reply
AsaidZ
ASaidZ is offline   Reply With Quote

Old   February 3, 2014, 21:06
Default
  #4
New Member
 
Join Date: Jan 2014
Posts: 16
Rep Power: 3
flames is on a distinguished road
Hello,

In OF 211, if I use the following random number generator :


scalar Random::scalar01()
{
return osRandomDouble();
}

The function osRandomDouble() is defined as:
Foam::scalar Foam:sRandomDouble()
{
#ifdef USE_RANDOM
return (scalar)random()/INT_MAX;
#else
return drand48();
#endif
}


Is the radnom number from this generator with zero mean and unity variance? Thanks
mm.abdollahzadeh and charmc like this.
flames is offline   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
Mesh Refinement Luiz Eduardo Bittencourt Sampaio (Sampaio) OpenFOAM Mesh Utilities 41 January 17, 2013 03:43
DecomposePar unequal number of shared faces maka OpenFOAM Pre-Processing 6 August 12, 2010 09:01
Unaligned accesses on IA64 andre OpenFOAM 5 June 23, 2008 10:37
Is there a 'best' uniform random number generator? LEAF Main CFD Forum 2 April 20, 2006 08:23
Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 July 15, 2005 04:15


All times are GMT -4. The time now is 01:38.