From 2c177bd1a7d2437c837240c1a90ed1a53208669a Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Wed, 7 Sep 2016 18:35:49 +0100 Subject: [PATCH] Get the correct conversion factors for volumes. --- src/hydro/Gizmo/hydro_io.h | 4 ++-- src/units.c | 3 +++ src/units.h | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/hydro/Gizmo/hydro_io.h b/src/hydro/Gizmo/hydro_io.h index e5f221ae43..5de2260bf3 100644 --- a/src/hydro/Gizmo/hydro_io.h +++ b/src/hydro/Gizmo/hydro_io.h @@ -124,8 +124,8 @@ void hydro_write_particles(struct part* parts, struct io_props* list, UNIT_CONV_ACCELERATION, parts, a_hydro); list[7] = io_make_output_field("Density", FLOAT, 1, UNIT_CONV_DENSITY, parts, primitives.rho); - list[8] = io_make_output_field("Volume", FLOAT, 1, UNIT_CONV_VOLUME, parts, - geometry.volume); + list[8] = io_make_output_field("Volume", FLOAT, 1, UNIT_CONV_INV_VOLUME, + parts, geometry.volume); list[9] = io_make_output_field("GradDensity", FLOAT, 3, UNIT_CONV_DENSITY, parts, primitives.gradients.rho); list[10] = io_make_output_field_convert_part( diff --git a/src/units.c b/src/units.c index f598b5ddf0..2241d441ec 100644 --- a/src/units.c +++ b/src/units.c @@ -319,6 +319,9 @@ void units_get_base_unit_exponants_array(float baseUnitsExp[5], break; case UNIT_CONV_VOLUME: + baseUnitsExp[UNIT_LENGTH] = 3.f; + + case UNIT_CONV_INV_VOLUME: baseUnitsExp[UNIT_LENGTH] = -3.f; } } diff --git a/src/units.h b/src/units.h index 26fa15a665..78fdf1c23c 100644 --- a/src/units.h +++ b/src/units.h @@ -90,7 +90,8 @@ enum UnitConversionFactor { UNIT_CONV_MAGNETIC_FIELD, UNIT_CONV_MAGNETIC_INDUCTANCE, UNIT_CONV_TEMPERATURE, - UNIT_CONV_VOLUME + UNIT_CONV_VOLUME, + UNIT_CONV_INV_VOLUME }; void units_init_cgs(struct UnitSystem*); -- GitLab