Commit 5a59eca3 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

When replicating the particles peridoically, propagate the correct mesh size to the PM calculation.

parent dfed1bca
......@@ -777,19 +777,6 @@ int main(int argc, char *argv[]) {
/* Verify that the fields to dump actually exist */
if (myrank == 0) io_check_output_fields(params, N_total);
/* Initialise the long-range gravity mesh */
if (with_self_gravity && periodic) {
#ifdef HAVE_FFTW
pm_mesh_init(&mesh, &gravity_properties, dim);
#else
/* Need the FFTW library if periodic and self gravity. */
error(
"No FFTW library found. Cannot compute periodic long-range forces.");
#endif
} else {
pm_mesh_init_no_mesh(&mesh, dim);
}
/* Initialize the space with these data. */
if (myrank == 0) clocks_gettime(&tic);
space_init(&s, params, &cosmo, dim, parts, gparts, sparts, Ngas, Ngpart,
......@@ -803,6 +790,19 @@ int main(int argc, char *argv[]) {
fflush(stdout);
}
/* Initialise the long-range gravity mesh */
if (with_self_gravity && periodic) {
#ifdef HAVE_FFTW
pm_mesh_init(&mesh, &gravity_properties, s.dim);
#else
/* Need the FFTW library if periodic and self gravity. */
error(
"No FFTW library found. Cannot compute periodic long-range forces.");
#endif
} else {
pm_mesh_init_no_mesh(&mesh, s.dim);
}
/* Check that the matter content matches the cosmology given in the
* parameter file. */
if (with_cosmology && with_self_gravity && !dry_run)
......
......@@ -291,6 +291,8 @@ void pm_mesh_compute_potential(struct pm_mesh* mesh, const struct space* s,
const double dim[3] = {s->dim[0], s->dim[1], s->dim[2]};
if (r_s <= 0.) error("Invalid value of a_smooth");
if (mesh->dim[0] != dim[0] || mesh->dim[1] != dim[1] || mesh->dim[2] != dim[2])
error("Domain size does not match the value stored in the space.");
/* Some useful constants */
const int N = mesh->N;
......
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