Commit 826af0bd authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'gear_cosmo3' into 'master'

Gear cosmo3

See merge request !1118
parents afbf0b3e 4daf686f
......@@ -20,6 +20,7 @@
#define SWIFT_CHEMISTRY_IO_GEAR_H
#include "chemistry_struct.h"
#include "engine.h"
#include "error.h"
#include "feedback.h"
#include "io_properties.h"
......
......@@ -786,27 +786,10 @@ void cooling_cool_part(const struct phys_const* restrict phys_const,
/* Calculate the cooling rate */
float cool_du_dt = (u_new - u_ad_before) / dt_therm;
/* Check that the energy stays above the limits if the time step increase by 2
*/
/* Hydro */
double u_ad = u_new + hydro_du_dt * dt_therm;
if (u_ad < u_minimal) {
hydro_du_dt = (u_ad - u_new) / dt_therm;
u_ad = u_minimal;
}
/* Cooling */
const double u_cool = u_ad + cool_du_dt * dt_therm;
if (u_cool < u_minimal) {
cool_du_dt = (u_cool - u_ad) / dt_therm;
}
cool_du_dt = (u_new - u_old) / dt_therm;
float du_dt = cool_du_dt + hydro_du_dt;
/* Update the internal energy time derivative */
hydro_set_physical_internal_energy_dt(p, cosmo,
cool_du_dt /* + hydro_du_dt */);
hydro_set_physical_internal_energy_dt(p, cosmo, du_dt);
/* Store the radiated energy */
xp->cooling_data.radiated_energy -= hydro_get_mass(p) * cool_du_dt * dt_therm;
......
......@@ -66,7 +66,8 @@ void feedback_update_part(struct part* restrict p, struct xpart* restrict xp,
p->rho *= new_mass / old_mass;
/* Update internal energy */
const float u = hydro_get_physical_internal_energy(p, xp, cosmo);
const float u =
hydro_get_physical_internal_energy(p, xp, cosmo) * old_mass / new_mass;
const float u_new = u + xp->feedback_data.delta_u;
hydro_set_physical_internal_energy(p, xp, cosmo, u_new);
......
......@@ -61,7 +61,7 @@ struct pressure_floor_properties {
* @param pressure_comoving The comoving pressure without any pressure floor.
* @param cosmo The #cosmology model.
*
* @return The physical or comoving pressure with the floor.
* @return The comoving pressure with the floor.
*/
__attribute__((always_inline)) static INLINE float
pressure_floor_get_comoving_pressure(const struct part* p,
......
......@@ -115,7 +115,7 @@ INLINE static void stars_write_particles(const struct spart *sparts,
const int with_cosmology) {
/* Say how much we want to write */
*num_fields = 7;
*num_fields = 6;
/* List what we want to write */
list[0] = io_make_output_field_convert_spart(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment