Skip to content
Snippets Groups Projects
Commit c10ad9db authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Merge branch 'BoxDimensionConversion' into 'master'

Added conversion of box dimensions

Fixes #217. We need to convert the box size to the internal system of units, not just the particle properties.

See merge request !254
parents 5c46ced3 997b8f16
No related branches found
No related tags found
1 merge request!254Added conversion of box dimensions
......@@ -486,6 +486,10 @@ void read_ic_parallel(char* fileName, const struct UnitSystem* internal_units,
}
}
/* Convert the dimensions of the box */
for (int j = 0; j<3 ; j++)
dim[j] *= units_conversion_factor(ic_units, internal_units, UNIT_CONV_LENGTH);
/* Allocate memory to store SPH particles */
*Ngas = N[0];
if (posix_memalign((void*)parts, part_align, (*Ngas) * sizeof(struct part)) !=
......
......@@ -528,6 +528,10 @@ void read_ic_serial(char* fileName, const struct UnitSystem* internal_units,
H5Fclose(h_file);
}
/* Convert the dimensions of the box */
for (int j = 0; j<3 ; j++)
dim[j] *= units_conversion_factor(ic_units, internal_units, UNIT_CONV_LENGTH);
/* Now need to broadcast that information to all ranks. */
MPI_Bcast(flag_entropy, 1, MPI_INT, 0, comm);
MPI_Bcast(periodic, 1, MPI_INT, 0, comm);
......
......@@ -433,6 +433,10 @@ void read_ic_single(char* fileName, const struct UnitSystem* internal_units,
internal_units->UnitTemperature_in_cgs);
}
/* Convert the dimensions of the box */
for (int j = 0; j<3 ; j++)
dim[j] *= units_conversion_factor(ic_units, internal_units, UNIT_CONV_LENGTH);
/* Allocate memory to store SPH particles */
*Ngas = N[0];
if (posix_memalign((void*)parts, part_align, *Ngas * sizeof(struct part)) !=
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment