Skip to content
Snippets Groups Projects
Commit 8dbefb16 authored by Bert Vandenbroucke's avatar Bert Vandenbroucke
Browse files

Fixed bug in test27cells when running shadowfax hydro. Tried to fix 1D shadowswift, no success yet.

parent 331eb21f
No related branches found
No related tags found
1 merge request!575Shadowswift
...@@ -182,12 +182,13 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( ...@@ -182,12 +182,13 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
if (hnew < p->h) { if (hnew < p->h) {
/* Iteration succesful: we accept, but manually set h to a smaller value /* Iteration succesful: we accept, but manually set h to a smaller value
for the next time step */ 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; p->h = 1.1f * hnew;
} else { } else {
/* Iteration not succesful: we force h to become 1.1*hnew */ /* Iteration not succesful: we force h to become 1.1*hnew */
p->density.wcount = 0.0f; 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; return;
} }
volume = p->cell.volume; volume = p->cell.volume;
......
...@@ -72,6 +72,7 @@ void hydro_props_init(struct hydro_props *p, ...@@ -72,6 +72,7 @@ void hydro_props_init(struct hydro_props *p,
/* change the meaning of target_neighbours and delta_neighbours */ /* change the meaning of target_neighbours and delta_neighbours */
p->target_neighbours = 1.0f; p->target_neighbours = 1.0f;
p->delta_neighbours = 0.0f; p->delta_neighbours = 0.0f;
p->eta_neighbours = 1.0f;
#endif #endif
/* Maximal smoothing length */ /* Maximal smoothing length */
......
...@@ -217,8 +217,20 @@ void clean_up(struct cell *ci) { ...@@ -217,8 +217,20 @@ void clean_up(struct cell *ci) {
* @brief Initializes all particles field to be ready for a density calculation * @brief Initializes all particles field to be ready for a density calculation
*/ */
void zero_particle_fields(struct cell *c) { 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++) { for (int pid = 0; pid < c->count; pid++) {
hydro_init_part(&c->parts[pid], NULL); hydro_init_part(&c->parts[pid], hspointer);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment