From 630b09afd06702c16eea3781cc010e7ebf99b6ea Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Mon, 7 Aug 2017 23:33:49 +0100 Subject: [PATCH] Also updated the Pressure-Entropy SPH scheme to use the new definition of the number of neighbours and its derivative. Back to correct results. --- src/hydro/PressureEntropy/hydro.h | 5 +++-- src/hydro/PressureEntropy/hydro_iact.h | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/hydro/PressureEntropy/hydro.h b/src/hydro/PressureEntropy/hydro.h index 6d8d06abb1..080b796b21 100644 --- a/src/hydro/PressureEntropy/hydro.h +++ b/src/hydro/PressureEntropy/hydro.h @@ -212,14 +212,15 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( p->density.pressure_dh -= hydro_dimension * p->mass * p->entropy_one_over_gamma * kernel_root; p->density.wcount += kernel_root; + p->density.wcount_dh -= hydro_dimension * kernel_root; /* Finish the calculation by inserting the missing h-factors */ p->rho *= h_inv_dim; p->rho_bar *= h_inv_dim; p->density.rho_dh *= h_inv_dim_plus_one; p->density.pressure_dh *= h_inv_dim_plus_one; - p->density.wcount *= kernel_norm; - p->density.wcount_dh *= h_inv * kernel_gamma * kernel_norm; + p->density.wcount *= h_inv_dim; + p->density.wcount_dh *= h_inv_dim_plus_one; const float rho_inv = 1.f / p->rho; const float entropy_minus_one_over_gamma = 1.f / p->entropy_one_over_gamma; diff --git a/src/hydro/PressureEntropy/hydro_iact.h b/src/hydro/PressureEntropy/hydro_iact.h index ce1c38ca69..37a9f2b01a 100644 --- a/src/hydro/PressureEntropy/hydro_iact.h +++ b/src/hydro/PressureEntropy/hydro_iact.h @@ -59,7 +59,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_density( /* Compute contribution to the number of neighbours */ pi->density.wcount += wi; - pi->density.wcount_dh -= ui * wi_dx; + pi->density.wcount_dh -= (hydro_dimension * wi + ui * wi_dx); /* Compute contribution to the weighted density */ pi->rho_bar += mj * pj->entropy_one_over_gamma * wi; @@ -77,7 +77,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_density( /* Compute contribution to the number of neighbours */ pj->density.wcount += wj; - pj->density.wcount_dh -= uj * wj_dx; + pj->density.wcount_dh -= (hydro_dimension * wj + uj * wj_dx); /* Compute contribution to the weighted density */ pj->rho_bar += mi * pi->entropy_one_over_gamma * wj; @@ -147,7 +147,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density( /* Compute contribution to the number of neighbours */ pi->density.wcount += wi; - pi->density.wcount_dh -= ui * wi_dx; + pi->density.wcount_dh -= (hydro_dimension * wi + ui * wi_dx); /* Compute contribution to the weighted density */ pi->rho_bar += mj * pj->entropy_one_over_gamma * wi; -- GitLab