Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
5a59eca3
Commit
5a59eca3
authored
Sep 08, 2018
by
Matthieu Schaller
Browse files
When replicating the particles peridoically, propagate the correct mesh size to the PM calculation.
parent
dfed1bca
Changes
2
Hide whitespace changes
Inline
Side-by-side
examples/main.c
View file @
5a59eca3
...
...
@@ -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
)
...
...
src/mesh_gravity.c
View file @
5a59eca3
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment