diff --git a/src/hydro/Default/hydro.h b/src/hydro/Default/hydro.h index 5f67320bc5bde3d193cb79dafdcb6c8b22acd950..31f0c4172099479abff9e1ed19487130a0a8938b 100644 --- a/src/hydro/Default/hydro.h +++ b/src/hydro/Default/hydro.h @@ -228,7 +228,14 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( struct part *restrict p, struct xpart *restrict xp) { + /* Some smoothing length multiples. */ + const float h = p->h; + const float h_inv = 1.0f / h; /* 1/h */ + const float h_inv_dim = pow_dimension(h_inv); /* 1/h^d */ + /* Re-set problematic values */ + p->rho = p->mass * kernel_root * h_inv_dim; + p->density.wcount = kernel_root * kernel_norm * h_inv_dim; p->rho_dh = 0.f; p->density.wcount_dh = 0.f; p->density.div_v = 0.f; diff --git a/src/hydro/Gadget2/hydro.h b/src/hydro/Gadget2/hydro.h index d812a1c700c7b6159dfcac8ad71130ccee1f7be1..24cf766d1c39bd11fe7588f887302d3d5e5ffded 100644 --- a/src/hydro/Gadget2/hydro.h +++ b/src/hydro/Gadget2/hydro.h @@ -233,7 +233,14 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( struct part *restrict p, struct xpart *restrict xp) { + /* Some smoothing length multiples. */ + const float h = p->h; + const float h_inv = 1.0f / h; /* 1/h */ + const float h_inv_dim = pow_dimension(h_inv); /* 1/h^d */ + /* Re-set problematic values */ + p->rho = p->mass * kernel_root * h_inv_dim; + p->density.wcount = kernel_root * kernel_norm * h_inv_dim; p->density.rho_dh = 0.f; p->density.wcount_dh = 0.f; p->density.div_v = 0.f; diff --git a/src/hydro/Gizmo/hydro.h b/src/hydro/Gizmo/hydro.h index d2122a6e29c39b76658458d604f37e235b03d452..5b38637c8c7d441cd1eea5c08b621b35ba9abdbf 100644 --- a/src/hydro/Gizmo/hydro.h +++ b/src/hydro/Gizmo/hydro.h @@ -375,7 +375,13 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( struct part* restrict p, struct xpart* restrict xp) { + /* Some smoothing length multiples. */ + const float h = p->h; + const float h_inv = 1.0f / h; /* 1/h */ + const float h_inv_dim = pow_dimension(h_inv); /* 1/h^d */ + /* Re-set problematic values */ + p->density.wcount = kernel_root * kernel_norm * h_inv_dim; p->density.wcount_dh = 0.f; } diff --git a/src/hydro/Minimal/hydro.h b/src/hydro/Minimal/hydro.h index ab2eb30f4c8d06b605decb831aee41ea1ea77057..9fffc6d888d575f197481216419d3fef0b0aed5d 100644 --- a/src/hydro/Minimal/hydro.h +++ b/src/hydro/Minimal/hydro.h @@ -236,7 +236,14 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( struct part *restrict p, struct xpart *restrict xp) { + /* Some smoothing length multiples. */ + const float h = p->h; + const float h_inv = 1.0f / h; /* 1/h */ + const float h_inv_dim = pow_dimension(h_inv); /* 1/h^d */ + /* Re-set problematic values */ + p->rho = p->mass * kernel_root * h_inv_dim; + p->density.wcount = kernel_root * kernel_norm * h_inv_dim; p->density.rho_dh = 0.f; p->density.wcount_dh = 0.f; } diff --git a/src/hydro/PressureEntropy/hydro.h b/src/hydro/PressureEntropy/hydro.h index 289640722a8d434bba0644590c68d929f3964e51..d3de13b8a36607764188d214af2737d7abffe21d 100644 --- a/src/hydro/PressureEntropy/hydro.h +++ b/src/hydro/PressureEntropy/hydro.h @@ -245,7 +245,15 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( struct part *restrict p, struct xpart *restrict xp) { + /* Some smoothing length multiples. */ + const float h = p->h; + const float h_inv = 1.0f / h; /* 1/h */ + const float h_inv_dim = pow_dimension(h_inv); /* 1/h^d */ + /* Re-set problematic values */ + p->rho = p->mass * kernel_root * h_inv_dim; + p->rho_bar = p->mass * p->entropy_one_over_gamma * kernel_root * h_inv_dim; + p->density.wcount = kernel_root * kernel_norm * h_inv_dim; p->density.rho_dh = 0.f; p->density.wcount_dh = 0.f; p->density.pressure_dh = 0.f; // MATTHIEU: to be checked diff --git a/src/hydro/Shadowswift/hydro.h b/src/hydro/Shadowswift/hydro.h index 51b5fcd87f7f004c2d793f84af04578abff0f0f8..abbcdcd2f7879d8063a906e44ab2fe6a3e675828 100644 --- a/src/hydro/Shadowswift/hydro.h +++ b/src/hydro/Shadowswift/hydro.h @@ -247,7 +247,13 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( struct part* restrict p, struct xpart* restrict xp) { + /* Some smoothing length multiples. */ + const float h = p->h; + const float h_inv = 1.0f / h; /* 1/h */ + const float h_inv_dim = pow_dimension(h_inv); /* 1/h^d */ + /* Re-set problematic values */ + p->density.wcount = kernel_root * kernel_norm * h_inv_dim; p->density.wcount_dh = 0.f; }