diff --git a/cpp/full_code/ornstein_uhlenbeck_process.cpp b/cpp/full_code/ornstein_uhlenbeck_process.cpp index 2c680914c3b13042ec50f2f33e0743ba677cced6..0f26231c99f5174ca3077444cc00fdd554b57fa1 100644 --- a/cpp/full_code/ornstein_uhlenbeck_process.cpp +++ b/cpp/full_code/ornstein_uhlenbeck_process.cpp @@ -4,7 +4,7 @@ #include <cassert> #include "scope_timer.hpp" #include <algorithm> - +#include <chrono> template <class rnumber,field_backend be> @@ -28,7 +28,7 @@ ornstein_uhlenbeck_process<rnumber,be>::ornstein_uhlenbeck_process( this->ou_field = new field<rnumber,be,THREE>( nx,ny,nz, MPI_COMM_WORLD, FFTW_PLAN_RIGOR); *this->ou_field = 0.0; - this->ou_field->dft(); + this->ou_field->dft(); this->ou_field_vort = new field<rnumber,be,THREE>( nx,ny,nz, MPI_COMM_WORLD, FFTW_PLAN_RIGOR); @@ -46,19 +46,26 @@ ornstein_uhlenbeck_process<rnumber,be>::ornstein_uhlenbeck_process( this->ou_energy_amplitude = ou_energy_amplitude; 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()); + 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++) { - int current_seed = + long current_seed = this->ou_field->clayout->myrank*omp_get_max_threads() + - thread; + thread+now; gen[thread].seed(current_seed); } - + this->initialize_B(); }