From 3a67c50f36b9642bce8394a363a031bb12d8d113 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller Date: Sun, 28 Feb 2021 17:56:06 +0100 Subject: [PATCH] Write the redshift in the header of SWIFT ICs since the code will check that against the value provided in the param file upon startup --- src/plugins/output_swift.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/output_swift.cc b/src/plugins/output_swift.cc index 164b87a..3dc16a6 100644 --- a/src/plugins/output_swift.cc +++ b/src/plugins/output_swift.cc @@ -41,7 +41,7 @@ protected: int num_files_, num_simultaneous_writers_; real_t lunit_, vunit_, munit_; - real_t boxsize_, hubble_param_, astart_; + real_t boxsize_, hubble_param_, astart_, zstart_; bool blongids_, bdobaryons_; std::string this_fname_; @@ -63,7 +63,8 @@ public: const double rhoc = 27.7519737; // in h^2 1e10 M_sol / Mpc^3 hubble_param_ = pcc->cosmo_param_["h"]; - astart_ = 1.0/(1.0+cf_.get_value("setup","zstart")); + zstart_ = cf_.get_value("setup","zstart"); + astart_ = 1.0/(1.0 + zstart_); boxsize_ = cf_.get_value("setup", "BoxLength"); lunit_ = boxsize_ / hubble_param_; // final units will be in Mpc (without h) @@ -125,6 +126,7 @@ public: HDFWriteGroupAttribute(this_fname_, "Header", "MassTable", from_7array(mass_)); HDFWriteGroupAttribute(this_fname_, "Header", "Time", from_value(time_)); + HDFWriteGroupAttribute(this_fname_, "Header", "Redshift", from_value(zstart_)); HDFWriteGroupAttribute(this_fname_, "Header", "Flag_Entropy_ICs", from_value(0)); HDFWriteGroupAttribute(this_fname_, "Header", "NumFilesPerSnapshot", from_value(num_files_));