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

Mark particles that have been hit by feedback (SNII or AGN) with a flag that...

Mark particles that have been hit by feedback (SNII or AGN) with a flag that is later stored in the snapshots.
parent 67c1fe38
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "random.h" #include "random.h"
#include "space.h" #include "space.h"
#include "timestep_sync_part.h" #include "timestep_sync_part.h"
#include "tracers.h"
/** /**
* @brief Density interaction between two particles (non-symmetric). * @brief Density interaction between two particles (non-symmetric).
...@@ -380,6 +381,9 @@ runner_iact_nonsym_bh_gas_feedback(const float r2, const float *dx, ...@@ -380,6 +381,9 @@ runner_iact_nonsym_bh_gas_feedback(const float r2, const float *dx,
/* Impose maximal viscosity */ /* Impose maximal viscosity */
hydro_diffusive_feedback_reset(pj); hydro_diffusive_feedback_reset(pj);
/* Mark this particle has having been heated by AGN feedback */
tracers_after_black_holes_feedback(xpj);
/* message( */ /* message( */
/* "We did some AGN heating! id %llu BH id %llu probability " */ /* "We did some AGN heating! id %llu BH id %llu probability " */
/* " %.5e random_num %.5e du %.5e du/ini %.5e", */ /* " %.5e random_num %.5e du %.5e du/ini %.5e", */
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
/* Local includes */ /* Local includes */
#include "random.h" #include "random.h"
#include "timestep_sync_part.h" #include "timestep_sync_part.h"
#include "tracers.h"
/** /**
* @brief Density interaction between two particles (non-symmetric). * @brief Density interaction between two particles (non-symmetric).
...@@ -295,6 +296,9 @@ runner_iact_nonsym_feedback_apply(const float r2, const float *dx, ...@@ -295,6 +296,9 @@ runner_iact_nonsym_feedback_apply(const float r2, const float *dx,
/* Impose maximal viscosity */ /* Impose maximal viscosity */
hydro_diffusive_feedback_reset(pj); hydro_diffusive_feedback_reset(pj);
/* Mark this particle has having been heated by supernova feedback */
tracers_after_feedback(xpj);
/* message( */ /* message( */
/* "We did some heating! id %llu star id %llu probability %.5e " */ /* "We did some heating! id %llu star id %llu probability %.5e " */
/* "random_num %.5e du %.5e du/ini %.5e", */ /* "random_num %.5e du %.5e du/ini %.5e", */
......
...@@ -113,10 +113,7 @@ static INLINE void tracers_after_timestep( ...@@ -113,10 +113,7 @@ static INLINE void tracers_after_timestep(
} }
/** /**
* @brief Update the particle tracers just after its time-step has been * @brief Initialise the tracer data at the start of a calculation.
* computed.
*
* Set the maximal temperature to a valid initial state
* *
* @param p Pointer to the particle data. * @param p Pointer to the particle data.
* @param xp Pointer to the extended particle data (containing the tracers * @param xp Pointer to the extended particle data (containing the tracers
...@@ -135,6 +132,30 @@ static INLINE void tracers_first_init_xpart( ...@@ -135,6 +132,30 @@ static INLINE void tracers_first_init_xpart(
xp->tracers_data.maximum_temperature = -1.f; xp->tracers_data.maximum_temperature = -1.f;
xp->tracers_data.maximum_temperature_time = -1.f; xp->tracers_data.maximum_temperature_time = -1.f;
xp->tracers_data.hit_by_SNII_feedback = 0;
xp->tracers_data.hit_by_AGN_feedback = 0;
}
/**
* @brief Update the particles' tracer data after a stellar feedback
* event.
*
* @param xp The extended particle data.
*/
static INLINE void tracers_after_feedback(struct xpart *xp) {
xp->tracers_data.hit_by_SNII_feedback = 1;
}
/**
* @brief Update the particles' tracer data after an AGN feedback
* event.
*
* @param xp The extended particle data.
*/
static INLINE void tracers_after_black_holes_feedback(struct xpart *xp) {
xp->tracers_data.hit_by_AGN_feedback = 1;
} }
#endif /* SWIFT_TRACERS_EAGLE_H */ #endif /* SWIFT_TRACERS_EAGLE_H */
...@@ -73,7 +73,19 @@ __attribute__((always_inline)) INLINE static int tracers_write_particles( ...@@ -73,7 +73,19 @@ __attribute__((always_inline)) INLINE static int tracers_write_particles(
"Times at which the maximal temperature was reached"); "Times at which the maximal temperature was reached");
} }
return 2; list[2] =
io_make_output_field("HeatedBySNIIFeedback", CHAR, 1, UNIT_CONV_NO_UNITS,
0.f, xparts, tracers_data.hit_by_SNII_feedback,
"Flags the particles that have been directly hit by "
"a SNII feedback event at some point in the past.");
list[3] =
io_make_output_field("HeatedByAGNFeedback", CHAR, 1, UNIT_CONV_NO_UNITS,
0.f, xparts, tracers_data.hit_by_AGN_feedback,
"Flags the particles that have been directly hit by "
"an AGN feedback event at some point in the past.");
return 4;
} }
__attribute__((always_inline)) INLINE static int tracers_write_sparticles( __attribute__((always_inline)) INLINE static int tracers_write_sparticles(
...@@ -100,7 +112,21 @@ __attribute__((always_inline)) INLINE static int tracers_write_sparticles( ...@@ -100,7 +112,21 @@ __attribute__((always_inline)) INLINE static int tracers_write_sparticles(
"Times at which the maximal temperature was reached"); "Times at which the maximal temperature was reached");
} }
return 2; list[2] =
io_make_output_field("HeatedBySNIIFeedback", CHAR, 1, UNIT_CONV_NO_UNITS,
0.f, sparts, tracers_data.hit_by_SNII_feedback,
"Flags the particles that have been directly hit by "
"a SNII feedback event at some point in the past "
"when the particle was still a gas particle.");
list[3] =
io_make_output_field("HeatedByAGNFeedback", CHAR, 1, UNIT_CONV_NO_UNITS,
0.f, sparts, tracers_data.hit_by_AGN_feedback,
"Flags the particles that have been directly hit by "
"an AGN feedback event at some point in the past "
"when the particle was still a gas particle.");
return 4;
} }
#endif /* SWIFT_TRACERS_EAGLE_IO_H */ #endif /* SWIFT_TRACERS_EAGLE_IO_H */
...@@ -36,6 +36,12 @@ struct tracers_xpart_data { ...@@ -36,6 +36,12 @@ struct tracers_xpart_data {
/*! Time at which the maximal temperature was reached */ /*! Time at which the maximal temperature was reached */
float maximum_temperature_time; float maximum_temperature_time;
}; };
/*! Has this particle been hit by SNII feedback? */
char hit_by_SNII_feedback;
/*! Has this particle been hit by AGN feedback? */
char hit_by_AGN_feedback;
}; };
#endif /* SWIFT_TRACERS_STRUCT_EAGLE_H */ #endif /* SWIFT_TRACERS_STRUCT_EAGLE_H */
...@@ -90,10 +90,7 @@ static INLINE void tracers_after_timestep( ...@@ -90,10 +90,7 @@ static INLINE void tracers_after_timestep(
const struct cooling_function_data *cooling, const double time) {} const struct cooling_function_data *cooling, const double time) {}
/** /**
* @brief Update the particle tracers just after its time-step has been * @brief Initialise the tracer data at the start of a calculation.
* computed.
*
* Nothing to do here in the EAGLE model.
* *
* @param us The internal system of units. * @param us The internal system of units.
* @param phys_const The physical constants in internal units. * @param phys_const The physical constants in internal units.
...@@ -110,4 +107,24 @@ static INLINE void tracers_first_init_xpart( ...@@ -110,4 +107,24 @@ static INLINE void tracers_first_init_xpart(
const struct hydro_props *hydro_props, const struct hydro_props *hydro_props,
const struct cooling_function_data *cooling) {} const struct cooling_function_data *cooling) {}
/**
* @brief Update the particles' tracer data after a stellar feedback
* event.
*
* Nothing to do here.
*
* @param xp The extended particle data.
*/
static INLINE void tracers_after_feedback(struct xpart *xp) {}
/**
* @brief Update the particles' tracer data after an AGN feedback
* event.
*
* Nothing to do here.
*
* @param xp The extended particle data.
*/
static INLINE void tracers_after_black_holes_feedback(struct xpart *xp) {}
#endif /* SWIFT_TRACERS_NONE_H */ #endif /* SWIFT_TRACERS_NONE_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment