Skip to content
Snippets Groups Projects
Commit af100ef5 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Also set the value of rho and wcount to sensible values when no neighbours are found.

parent 76469999
Branches
Tags
1 merge request!351Reset the value of rho_dh to something sensible if no neighbours are found when imposing h=h_max
...@@ -228,7 +228,14 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( ...@@ -228,7 +228,14 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
__attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
struct part *restrict p, struct xpart *restrict xp) { 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 */ /* 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->rho_dh = 0.f;
p->density.wcount_dh = 0.f; p->density.wcount_dh = 0.f;
p->density.div_v = 0.f; p->density.div_v = 0.f;
......
...@@ -233,7 +233,14 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( ...@@ -233,7 +233,14 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
__attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
struct part *restrict p, struct xpart *restrict xp) { 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 */ /* 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.rho_dh = 0.f;
p->density.wcount_dh = 0.f; p->density.wcount_dh = 0.f;
p->density.div_v = 0.f; p->density.div_v = 0.f;
......
...@@ -375,7 +375,13 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( ...@@ -375,7 +375,13 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
__attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
struct part* restrict p, struct xpart* restrict xp) { 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 */ /* Re-set problematic values */
p->density.wcount = kernel_root * kernel_norm * h_inv_dim;
p->density.wcount_dh = 0.f; p->density.wcount_dh = 0.f;
} }
......
...@@ -236,7 +236,14 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( ...@@ -236,7 +236,14 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
__attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
struct part *restrict p, struct xpart *restrict xp) { 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 */ /* 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.rho_dh = 0.f;
p->density.wcount_dh = 0.f; p->density.wcount_dh = 0.f;
} }
......
...@@ -245,7 +245,15 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( ...@@ -245,7 +245,15 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
__attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
struct part *restrict p, struct xpart *restrict xp) { 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 */ /* 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.rho_dh = 0.f;
p->density.wcount_dh = 0.f; p->density.wcount_dh = 0.f;
p->density.pressure_dh = 0.f; // MATTHIEU: to be checked p->density.pressure_dh = 0.f; // MATTHIEU: to be checked
......
...@@ -247,7 +247,13 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( ...@@ -247,7 +247,13 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
__attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
struct part* restrict p, struct xpart* restrict xp) { 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 */ /* Re-set problematic values */
p->density.wcount = kernel_root * kernel_norm * h_inv_dim;
p->density.wcount_dh = 0.f; p->density.wcount_dh = 0.f;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment