|
[Sponsors] |
April 19, 2010, 04:04 |
Random number generator
|
#1 |
New Member
Ahmad
Join Date: Apr 2010
Posts: 7
Rep Power: 16 |
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 |
|
April 19, 2010, 11:57 |
|
#2 |
Senior Member
Join Date: Nov 2009
Posts: 411
Rep Power: 20 |
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 |
|
April 19, 2010, 16:41 |
|
#3 |
New Member
Ahmad
Join Date: Apr 2010
Posts: 7
Rep Power: 16 |
Thanks a lot for your reply
AsaidZ |
|
February 3, 2014, 21:06 |
|
#4 |
New Member
Join Date: Jan 2014
Posts: 16
Rep Power: 12 |
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 |
|
|
|
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 |