From 852996cebd99da6474666dd1e668ac5664d45171 Mon Sep 17 00:00:00 2001 From: the-florist Date: Thu, 4 Jul 2024 12:04:10 +0100 Subject: [PATCH] Fixed parameter that was causing nans (A was set to 1 not 1/10000 --- Examples/ScalarField/ScalarFieldLevel.cpp | 1 - Examples/ScalarField/params.txt | 8 ++++---- Source/InitialConditions/ScalarFields/RandomField.hpp | 2 +- .../InitialConditions/ScalarFields/RandomField.impl.hpp | 8 ++++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Examples/ScalarField/ScalarFieldLevel.cpp b/Examples/ScalarField/ScalarFieldLevel.cpp index db8bc778a..4b2f858b4 100644 --- a/Examples/ScalarField/ScalarFieldLevel.cpp +++ b/Examples/ScalarField/ScalarFieldLevel.cpp @@ -76,7 +76,6 @@ void ScalarFieldLevel::initialData() pfield.clear_data(); pout() << "Calculating position ICs ended.\n"; - cout << "Trace-free condition passed for position.\n"; /*RandomField vfield(m_p.random_field_params, m_p.initial_params, "velocity"); diff --git a/Examples/ScalarField/params.txt b/Examples/ScalarField/params.txt index 970553363..09992da58 100644 --- a/Examples/ScalarField/params.txt +++ b/Examples/ScalarField/params.txt @@ -7,7 +7,7 @@ verbosity = 0 # location / naming of output files -output_path = "/home/eaf49/rds/hpc-work/random-seed-test/config2" # Main path for all files. Must exist! +output_path = "/nfs/st01/hpc-gr-epss/eaf49/random-seed-test/config2" # Main path for all files. Must exist! chk_prefix = ScalarField_ plot_prefix = ScalarFieldp_ # restart_file = ScalarField_001000.3d.hdf5 @@ -17,8 +17,8 @@ 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 = 40 -num_plot_vars = 6 -plot_vars = h11 h12 h13 h22 h23 h33 +num_plot_vars = 8 +plot_vars = h11 h12 h13 h22 h23 h33 Ham Mom # subpaths - specific directories for hdf5, pout, extraction data # (these are created at runtime) @@ -45,7 +45,7 @@ scalar_amplitude = 10.0 scalar_velocity = -0.00162845913015181 scalar_mass = 0.01 N_fine = 128 -tensor_amplitude = 1. +tensor_amplitude = 1.e-4 ################################################# # Grid parameters diff --git a/Source/InitialConditions/ScalarFields/RandomField.hpp b/Source/InitialConditions/ScalarFields/RandomField.hpp index daac162e5..274e3da1f 100644 --- a/Source/InitialConditions/ScalarFields/RandomField.hpp +++ b/Source/InitialConditions/ScalarFields/RandomField.hpp @@ -58,7 +58,7 @@ class RandomField int flip_index(int I, int N); int invert_index(int I, int N); int invert_index_with_sign(int I, int N); - double find_rayleigh_factor(double km, std::string spec_type, double uniform_draw); + double find_rayleigh_factor(double km, std::string spec_type); void apply_symmetry_rules(int i, int j, int k, double field[][2], int N); void calc_transferse_vectors(int x, int y, int z, int N, double MHat[3], double NHat[3], double a = 0.); void Test_norm(double vec[]); diff --git a/Source/InitialConditions/ScalarFields/RandomField.impl.hpp b/Source/InitialConditions/ScalarFields/RandomField.impl.hpp index dbb9ad472..90ed9360c 100644 --- a/Source/InitialConditions/ScalarFields/RandomField.impl.hpp +++ b/Source/InitialConditions/ScalarFields/RandomField.impl.hpp @@ -142,7 +142,7 @@ inline void RandomField::calc_spectrum() { int N = m_params.Nf; std::string printdir = "/home/eaf49/rds/hpc-work/"; - int pair = 2; + int pair = 1; // Setting the lut that maps polarisation vectors to // polarisation tensors. @@ -250,8 +250,8 @@ inline void RandomField::calc_spectrum() { for(int s=0; s<2; s++) { - hplus[k + (N/2+1)*(j + N*i)][s] = find_rayleigh_factor(kmag, m_spec_type, s) * sqrt(-2. * log(sigma_dist(engine))); - hcross[k + (N/2+1)*(j + N*i)][s] = find_rayleigh_factor(kmag, m_spec_type, s) * sqrt(-2. * log(sigma_dist(engine))); + hplus[k + (N/2+1)*(j + N*i)][s] = find_rayleigh_factor(kmag, m_spec_type) * sqrt(-2. * log(sigma_dist(engine))); + hcross[k + (N/2+1)*(j + N*i)][s] = find_rayleigh_factor(kmag, m_spec_type) * sqrt(-2. * log(sigma_dist(engine))); } hplus[k + (N/2+1)*(j + N*i)][0] *= cos(theta_dist(engine)); @@ -398,7 +398,7 @@ inline void RandomField::apply_symmetry_rules(int i, int j, int k, double field[ } } -inline double RandomField::find_rayleigh_factor(double km, std::string spec_type, double uniform_draw) +inline double RandomField::find_rayleigh_factor(double km, std::string spec_type) { if(km < 1.e-12) { return 0.; } // P(k=0), for m=0