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

Re-introduced rho_dh in the Pressure-Energy SPH hydro case to allow for the...

Re-introduced rho_dh in the Pressure-Energy SPH hydro case to allow for the alternative neighbour number definition.
parent 4ad9d40e
Branches
Tags
1 merge request!926Alternative definition of the number of neighbours
...@@ -517,6 +517,7 @@ __attribute__((always_inline)) INLINE static void hydro_init_part( ...@@ -517,6 +517,7 @@ __attribute__((always_inline)) INLINE static void hydro_init_part(
p->density.wcount = 0.f; p->density.wcount = 0.f;
p->density.wcount_dh = 0.f; p->density.wcount_dh = 0.f;
p->rho = 0.f; p->rho = 0.f;
p->density.rho_dh = 0.f;
p->pressure_bar = 0.f; p->pressure_bar = 0.f;
p->density.pressure_bar_dh = 0.f; p->density.pressure_bar_dh = 0.f;
...@@ -550,6 +551,7 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( ...@@ -550,6 +551,7 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
/* Final operation on the density (add self-contribution). */ /* Final operation on the density (add self-contribution). */
p->rho += p->mass * kernel_root; p->rho += p->mass * kernel_root;
p->density.rho_dh -= hydro_dimension * p->mass * kernel_root;
p->pressure_bar += p->mass * p->u * kernel_root; p->pressure_bar += p->mass * p->u * kernel_root;
p->density.pressure_bar_dh -= hydro_dimension * p->mass * p->u * kernel_root; p->density.pressure_bar_dh -= hydro_dimension * p->mass * p->u * kernel_root;
p->density.wcount += kernel_root; p->density.wcount += kernel_root;
...@@ -557,6 +559,7 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( ...@@ -557,6 +559,7 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
/* Finish the calculation by inserting the missing h-factors */ /* Finish the calculation by inserting the missing h-factors */
p->rho *= h_inv_dim; p->rho *= h_inv_dim;
p->density.rho_dh *= h_inv_dim_plus_one;
p->pressure_bar *= (h_inv_dim * hydro_gamma_minus_one); p->pressure_bar *= (h_inv_dim * hydro_gamma_minus_one);
p->density.pressure_bar_dh *= (h_inv_dim_plus_one * hydro_gamma_minus_one); p->density.pressure_bar_dh *= (h_inv_dim_plus_one * hydro_gamma_minus_one);
p->density.wcount *= h_inv_dim; p->density.wcount *= h_inv_dim;
...@@ -601,6 +604,7 @@ __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( ...@@ -601,6 +604,7 @@ __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
p->pressure_bar = p->pressure_bar =
p->mass * p->u * hydro_gamma_minus_one * kernel_root * h_inv_dim; p->mass * p->u * hydro_gamma_minus_one * kernel_root * h_inv_dim;
p->density.wcount = kernel_root * h_inv_dim; p->density.wcount = kernel_root * h_inv_dim;
p->density.rho_dh = 0.f;
p->density.wcount_dh = 0.f; p->density.wcount_dh = 0.f;
p->density.pressure_bar_dh = 0.f; p->density.pressure_bar_dh = 0.f;
......
...@@ -69,6 +69,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_density( ...@@ -69,6 +69,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_density(
kernel_deval(ui, &wi, &wi_dx); kernel_deval(ui, &wi, &wi_dx);
pi->rho += mj * wi; pi->rho += mj * wi;
pi->density.rho_dh -= mj * (hydro_dimension * wi + ui * wi_dx);
pi->pressure_bar += mj * wi * pj->u; pi->pressure_bar += mj * wi * pj->u;
pi->density.pressure_bar_dh -= pi->density.pressure_bar_dh -=
...@@ -82,6 +83,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_density( ...@@ -82,6 +83,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_density(
kernel_deval(uj, &wj, &wj_dx); kernel_deval(uj, &wj, &wj_dx);
pj->rho += mi * wj; pj->rho += mi * wj;
pj->density.rho_dh -= mi * (hydro_dimension * wj + uj * wj_dx);
pj->pressure_bar += mi * wj * pi->u; pj->pressure_bar += mi * wj * pi->u;
pj->density.pressure_bar_dh -= pj->density.pressure_bar_dh -=
mi * pi->u * (hydro_dimension * wj + uj * wj_dx); mi * pi->u * (hydro_dimension * wj + uj * wj_dx);
...@@ -147,6 +150,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density( ...@@ -147,6 +150,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
kernel_deval(ui, &wi, &wi_dx); kernel_deval(ui, &wi, &wi_dx);
pi->rho += mj * wi; pi->rho += mj * wi;
pi->density.rho_dh -= mj * (hydro_dimension * wi + ui * wi_dx);
pi->pressure_bar += mj * wi * pj->u; pi->pressure_bar += mj * wi * pj->u;
......
...@@ -133,6 +133,9 @@ struct part { ...@@ -133,6 +133,9 @@ struct part {
/*! Derivative of the neighbour number with respect to h. */ /*! Derivative of the neighbour number with respect to h. */
float wcount_dh; float wcount_dh;
/*! Derivative of density with respect to h */
float rho_dh;
/*! Derivative of the weighted pressure with respect to h */ /*! Derivative of the weighted pressure with respect to h */
float pressure_bar_dh; float pressure_bar_dh;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment