Commit 04f4a2f5 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Be verbose about the choices made in the snapshots

parent a08bc6b1
...@@ -102,9 +102,6 @@ __attribute__((always_inline)) INLINE static void hydro_write_particles( ...@@ -102,9 +102,6 @@ __attribute__((always_inline)) INLINE static void hydro_write_particles(
*/ */
void writeSPHflavour(hid_t h_grpsph) { void writeSPHflavour(hid_t h_grpsph) {
/* Kernel function description */
writeAttribute_s(h_grpsph, "Kernel", kernel_name);
/* Viscosity and thermal conduction */ /* Viscosity and thermal conduction */
writeAttribute_s(h_grpsph, "Thermal Conductivity Model", writeAttribute_s(h_grpsph, "Thermal Conductivity Model",
"Price (2008) without switch"); "Price (2008) without switch");
......
...@@ -102,9 +102,6 @@ __attribute__((always_inline)) INLINE static void hydro_write_particles( ...@@ -102,9 +102,6 @@ __attribute__((always_inline)) INLINE static void hydro_write_particles(
*/ */
void writeSPHflavour(hid_t h_grpsph) { void writeSPHflavour(hid_t h_grpsph) {
/* Kernel function description */
writeAttribute_s(h_grpsph, "Kernel", kernel_name);
/* Viscosity and thermal conduction */ /* Viscosity and thermal conduction */
writeAttribute_s(h_grpsph, "Thermal Conductivity Model", writeAttribute_s(h_grpsph, "Thermal Conductivity Model",
"(No treatment) Legacy Gadget-2 as in Springel (2005)"); "(No treatment) Legacy Gadget-2 as in Springel (2005)");
......
...@@ -102,9 +102,6 @@ __attribute__((always_inline)) INLINE static void hydro_write_particles( ...@@ -102,9 +102,6 @@ __attribute__((always_inline)) INLINE static void hydro_write_particles(
*/ */
void writeSPHflavour(hid_t h_grpsph) { void writeSPHflavour(hid_t h_grpsph) {
/* Kernel function description */
writeAttribute_s(h_grpsph, "Kernel", kernel_name);
/* Viscosity and thermal conduction */ /* Viscosity and thermal conduction */
/* Nothing in this minimal model... */ /* Nothing in this minimal model... */
writeAttribute_s(h_grpsph, "Thermal Conductivity Model", "No model"); writeAttribute_s(h_grpsph, "Thermal Conductivity Model", "No model");
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <math.h> #include <math.h>
/* Local headers. */ /* Local headers. */
#include "common_io.h"
#include "error.h" #include "error.h"
#include "gamma.h" #include "gamma.h"
#include "hydro.h" #include "hydro.h"
...@@ -70,3 +71,21 @@ void hydro_props_print(const struct hydro_props *p) { ...@@ -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)", message("Maximal iterations in ghost task set to %d (default is %d)",
p->max_smoothing_iterations, hydro_props_default_max_iterations); 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
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
/* Config parameters. */ /* Config parameters. */
#include "../config.h" #include "../config.h"
#if defined(HAVE_HDF5)
#include <hdf5.h>
#endif
/* Local includes. */ /* Local includes. */
#include "const.h" #include "const.h"
#include "parser.h" #include "parser.h"
...@@ -53,4 +57,8 @@ struct hydro_props { ...@@ -53,4 +57,8 @@ struct hydro_props {
void hydro_props_print(const struct hydro_props *p); void hydro_props_print(const struct hydro_props *p);
void hydro_props_init(struct hydro_props *p, const struct swift_params *params); 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 */ #endif /* SWIFT_HYDRO_PROPERTIES */
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "common_io.h" #include "common_io.h"
#include "engine.h" #include "engine.h"
#include "error.h" #include "error.h"
#include "hydro_properties.h"
#include "kernel_hydro.h" #include "kernel_hydro.h"
#include "part.h" #include "part.h"
#include "units.h" #include "units.h"
...@@ -639,8 +640,10 @@ void write_output_parallel(struct engine* e, const char* baseName, ...@@ -639,8 +640,10 @@ void write_output_parallel(struct engine* e, const char* baseName,
writeCodeDescription(h_file); writeCodeDescription(h_file);
/* Print the SPH parameters */ /* 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"); if (h_grp < 0) error("Error while creating SPH group");
hydro_props_print_snapshot(h_grp, e->hydro_properties);
writeSPHflavour(h_grp); writeSPHflavour(h_grp);
H5Gclose(h_grp); H5Gclose(h_grp);
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "common_io.h" #include "common_io.h"
#include "engine.h" #include "engine.h"
#include "error.h" #include "error.h"
#include "hydro_properties.h"
#include "kernel_hydro.h" #include "kernel_hydro.h"
#include "part.h" #include "part.h"
#include "units.h" #include "units.h"
...@@ -714,8 +715,10 @@ void write_output_serial(struct engine* e, const char* baseName, ...@@ -714,8 +715,10 @@ void write_output_serial(struct engine* e, const char* baseName,
writeCodeDescription(h_file); writeCodeDescription(h_file);
/* Print the SPH parameters */ /* 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"); if (h_grp < 0) error("Error while creating SPH group");
hydro_props_print_snapshot(h_grp, e->hydro_properties);
writeSPHflavour(h_grp); writeSPHflavour(h_grp);
H5Gclose(h_grp); H5Gclose(h_grp);
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "common_io.h" #include "common_io.h"
#include "engine.h" #include "engine.h"
#include "error.h" #include "error.h"
#include "hydro_properties.h"
#include "kernel_hydro.h" #include "kernel_hydro.h"
#include "part.h" #include "part.h"
#include "units.h" #include "units.h"
...@@ -564,8 +565,10 @@ void write_output_single(struct engine* e, const char* baseName, ...@@ -564,8 +565,10 @@ void write_output_single(struct engine* e, const char* baseName,
writeCodeDescription(h_file); writeCodeDescription(h_file);
/* Print the SPH parameters */ /* 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"); if (h_grp < 0) error("Error while creating SPH group");
hydro_props_print_snapshot(h_grp, e->hydro_properties);
writeSPHflavour(h_grp); writeSPHflavour(h_grp);
H5Gclose(h_grp); H5Gclose(h_grp);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment