From f65736749ecf180321e73bfae4202e54b624dc80 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Tue, 19 Feb 2013 19:06:15 +0000 Subject: [PATCH] Added a constant to represent the allowed delta between the desired (weighted) number of neighbours and the computed one. Was set to 1 in the code until now. Former-commit-id: d038be315b4691e6e455844a774622836b55e34e --- src/const.h | 11 +++++++++-- src/runner.c | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/const.h b/src/const.h index ab553a0b0c..e3edd35fd5 100644 --- a/src/const.h +++ b/src/const.h @@ -1,6 +1,7 @@ /******************************************************************************* * This file is part of SWIFT. * Coypright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk) + * Matthieu Schaller (matthieu.schaller@durham.ac.uk) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -18,7 +19,13 @@ ******************************************************************************/ -/* Physical constants. */ +/* Hydrodynamical constants. */ #define const_gamma (5.0f/3.0f) +#define const_viscosity_alpha 0.8 + +/* Time integration constants. */ #define const_cfl 0.25f -#define const_nwneigh 48 + +/* Neighbour search constants. */ +#define const_nwneigh 48.f +#define const_delta_nwneigh 1.f diff --git a/src/runner.c b/src/runner.c index b0a4d6ce40..99e674ec0b 100644 --- a/src/runner.c +++ b/src/runner.c @@ -382,8 +382,8 @@ void runner_doghost ( struct runner *r , struct cell *c ) { cp->h = p->h; /* Did we get the right number density? */ - if ( p->wcount > const_nwneigh + 1 || - p->wcount < const_nwneigh - 1 ) { + if ( p->wcount > const_nwneigh + const_delta_nwneigh || + p->wcount < const_nwneigh - const_delta_nwneigh ) { // printf( "runner_doghost: particle %lli (h=%e,h_dt=%e,depth=%i) has bad wcount=%.3f.\n" , p->id , p->h , p->h_dt , c->depth , p->wcount ); fflush(stdout); // p->h += ( p->wcount + kernel_root - const_nwneigh ) / p->wcount_dh; pid[redo] = pid[i]; -- GitLab