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

Merge branch 'gizmo' into 'master'

Fixed bug in GIZMO_SPH hydro_get_internal_energy.

The energy stored in `conserved.energy` is not the thermal energy (per unit mass) `u`, but the total thermal energy `u*conserved.mass`. Updated `hydro_get_internal_energy` and `hydro_set_entropy` to reflect this.

See merge request !244
parents 17b827a1 363241a0
No related branches found
No related tags found
1 merge request!244Fixed bug in GIZMO_SPH hydro_get_internal_energy.
......@@ -517,7 +517,9 @@ __attribute__((always_inline)) INLINE static float hydro_get_density(
__attribute__((always_inline)) INLINE static void hydro_set_internal_energy(
struct part* restrict p, float u) {
p->conserved.energy = u;
/* conserved.energy is NOT the specific energy (u), but the total thermal
energy (u*m) */
p->conserved.energy = u * p->conserved.mass;
}
/**
......@@ -532,5 +534,6 @@ __attribute__((always_inline)) INLINE static void hydro_set_internal_energy(
__attribute__((always_inline)) INLINE static void hydro_set_entropy(
struct part* restrict p, float S) {
p->conserved.energy = gas_internal_energy_from_entropy(p->primitives.rho, S);
p->conserved.energy = gas_internal_energy_from_entropy(p->primitives.rho, S) *
p->conserved.mass;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment