|
[Sponsors] |
August 2, 2016, 14:13 |
resume a run with random generator
|
#1 |
Senior Member
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18 |
Hi,
If I have a random number generator in a boundary condition (such as turbulentInlet BC), it needs a seed. Now assume for whatever reason this simulation stops and I want to resume it. If the seeding number has been passed then it only means the string of the random numbers will be reset to my very beginning time which means I'm getting duplicate data in the middle of my run. Is there anyway to resume the random sequence? Like getting a seed number which if passed in would look like the same sequence is going on? |
|
August 3, 2016, 07:33 |
|
#2 |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 339
Rep Power: 28 |
You can avoid generating the same random sequences by using a seed value, that is different everytime you run your application.
The system time comes to mind. If you want to execute your application in parallel you can add the PID of the process to the time. Then the seed is different for each process. Code:
// random stuff #include "Random.H" #include "clock.H" Random ranGen( clock::getTime() + pid() ) ; for ( int j = 0; j < 20; j ++) { Info << ranGen.integer(1 , 100) << endl ; } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
simpleFoam parallel | AndrewMortimer | OpenFOAM Running, Solving & CFD | 12 | August 7, 2015 18:45 |
[mesh manipulation] Cannot get refineMesh to run in parallel | smschnob | OpenFOAM Meshing & Mesh Conversion | 2 | June 3, 2014 11:20 |
How to run icoFsiFoam in parallel mode? | AsDF | OpenFOAM Running, Solving & CFD | 2 | February 21, 2014 07:56 |
Help-Edit Run in Progress | BalanceChen | CFX | 0 | March 30, 2011 09:23 |
resume and run fluent for another timestep via a c | greg | FLUENT | 2 | June 30, 2005 05:01 |