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

Make the cooling compatible with GIZMO as well. Added Stefan and Massimiliano to the author list.

parent 82d4f18f
No related branches found
No related tags found
No related merge requests found
...@@ -8,3 +8,5 @@ John A. Regan john.a.regan@durham.ac.uk ...@@ -8,3 +8,5 @@ John A. Regan john.a.regan@durham.ac.uk
Angus Lepper angus.lepper@ed.ac.uk Angus Lepper angus.lepper@ed.ac.uk
Tom Theuns tom.theuns@durham.ac.uk Tom Theuns tom.theuns@durham.ac.uk
Richard G. Bower r.g.bower@durham.ac.uk Richard G. Bower r.g.bower@durham.ac.uk
Stefan Arridge stefan.arridge@durham.ac.uk
Massimiliano Culpo massimiliano.culpo@googlemail.com
...@@ -72,7 +72,7 @@ __attribute__((always_inline)) INLINE static float cooling_rate( ...@@ -72,7 +72,7 @@ __attribute__((always_inline)) INLINE static float cooling_rate(
/* Get particle properties */ /* Get particle properties */
/* Density */ /* Density */
const float rho = p->rho; const float rho = hydro_get_density(p);
/* Get cooling function properties */ /* Get cooling function properties */
const float X_H = cooling->hydrogen_mass_abundance; const float X_H = cooling->hydrogen_mass_abundance;
/* lambda should always be set in cgs units */ /* lambda should always be set in cgs units */
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <float.h> #include <float.h>
#include "adiabatic_index.h" #include "adiabatic_index.h"
#include "approx_math.h" #include "approx_math.h"
#include "equation_of_state.h"
#include "hydro_gradients.h" #include "hydro_gradients.h"
#include "minmax.h" #include "minmax.h"
...@@ -502,3 +503,34 @@ __attribute__((always_inline)) INLINE static float hydro_get_density( ...@@ -502,3 +503,34 @@ __attribute__((always_inline)) INLINE static float hydro_get_density(
return p->primitives.rho; return p->primitives.rho;
} }
/**
* @brief Modifies the thermal state of a particle to the imposed internal
* energy
*
* This overrides the current state of the particle but does *not* change its
* time-derivatives
*
* @param p The particle
* @param u The new internal energy
*/
__attribute__((always_inline)) INLINE static void hydro_set_internal_energy(
struct part* restrict p, float u) {
p->conserved.energy = u;
}
/**
* @brief Modifies the thermal state of a particle to the imposed entropy
*
* This overrides the current state of the particle but does *not* change its
* time-derivatives
*
* @param p The particle
* @param S The new entropy
*/
__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);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment