diff --git a/src/hydro/Shadowswift/hydro.h b/src/hydro/Shadowswift/hydro.h index 70eb5d3230f2a953dcfa5b38a77921d558152043..aa8477ad3d44817dd03dfe02d248df1accff0bfc 100644 --- a/src/hydro/Shadowswift/hydro.h +++ b/src/hydro/Shadowswift/hydro.h @@ -182,12 +182,13 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( if (hnew < p->h) { /* Iteration succesful: we accept, but manually set h to a smaller value for the next time step */ - p->density.wcount = 1.0f; + const float hinvdim = pow_dimension(1.0f / p->h); + p->density.wcount = hinvdim; p->h = 1.1f * hnew; } else { /* Iteration not succesful: we force h to become 1.1*hnew */ p->density.wcount = 0.0f; - p->density.wcount_dh = 1.0f / (1.1f * hnew - p->h); + p->density.wcount_dh = p->h / (1.1f * hnew - p->h); return; } volume = p->cell.volume; diff --git a/src/hydro_properties.c b/src/hydro_properties.c index c5448f77353e1859c1f8853394bbefbe26d0a3a9..5540d8c33c6263213b35697cfed2b6b5b07de2b7 100644 --- a/src/hydro_properties.c +++ b/src/hydro_properties.c @@ -72,6 +72,7 @@ void hydro_props_init(struct hydro_props *p, /* change the meaning of target_neighbours and delta_neighbours */ p->target_neighbours = 1.0f; p->delta_neighbours = 0.0f; + p->eta_neighbours = 1.0f; #endif /* Maximal smoothing length */ diff --git a/tests/test27cells.c b/tests/test27cells.c index ada1b782cfff3866bf26937391007947e9c9a175..f62c169486250ba940c22f21ba1556cca4060c1a 100644 --- a/tests/test27cells.c +++ b/tests/test27cells.c @@ -217,8 +217,20 @@ void clean_up(struct cell *ci) { * @brief Initializes all particles field to be ready for a density calculation */ void zero_particle_fields(struct cell *c) { +#ifdef SHADOWFAX_SPH + struct hydro_space hs; + hs.anchor[0] = 0.; + hs.anchor[1] = 0.; + hs.anchor[2] = 0.; + hs.side[0] = 1.; + hs.side[1] = 1.; + hs.side[2] = 1.; + struct hydro_space *hspointer = &hs; +#else + struct hydro_space *hspointer = NULL; +#endif for (int pid = 0; pid < c->count; pid++) { - hydro_init_part(&c->parts[pid], NULL); + hydro_init_part(&c->parts[pid], hspointer); } }