diff --git a/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml b/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml index 4dcc1e0381adcb0405dd5b502c3d64896269a10f..cc6d2d2885a683c3a00ae6d2841921491afb274f 100644 --- a/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml +++ b/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml @@ -1,3 +1,7 @@ +# Define some meta-data about the simulation +MetaData: + run_name: EAGLE-L0012N0188-Ref + # Define the system of units to use internally. InternalUnitSystem: UnitMass_in_cgs: 1.98848e43 # 10^10 M_sun in grams diff --git a/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml b/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml index e1d9100a8f87bb8670fcb82ce4451084ecb1375a..3b58e3ba1bfd18d3ccb6f7e3404115781e678cc0 100644 --- a/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml +++ b/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml @@ -1,3 +1,7 @@ +# Define some meta-data about the simulation +MetaData: + run_name: EAGLE-L0025N0376-Ref + # Define the system of units to use internally. InternalUnitSystem: UnitMass_in_cgs: 1.98848e43 # 10^10 M_sun in grams diff --git a/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml b/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml index 3efe5ba972903dbc3644581d214285603e75ca78..7ddfaca65c0a1c28aadf3bbcde7084408cdd43cf 100644 --- a/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml +++ b/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml @@ -1,3 +1,7 @@ +# Define some meta-data about the simulation +MetaData: + run_name: EAGLE-L0050N0752-Ref + # Define the system of units to use internally. InternalUnitSystem: UnitMass_in_cgs: 1.98848e43 # 10^10 M_sun in grams diff --git a/examples/PMillennium/PMillennium-1536/p-mill-1536.yml b/examples/PMillennium/PMillennium-1536/p-mill-1536.yml index ea44572f90eb69330c973946cb5533a4c58b2c82..770cc4a03e8912eed51d1851b81578496a42070c 100644 --- a/examples/PMillennium/PMillennium-1536/p-mill-1536.yml +++ b/examples/PMillennium/PMillennium-1536/p-mill-1536.yml @@ -1,3 +1,7 @@ +# Define some meta-data about the simulation +MetaData: + run_name: Planck-Millennium simulation - 1536^3 + # Define the system of units to use internally. InternalUnitSystem: UnitMass_in_cgs: 1.98848e43 # 10^10 M_sun diff --git a/examples/PMillennium/PMillennium-384/p-mill-384.yml b/examples/PMillennium/PMillennium-384/p-mill-384.yml index 0040f580c8e67182949875d7d85cee2f75851654..428f893300bf3431f20518a6a1259651b3c67226 100644 --- a/examples/PMillennium/PMillennium-384/p-mill-384.yml +++ b/examples/PMillennium/PMillennium-384/p-mill-384.yml @@ -1,3 +1,7 @@ +# Define some meta-data about the simulation +MetaData: + run_name: Planck-Millennium simulation - 384^3 + # Define the system of units to use internally. InternalUnitSystem: UnitMass_in_cgs: 1.98848e43 # 10^10 M_sun diff --git a/examples/PMillennium/PMillennium-768/p-mill-768.yml b/examples/PMillennium/PMillennium-768/p-mill-768.yml index 5ba97af72513dca5fdccd216f0ede78d0e279b0a..339fad2c7059d8c8bcab2878fc8958a3bd1977d7 100644 --- a/examples/PMillennium/PMillennium-768/p-mill-768.yml +++ b/examples/PMillennium/PMillennium-768/p-mill-768.yml @@ -1,3 +1,7 @@ +# Define some meta-data about the simulation +MetaData: + run_name: Planck-Millennium simulation - 768^3 + # Define the system of units to use internally. InternalUnitSystem: UnitMass_in_cgs: 1.98848e43 # 10^10 M_sun diff --git a/examples/SantaBarbara/SantaBarbara-128/santa_barbara.yml b/examples/SantaBarbara/SantaBarbara-128/santa_barbara.yml index 35a6e2762f91707ed43bd5f0107c3dd8a53e12e4..1221cefb92e51e54bfe73a0414b95a89fcda592a 100644 --- a/examples/SantaBarbara/SantaBarbara-128/santa_barbara.yml +++ b/examples/SantaBarbara/SantaBarbara-128/santa_barbara.yml @@ -1,3 +1,7 @@ +# Define some meta-data about the simulation +MetaData: + run_name: Santa-Barbara cluster comparison project 128^3 + # Define the system of units to use internally. InternalUnitSystem: UnitMass_in_cgs: 1.98848e43 # 10^10 M_sun in grams diff --git a/examples/SantaBarbara/SantaBarbara-256/santa_barbara.yml b/examples/SantaBarbara/SantaBarbara-256/santa_barbara.yml index 9f6585e0c589d3d016921eb85dd6af13a0643784..04bb18191b750aa996e43b58b24451135bceedca 100644 --- a/examples/SantaBarbara/SantaBarbara-256/santa_barbara.yml +++ b/examples/SantaBarbara/SantaBarbara-256/santa_barbara.yml @@ -1,3 +1,7 @@ +# Define some meta-data about the simulation +MetaData: + run_name: Santa-Barbara cluster comparison project 256^3 + # Define the system of units to use internally. InternalUnitSystem: UnitMass_in_cgs: 1.98848e43 # 10^10 Msun diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml index 375c5abc22d117b7322dd49e37109430b3ef0e32..61e7ab470292d0575881ae0382103988e4748c74 100644 --- a/examples/parameter_example.yml +++ b/examples/parameter_example.yml @@ -1,3 +1,7 @@ +# Define some meta-data about the simulation +MetaData: + run_name: Name of the sim in less than 256 characters. # The name of the simulation. This is written into the snapshot headers. + # Define the system of units to use internally. InternalUnitSystem: UnitMass_in_cgs: 1 # Grams diff --git a/src/engine.c b/src/engine.c index 65771f383ca7571d7f488e6ef4b294de99e54b8b..b9bdacbe2d00a8e4c56f2ebb5ab4c2ec247a527f 100644 --- a/src/engine.c +++ b/src/engine.c @@ -4972,6 +4972,15 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params, /* Make the space link back to the engine. */ s->e = e; + /* Read the run label */ + memset(e->run_name, 0, PARSER_MAX_LINE_SIZE); + parser_get_opt_param_string(params, "MetaData:run_name", e->run_name, + "Untitled SWIFT simulation"); + if (strlen(e->run_name) == 0) { + error("The run name in the parameter file cannot be an empty string."); + } + if (e->nodeID == 0) message("Running simulation '%s'.", e->run_name); + /* Setup the timestep if non-cosmological */ if (!(e->policy & engine_policy_cosmology)) { e->time_begin = diff --git a/src/engine.h b/src/engine.h index 1a653fdfd40c88775b7bbb67265922c9db68a5fa..8b6a6c78b3d1bbc0316143349d1472c9291045f0 100644 --- a/src/engine.h +++ b/src/engine.h @@ -451,6 +451,9 @@ struct engine { /* Maximum number of tasks needed for restarting. */ int restart_max_tasks; + + /* Label of the run */ + char run_name[PARSER_MAX_LINE_SIZE]; }; /* Function prototypes, engine.c. */ diff --git a/src/parallel_io.c b/src/parallel_io.c index 8d10c12a7bb8f39e7bbbb797b64750050b2866e0..e11bc753949b5fda8e1fd74755c36981e734f0f8 100644 --- a/src/parallel_io.c +++ b/src/parallel_io.c @@ -1051,6 +1051,7 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6], io_write_attribute_s(h_grp, "Code", "SWIFT"); time_t tm = time(NULL); io_write_attribute_s(h_grp, "Snapshot date", ctime(&tm)); + io_write_attribute_s(h_grp, "RunName", e->run_name); /* GADGET-2 legacy values */ /* Number of particles of each type */ diff --git a/src/serial_io.c b/src/serial_io.c index 240ca6656ee291fa74591f726fdf33cb3f353bee..c3afef1283e4bc72eb7d75c1dd26c4517d2d97c3 100644 --- a/src/serial_io.c +++ b/src/serial_io.c @@ -918,6 +918,7 @@ void write_output_serial(struct engine* e, const char* baseName, io_write_attribute_s(h_grp, "Code", "SWIFT"); time_t tm = time(NULL); io_write_attribute_s(h_grp, "Snapshot date", ctime(&tm)); + io_write_attribute_s(h_grp, "RunName", e->run_name); /* GADGET-2 legacy values */ /* Number of particles of each type */ diff --git a/src/single_io.c b/src/single_io.c index a41fadb31407fa7bf44804763a3254fb8ccf910c..4125b1ba91551a63af98e0286aa3d80be076716d 100644 --- a/src/single_io.c +++ b/src/single_io.c @@ -766,6 +766,7 @@ void write_output_single(struct engine* e, const char* baseName, io_write_attribute_s(h_grp, "Code", "SWIFT"); time_t tm = time(NULL); io_write_attribute_s(h_grp, "Snapshot date", ctime(&tm)); + io_write_attribute_s(h_grp, "RunName", e->run_name); /* GADGET-2 legacy values */ /* Number of particles of each type */