Skip to content

Commit

Permalink
Prevent the use of 0 or negative smoothing-scale for the gravity mesh…
Browse files Browse the repository at this point in the history
… forces.
  • Loading branch information
MatthieuSchaller committed May 13, 2018
1 parent 7a93b34 commit 825558a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/gravity_properties.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ void gravity_props_init(struct gravity_props *p,
p->r_cut_min = parser_get_opt_param_float(params, "Gravity:r_cut_min",
gravity_props_default_r_cut_min);

if (p->a_smooth <= 0.)
error("The mesh smoothing scale 'a_smooth' must be > 0.");

/* Time integration */
p->eta = parser_get_param_float(params, "Gravity:eta");

Expand Down
1 change: 1 addition & 0 deletions src/runner_doiact_fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ void runner_do_grav_fft(struct runner* r, int timer) {
TIMER_TIC;

if (cdim[0] != cdim[1] || cdim[0] != cdim[2]) error("Non-square mesh");
if (a_smooth <= 0.) error("Invalid value of a_smooth");

/* Some useful constants */
const int N = cdim[0];
Expand Down
2 changes: 1 addition & 1 deletion tests/fft_params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ Gravity:
theta: 0.7 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.00001 # Comoving softening length (in internal units).
max_physical_softening: 0.00001 # Physical softening length (in internal units).
a_smooth: 0.
a_smooth: 0.00001
r_cut: 0.

0 comments on commit 825558a

Please sign in to comment.