Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
37baeabb
Commit
37baeabb
authored
6 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Prevent the user from running with a mesh that is too small given r_cut_max.
parent
4e8b4efd
No related branches found
No related tags found
1 merge request
!604
Parallel mesh assignment and simplification of M2L kernel
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/gravity_properties.c
+5
-0
5 additions, 0 deletions
src/gravity_properties.c
src/mesh_gravity.c
+4
-1
4 additions, 1 deletion
src/mesh_gravity.c
with
9 additions
and
1 deletion
src/gravity_properties.c
+
5
−
0
View file @
37baeabb
...
@@ -58,12 +58,17 @@ void gravity_props_init(struct gravity_props *p, struct swift_params *params,
...
@@ -58,12 +58,17 @@ void gravity_props_init(struct gravity_props *p, struct swift_params *params,
p
->
r_cut_min_ratio
=
parser_get_opt_param_float
(
p
->
r_cut_min_ratio
=
parser_get_opt_param_float
(
params
,
"Gravity:r_cut_min"
,
gravity_props_default_r_cut_min
);
params
,
"Gravity:r_cut_min"
,
gravity_props_default_r_cut_min
);
/* Some basic checks */
if
(
p
->
mesh_size
%
2
!=
0
)
if
(
p
->
mesh_size
%
2
!=
0
)
error
(
"The mesh side-length must be an even number."
);
error
(
"The mesh side-length must be an even number."
);
if
(
p
->
a_smooth
<=
0
.)
if
(
p
->
a_smooth
<=
0
.)
error
(
"The mesh smoothing scale 'a_smooth' must be > 0."
);
error
(
"The mesh smoothing scale 'a_smooth' must be > 0."
);
if
(
2
.
*
p
->
a_smooth
*
p
->
r_cut_max_ratio
>
p
->
mesh_size
)
error
(
"Mesh too small given r_cut_max. Should be at least %d cells wide."
,
(
int
)(
2
.
*
p
->
a_smooth
*
p
->
r_cut_max_ratio
)
+
1
);
/* Time integration */
/* Time integration */
p
->
eta
=
parser_get_param_float
(
params
,
"Gravity:eta"
);
p
->
eta
=
parser_get_param_float
(
params
,
"Gravity:eta"
);
...
...
This diff is collapsed.
Click to expand it.
src/mesh_gravity.c
+
4
−
1
View file @
37baeabb
...
@@ -574,7 +574,7 @@ void pm_mesh_init(struct pm_mesh* mesh, const struct gravity_props* props,
...
@@ -574,7 +574,7 @@ void pm_mesh_init(struct pm_mesh* mesh, const struct gravity_props* props,
#ifdef HAVE_FFTW
#ifdef HAVE_FFTW
if
(
dim
[
0
]
!=
dim
[
1
]
||
dim
[
0
]
!=
dim
[
1
])
if
(
dim
[
0
]
!=
dim
[
1
]
||
dim
[
0
]
!=
dim
[
2
])
error
(
"Doing mesh-gravity on a non-cubic domain"
);
error
(
"Doing mesh-gravity on a non-cubic domain"
);
const
int
N
=
props
->
mesh_size
;
const
int
N
=
props
->
mesh_size
;
...
@@ -591,6 +591,9 @@ void pm_mesh_init(struct pm_mesh* mesh, const struct gravity_props* props,
...
@@ -591,6 +591,9 @@ void pm_mesh_init(struct pm_mesh* mesh, const struct gravity_props* props,
mesh
->
r_cut_max
=
mesh
->
r_s
*
props
->
r_cut_max_ratio
;
mesh
->
r_cut_max
=
mesh
->
r_s
*
props
->
r_cut_max_ratio
;
mesh
->
r_cut_min
=
mesh
->
r_s
*
props
->
r_cut_min_ratio
;
mesh
->
r_cut_min
=
mesh
->
r_s
*
props
->
r_cut_min_ratio
;
if
(
2
.
*
mesh
->
r_cut_max
>
box_size
)
error
(
"Mesh too small or r_cut_max too big for this box size"
);
/* Allocate the memory for the combined density and potential array */
/* Allocate the memory for the combined density and potential array */
mesh
->
potential
=
(
double
*
)
fftw_malloc
(
sizeof
(
double
)
*
N
*
N
*
N
);
mesh
->
potential
=
(
double
*
)
fftw_malloc
(
sizeof
(
double
)
*
N
*
N
*
N
);
if
(
mesh
->
potential
==
NULL
)
if
(
mesh
->
potential
==
NULL
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment