Skip to content
Snippets Groups Projects
Commit fa65db24 authored by Niklas Schnierstein's avatar Niklas Schnierstein Committed by Cristian Lalescu
Browse files

added time variable to seed calculation

parent 41732fc1
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <cassert> #include <cassert>
#include "scope_timer.hpp" #include "scope_timer.hpp"
#include <algorithm> #include <algorithm>
#include <chrono>
template <class rnumber,field_backend be> template <class rnumber,field_backend be>
...@@ -28,7 +28,7 @@ ornstein_uhlenbeck_process<rnumber,be>::ornstein_uhlenbeck_process( ...@@ -28,7 +28,7 @@ ornstein_uhlenbeck_process<rnumber,be>::ornstein_uhlenbeck_process(
this->ou_field = new field<rnumber,be,THREE>( this->ou_field = new field<rnumber,be,THREE>(
nx,ny,nz, MPI_COMM_WORLD, FFTW_PLAN_RIGOR); nx,ny,nz, MPI_COMM_WORLD, FFTW_PLAN_RIGOR);
*this->ou_field = 0.0; *this->ou_field = 0.0;
this->ou_field->dft(); this->ou_field->dft();
this->ou_field_vort = new field<rnumber,be,THREE>( this->ou_field_vort = new field<rnumber,be,THREE>(
nx,ny,nz, MPI_COMM_WORLD, FFTW_PLAN_RIGOR); nx,ny,nz, MPI_COMM_WORLD, FFTW_PLAN_RIGOR);
...@@ -46,19 +46,26 @@ ornstein_uhlenbeck_process<rnumber,be>::ornstein_uhlenbeck_process( ...@@ -46,19 +46,26 @@ ornstein_uhlenbeck_process<rnumber,be>::ornstein_uhlenbeck_process(
this->ou_energy_amplitude = ou_energy_amplitude; this->ou_energy_amplitude = ou_energy_amplitude;
this->epsilon = pow((this->ou_energy_amplitude/this->kolmogorov_constant), 3./2.); this->epsilon = pow((this->ou_energy_amplitude/this->kolmogorov_constant), 3./2.);
assert(this->kk->kM2 >= this->ou_kmax_squ); assert(this->kk->kM2 >= this->ou_kmax_squ);
gen.resize(omp_get_max_threads()); gen.resize(omp_get_max_threads());
long now;
if (this->ou_field->clayout->myrank == 0){
now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
}
MPI_Bcast(&now,1,MPI_LONG,0,this->ou_field->comm);
for(int thread=0;thread<omp_get_max_threads();thread++) for(int thread=0;thread<omp_get_max_threads();thread++)
{ {
int current_seed = long current_seed =
this->ou_field->clayout->myrank*omp_get_max_threads() + this->ou_field->clayout->myrank*omp_get_max_threads() +
thread; thread+now;
gen[thread].seed(current_seed); gen[thread].seed(current_seed);
} }
this->initialize_B(); this->initialize_B();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment