diff --git a/src/hydro/Default/hydro_io.h b/src/hydro/Default/hydro_io.h index fb1f7af922b2272779c7251b15e304880a2af520..31990de2e053d4c4293288f3eeede84276016df3 100644 --- a/src/hydro/Default/hydro_io.h +++ b/src/hydro/Default/hydro_io.h @@ -102,9 +102,6 @@ __attribute__((always_inline)) INLINE static void hydro_write_particles( */ void writeSPHflavour(hid_t h_grpsph) { - /* Kernel function description */ - writeAttribute_s(h_grpsph, "Kernel", kernel_name); - /* Viscosity and thermal conduction */ writeAttribute_s(h_grpsph, "Thermal Conductivity Model", "Price (2008) without switch"); diff --git a/src/hydro/Gadget2/hydro_io.h b/src/hydro/Gadget2/hydro_io.h index f7ee04cbbad07ebb06d00ee39a614b9fed5c4dfd..9cbdef6dd14b487e991bd84ed6545ffe4282155f 100644 --- a/src/hydro/Gadget2/hydro_io.h +++ b/src/hydro/Gadget2/hydro_io.h @@ -102,9 +102,6 @@ __attribute__((always_inline)) INLINE static void hydro_write_particles( */ void writeSPHflavour(hid_t h_grpsph) { - /* Kernel function description */ - writeAttribute_s(h_grpsph, "Kernel", kernel_name); - /* Viscosity and thermal conduction */ writeAttribute_s(h_grpsph, "Thermal Conductivity Model", "(No treatment) Legacy Gadget-2 as in Springel (2005)"); diff --git a/src/hydro/Minimal/hydro_io.h b/src/hydro/Minimal/hydro_io.h index d5e52e18ef9fd933904565fe5bbd9c7dd328a14e..40b9a4b0e66bb5e540cb28228fb2fe01bd608b22 100644 --- a/src/hydro/Minimal/hydro_io.h +++ b/src/hydro/Minimal/hydro_io.h @@ -102,9 +102,6 @@ __attribute__((always_inline)) INLINE static void hydro_write_particles( */ void writeSPHflavour(hid_t h_grpsph) { - /* Kernel function description */ - writeAttribute_s(h_grpsph, "Kernel", kernel_name); - /* Viscosity and thermal conduction */ /* Nothing in this minimal model... */ writeAttribute_s(h_grpsph, "Thermal Conductivity Model", "No model"); diff --git a/src/hydro_properties.c b/src/hydro_properties.c index 45106d1a86651c150e74b352306f6e4e2f2edfb2..756b9958b78bc9366687d5e183759ec22b587bdc 100644 --- a/src/hydro_properties.c +++ b/src/hydro_properties.c @@ -25,6 +25,7 @@ #include <math.h> /* Local headers. */ +#include "common_io.h" #include "error.h" #include "gamma.h" #include "hydro.h" @@ -70,3 +71,21 @@ void hydro_props_print(const struct hydro_props *p) { message("Maximal iterations in ghost task set to %d (default is %d)", p->max_smoothing_iterations, hydro_props_default_max_iterations); } + +#if defined(HAVE_HDF5) +void hydro_props_print_snapshot(hid_t h_grpsph, const struct hydro_props *p) { + + writeAttribute_f(h_grpsph, "Adiabatic index", hydro_gamma); + writeAttribute_s(h_grpsph, "Scheme", SPH_IMPLEMENTATION); + writeAttribute_s(h_grpsph, "Kernel function", kernel_name); + writeAttribute_f(h_grpsph, "Kernel target N_ngb", p->target_neighbours); + writeAttribute_f(h_grpsph, "Kernel delta N_ngb", p->delta_neighbours); + writeAttribute_f(h_grpsph, "Kernel eta", p->eta_neighbours); + writeAttribute_f(h_grpsph, "CFL parameter", p->CFL_condition); + writeAttribute_f(h_grpsph, "Volume log(max(delta h))", p->log_max_h_change); + writeAttribute_f(h_grpsph, "Volume max change time-step", + powf(expf(p->log_max_h_change), 3.f)); + writeAttribute_f(h_grpsph, "Max ghost iterations", + p->max_smoothing_iterations); +} +#endif diff --git a/src/hydro_properties.h b/src/hydro_properties.h index c84252a1dc12f0e5591a7e512fdf4e246f4ab048..6b151e2d038fc1ac30e77ad70bc9ef714cec2899 100644 --- a/src/hydro_properties.h +++ b/src/hydro_properties.h @@ -23,6 +23,10 @@ /* Config parameters. */ #include "../config.h" +#if defined(HAVE_HDF5) +#include <hdf5.h> +#endif + /* Local includes. */ #include "const.h" #include "parser.h" @@ -53,4 +57,8 @@ struct hydro_props { void hydro_props_print(const struct hydro_props *p); void hydro_props_init(struct hydro_props *p, const struct swift_params *params); +#if defined(HAVE_HDF5) +void hydro_props_print_snapshot(hid_t h_grpsph, const struct hydro_props *p); +#endif + #endif /* SWIFT_HYDRO_PROPERTIES */ diff --git a/src/parallel_io.c b/src/parallel_io.c index 1411b85b9b4144830aa6a9f37a487b3148a2db21..0720c7cbd3c965e5be0b3f5f30ac30f5e33c661d 100644 --- a/src/parallel_io.c +++ b/src/parallel_io.c @@ -39,6 +39,7 @@ #include "common_io.h" #include "engine.h" #include "error.h" +#include "hydro_properties.h" #include "kernel_hydro.h" #include "part.h" #include "units.h" @@ -639,8 +640,10 @@ void write_output_parallel(struct engine* e, const char* baseName, writeCodeDescription(h_file); /* Print the SPH parameters */ - h_grp = H5Gcreate(h_file, "/SPH", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + h_grp = + H5Gcreate(h_file, "/HydroScheme", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (h_grp < 0) error("Error while creating SPH group"); + hydro_props_print_snapshot(h_grp, e->hydro_properties); writeSPHflavour(h_grp); H5Gclose(h_grp); diff --git a/src/serial_io.c b/src/serial_io.c index fac3c1b006375eb43a4e799f96a4979f26238668..7c7afd1a27dfab7abdf8afeb68df27355083715c 100644 --- a/src/serial_io.c +++ b/src/serial_io.c @@ -39,6 +39,7 @@ #include "common_io.h" #include "engine.h" #include "error.h" +#include "hydro_properties.h" #include "kernel_hydro.h" #include "part.h" #include "units.h" @@ -714,8 +715,10 @@ void write_output_serial(struct engine* e, const char* baseName, writeCodeDescription(h_file); /* Print the SPH parameters */ - h_grp = H5Gcreate(h_file, "/SPH", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + h_grp = H5Gcreate(h_file, "/HydroScheme", H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT); if (h_grp < 0) error("Error while creating SPH group"); + hydro_props_print_snapshot(h_grp, e->hydro_properties); writeSPHflavour(h_grp); H5Gclose(h_grp); diff --git a/src/single_io.c b/src/single_io.c index 329ec7253247a6bec992e9cb740d322fa3048a01..ff437ef137fba2118072824add29995f890726be 100644 --- a/src/single_io.c +++ b/src/single_io.c @@ -38,6 +38,7 @@ #include "common_io.h" #include "engine.h" #include "error.h" +#include "hydro_properties.h" #include "kernel_hydro.h" #include "part.h" #include "units.h" @@ -564,8 +565,10 @@ void write_output_single(struct engine* e, const char* baseName, writeCodeDescription(h_file); /* Print the SPH parameters */ - h_grp = H5Gcreate(h_file, "/SPH", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + h_grp = + H5Gcreate(h_file, "/HydroScheme", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (h_grp < 0) error("Error while creating SPH group"); + hydro_props_print_snapshot(h_grp, e->hydro_properties); writeSPHflavour(h_grp); H5Gclose(h_grp);