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

Random number generator

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By flames

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 19, 2010, 04:04
Default Random number generator
  #1
New Member
 
Ahmad
Join Date: Apr 2010
Posts: 7
Rep Power: 16
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, 11:57
Default
  #2
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 20
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, 16:41
Default
  #3
New Member
 
Ahmad
Join Date: Apr 2010
Posts: 7
Rep Power: 16
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: 12
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


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
[mesh manipulation] Mesh Refinement Luiz Eduardo Bittencourt Sampaio (Sampaio) OpenFOAM Meshing & Mesh Conversion 42 January 8, 2017 13:55
DecomposePar unequal number of shared faces maka OpenFOAM Pre-Processing 6 August 12, 2010 10:01
Unaligned accesses on IA64 andre OpenFOAM 5 June 23, 2008 11:37
Is there a 'best' uniform random number generator? LEAF Main CFD Forum 2 April 20, 2006 09:23
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15


All times are GMT -4. The time now is 03:47.