From 3d0c5658a31960a749e81451a8f751bd05c15e5c Mon Sep 17 00:00:00 2001 From: Ericka Florio Date: Thu, 4 Jul 2024 00:38:05 +0100 Subject: [PATCH] Added random seed vector to RandomFields class, for an option to initialise the field with multiple configurations --- Examples/ScalarField/params.txt | 12 +++++------ .../ScalarFields/RandomField.impl.hpp | 21 +++++++++++++++---- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Examples/ScalarField/params.txt b/Examples/ScalarField/params.txt index cced603aa..970553363 100644 --- a/Examples/ScalarField/params.txt +++ b/Examples/ScalarField/params.txt @@ -7,16 +7,16 @@ verbosity = 0 # location / naming of output files -output_path = "/home/eaf49/rds/hpc-work/dump" # Main path for all files. Must exist! +output_path = "/home/eaf49/rds/hpc-work/random-seed-test/config2" # Main path for all files. Must exist! chk_prefix = ScalarField_ plot_prefix = ScalarFieldp_ # restart_file = ScalarField_001000.3d.hdf5 # HDF5files are written every dt = L/N*dt_multiplier*checkpoint_interval -checkpoint_interval = 500 +checkpoint_interval = 300 # set to 0 to turn off plot files (except at t=0 and t=stop_time) # set to -1 to never ever print plotfiles -plot_interval = 100 +plot_interval = 40 num_plot_vars = 6 plot_vars = h11 h12 h13 h22 h23 h33 @@ -57,7 +57,7 @@ tensor_amplitude = 1. # NB - if you have a non-cubic grid, you can specify 'N1' or 'N1_full', # 'N2' or 'N2_full' and 'N3' or 'N3_full' ( then dx_coarsest = L/N(max) ) # NB - the N values need to be multiples of the block_factor -N_full = 32 +N_full = 64 L_full = 6.5 # Maximum number of times you can regrid above coarsest level @@ -125,8 +125,8 @@ extrapolating_vars = phi Pi # dt will be dx*dt_multiplier on each grid level dt_multiplier = 0.25 -stop_time = 10 -max_steps = 2 +stop_time = 40 +max_steps = 1700 # Spatial derivative order (only affects CCZ4 RHS) max_spatial_derivative_order = 4 # can be 4 or 6 diff --git a/Source/InitialConditions/ScalarFields/RandomField.impl.hpp b/Source/InitialConditions/ScalarFields/RandomField.impl.hpp index a26d905db..dbb9ad472 100644 --- a/Source/InitialConditions/ScalarFields/RandomField.impl.hpp +++ b/Source/InitialConditions/ScalarFields/RandomField.impl.hpp @@ -141,8 +141,9 @@ inline void RandomField::clear_data() inline void RandomField::calc_spectrum() { int N = m_params.Nf; - std::string printdir = "/nfs/st01/hpc-gr-epss/eaf49/"; - + std::string printdir = "/home/eaf49/rds/hpc-work/"; + int pair = 2; + // Setting the lut that maps polarisation vectors to // polarisation tensors. int lut[3][3]; @@ -210,9 +211,21 @@ inline void RandomField::calc_spectrum() } // Set up random number generators (one independent seed per random draw) + std::vector seeds(10, 0); + seeds[0] = 3539263; + seeds[1] = 7586572; + seeds[2] = 5060982; + seeds[3] = 6793957; + seeds[4] = 4764135; + seeds[5] = 6961336; + seeds[6] = 2918557; + seeds[7] = 3024453; + seeds[8] = 5470767; + seeds[9] = 2125263; + int seed; - if(m_spec_type == "position") { seed = 3539263; } - else if(m_spec_type == "velocity") { seed = 7586572; } + if(m_spec_type == "position") { seed = seeds[2*pair]; } + else if(m_spec_type == "velocity") { seed = seeds[2*pair+1]; } else { MayDay::Error("RandomField: Please choose either 'position' or 'velocity' field type."); } default_random_engine engine(seed);