Skip to content

Commit

Permalink
Fixed parameter that was causing nans (A was set to 1 not 1/10000
Browse files Browse the repository at this point in the history
  • Loading branch information
the-florist committed Jul 4, 2024
1 parent 3d0c565 commit 852996c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion Examples/ScalarField/ScalarFieldLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
8 changes: 4 additions & 4 deletions Examples/ScalarField/params.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/InitialConditions/ScalarFields/RandomField.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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[]);
Expand Down
8 changes: 4 additions & 4 deletions Source/InitialConditions/ScalarFields/RandomField.impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 852996c

Please sign in to comment.