Commit 90207e8d authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Update the other hydro schemes to also compile with the star formation model...

Update the other hydro schemes to also compile with the star formation model and entropy floor model.
parent 8a904dc5
......@@ -9,6 +9,13 @@ This section of the documentation gives a brief description of the
different components of the EAGLE sub-grid model. We mostly focus on
the parameters and values output in the snapshots.
.. _EAGLE_entropy_floors:
Entropy floors
~~~~~~~~~~~~~~
.. _EAGLE_chemical_tracers:
Chemical tracers
......
......@@ -61,7 +61,7 @@ struct xpart {
/* Additional data used by the tracers */
struct tracers_xpart_data tracers_data;
/* Additional data used by the tracers */
/* Additional data used by the star formation */
struct star_formation_xpart_data sf_data;
#ifdef WITH_LOGGER
......
......@@ -21,6 +21,7 @@
#include "chemistry_struct.h"
#include "cooling_struct.h"
#include "star_formation_struct.h"
#include "tracers_struct.h"
/* Extra particle data not needed during the computation. */
......@@ -44,6 +45,9 @@ struct xpart {
/* Additional data used by the tracers */
struct tracers_xpart_data tracers_data;
/* Additional data used by the star formation */
struct star_formation_xpart_data sf_data;
} SWIFT_STRUCT_ALIGN;
/* Data of a single particle. */
......
......@@ -21,6 +21,7 @@
#include "chemistry_struct.h"
#include "cooling_struct.h"
#include "star_formation_struct.h"
#include "tracers_struct.h"
/* Extra particle data not needed during the computation. */
......@@ -44,6 +45,9 @@ struct xpart {
/* Additional data used by the tracers */
struct tracers_xpart_data tracers_data;
/* Additional data used by the star formation */
struct star_formation_xpart_data sf_data;
} SWIFT_STRUCT_ALIGN;
/* Data of a single particle. */
......
......@@ -337,6 +337,23 @@ hydro_set_physical_internal_energy_dt(struct part *restrict p,
p->u_dt = du_dt / cosmo->a_factor_internal_energy;
}
/**
* @brief Sets the physical entropy of a particle
*
* @param p The particle of interest.
* @param xp The extended particle data.
* @param cosmo Cosmology data structure
* @param entropy The physical entropy
*/
__attribute__((always_inline)) INLINE static void hydro_set_physical_entropy(
struct part *p, struct xpart *xp, const struct cosmology *cosmo,
const float entropy) {
/* Note there is no conversion from physical to comoving entropy */
const float comoving_entropy = entropy;
xp->u_full = gas_internal_energy_from_entropy(p->rho, comoving_entropy);
}
/**
* @brief Computes the hydro time-step of a given particle
*
......
......@@ -34,6 +34,7 @@
#include "chemistry_struct.h"
#include "cooling_struct.h"
#include "star_formation_struct.h"
#include "tracers_struct.h"
/**
......@@ -66,6 +67,9 @@ struct xpart {
/* Additional data used by the tracers */
struct tracers_xpart_data tracers_data;
/* Additional data used by the tracers */
struct star_formation_xpart_data sf_data;
} SWIFT_STRUCT_ALIGN;
/**
......
......@@ -360,6 +360,24 @@ hydro_set_physical_internal_energy_dt(struct part *restrict p,
p->u_dt = du_dt / cosmo->a_factor_internal_energy;
}
/**
* @brief Sets the physical entropy of a particle
*
* @param p The particle of interest.
* @param xp The extended particle data.
* @param cosmo Cosmology data structure
* @param entropy The physical entropy
*/
__attribute__((always_inline)) INLINE static void hydro_set_physical_entropy(
struct part *p, struct xpart *xp, const struct cosmology *cosmo,
const float entropy) {
/* Note there is no conversion from physical to comoving entropy */
const float comoving_entropy = entropy;
xp->u_full =
gas_internal_energy_from_entropy(p->rho, comoving_entropy, p->mat_id);
}
/**
* @brief Computes the hydro time-step of a given particle
*
......
......@@ -36,6 +36,7 @@
#include "chemistry_struct.h"
#include "cooling_struct.h"
#include "equation_of_state.h" // For enum material_id
#include "star_formation_struct.h"
#include "tracers_struct.h"
/**
......@@ -65,9 +66,12 @@ struct xpart {
/*! Additional data used to record cooling information */
struct cooling_xpart_data cooling_data;
/* Additional data used by the tracers */
/*! Additional data used by the tracers */
struct tracers_xpart_data tracers_data;
/* Additional data used by the star formation */
struct star_formation_xpart_data sf_data;
} SWIFT_STRUCT_ALIGN;
/**
......
......@@ -362,6 +362,23 @@ hydro_set_physical_internal_energy_dt(struct part *restrict p,
p->u_dt = du_dt / cosmo->a_factor_internal_energy;
}
/**
* @brief Sets the physical entropy of a particle
*
* @param p The particle of interest.
* @param xp The extended particle data.
* @param cosmo Cosmology data structure
* @param entropy The physical entropy
*/
__attribute__((always_inline)) INLINE static void hydro_set_physical_entropy(
struct part *p, struct xpart *xp, const struct cosmology *cosmo,
const float entropy) {
/* Note there is no conversion from physical to comoving entropy */
const float comoving_entropy = entropy;
xp->u_full = gas_internal_energy_from_entropy(p->rho, comoving_entropy);
}
/**
* @brief Computes the hydro time-step of a given particle
*
......
......@@ -33,6 +33,7 @@
#include "chemistry_struct.h"
#include "cooling_struct.h"
#include "star_formation_struct.h"
#include "tracers_struct.h"
/**
......@@ -62,9 +63,12 @@ struct xpart {
/*! Additional data used to record cooling information */
struct cooling_xpart_data cooling_data;
/* Additional data used by the tracers */
/*! Additional data used by the tracers */
struct tracers_xpart_data tracers_data;
/*! Additional data used by the star formation */
struct star_formation_xpart_data sf_data;
} SWIFT_STRUCT_ALIGN;
/**
......
......@@ -143,11 +143,12 @@ __attribute__((always_inline)) INLINE static float hydro_get_comoving_entropy(
* @param cosmo The cosmological model.
*/
__attribute__((always_inline)) INLINE static float hydro_get_physical_entropy(
const struct part *restrict p, const struct cosmology *cosmo) {
const struct part *restrict p, const struct xpart *restrict xp,
const struct cosmology *cosmo) {
/* Note: no cosmological conversion required here with our choice of
* coordinates. */
return gas_entropy_from_internal_energy(p->rho, p->u);
return gas_entropy_from_internal_energy(p->rho, xp->u_full);
}
/**
......@@ -306,12 +307,27 @@ __attribute__((always_inline)) INLINE static void hydro_get_drifted_velocities(
*
* @param p The particle of interest
*/
__attribute__((always_inline)) INLINE static float hydro_get_internal_energy_dt(
const struct part *restrict p) {
__attribute__((always_inline)) INLINE static float
hydro_get_comoving_internal_energy_dt(const struct part *restrict p) {
return p->u_dt;
}
/**
* @brief Returns the time derivative of internal energy of a particle
*
* We assume a constant density.
*
* @param p The particle of interest
* @param cosmo Cosmology data structure
*/
__attribute__((always_inline)) INLINE static float
hydro_get_physical_internal_energy_dt(const struct part *restrict p,
const struct cosmology *cosmo) {
return p->u_dt * cosmo->a_factor_internal_energy;
}
/**
* @brief Sets the time derivative of internal energy of a particle
*
......@@ -320,12 +336,46 @@ __attribute__((always_inline)) INLINE static float hydro_get_internal_energy_dt(
* @param p The particle of interest.
* @param du_dt The new time derivative of the internal energy.
*/
__attribute__((always_inline)) INLINE static void hydro_set_internal_energy_dt(
struct part *restrict p, float du_dt) {
__attribute__((always_inline)) INLINE static void
hydro_set_comoving_internal_energy_dt(struct part *restrict p, float du_dt) {
p->u_dt = du_dt;
}
/**
* @brief Returns the time derivative of internal energy of a particle
*
* We assume a constant density.
*
* @param p The particle of interest.
* @param cosmo Cosmology data structure
* @param du_dt The new time derivative of the internal energy.
*/
__attribute__((always_inline)) INLINE static void
hydro_set_physical_internal_energy_dt(struct part *restrict p,
const struct cosmology *cosmo,
float du_dt) {
p->u_dt = du_dt / cosmo->a_factor_internal_energy;
}
/**
* @brief Sets the physical entropy of a particle
*
* @param p The particle of interest.
* @param xp The extended particle data.
* @param cosmo Cosmology data structure
* @param entropy The physical entropy
*/
__attribute__((always_inline)) INLINE static void hydro_set_physical_entropy(
struct part *p, struct xpart *xp, const struct cosmology *cosmo,
const float entropy) {
/* Note there is no conversion from physical to comoving entropy */
const float comoving_entropy = entropy;
xp->u_full = gas_internal_energy_from_entropy(p->rho, comoving_entropy);
}
/**
* @brief Computes the hydro time-step of a given particle
*
......
......@@ -34,6 +34,7 @@
#include "chemistry_struct.h"
#include "cooling_struct.h"
#include "star_formation_struct.h"
#include "tracers_struct.h"
/**
......@@ -63,9 +64,12 @@ struct xpart {
/*! Additional data used to record cooling information */
struct cooling_xpart_data cooling_data;
/* Additional data used by the tracers */
/*! Additional data used by the tracers */
struct tracers_xpart_data tracers_data;
/*! Additional data used by the star formation */
struct star_formation_xpart_data sf_data;
} SWIFT_STRUCT_ALIGN;
/**
......
......@@ -327,6 +327,21 @@ hydro_set_physical_internal_energy_dt(struct part *restrict p,
p->entropy_dt =
gas_entropy_from_internal_energy(p->rho_bar * cosmo->a3_inv, du_dt);
}
/**
* @brief Sets the physical entropy of a particle
*
* @param p The particle of interest.
* @param xp The extended particle data.
* @param cosmo Cosmology data structure
* @param entropy The physical entropy
*/
__attribute__((always_inline)) INLINE static void hydro_set_physical_entropy(
struct part *p, struct xpart *xp, const struct cosmology *cosmo,
const float entropy) {
/* Note there is no conversion from physical to comoving entropy */
xp->entropy_full = entropy;
}
/**
* @brief Computes the hydro time-step of a given particle
......
......@@ -32,6 +32,7 @@
#include "chemistry_struct.h"
#include "cooling_struct.h"
#include "star_formation_struct.h"
#include "tracers_struct.h"
/* Extra particle data not needed during the SPH loops over neighbours. */
......@@ -55,9 +56,12 @@ struct xpart {
/*! Additional data used to record cooling information */
struct cooling_xpart_data cooling_data;
/* Additional data used by the tracers */
/*! Additional data used by the tracers */
struct tracers_xpart_data tracers_data;
/*! Additional data used by the star formation */
struct star_formation_xpart_data sf_data;
} SWIFT_STRUCT_ALIGN;
/* Data of a single particle. */
......
Supports Markdown
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