Commit 1123dd4e authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Updated the 'const_du' and 'none' cooling models to use the new function signatures.

parent 3b84d63f
......@@ -767,6 +767,7 @@ INPUT += @top_srcdir@/src/stars/Default
INPUT += @top_srcdir@/src/riemann
INPUT += @top_srcdir@/src/potential/point_mass
INPUT += @top_srcdir@/src/equation_of_state/ideal_gas
INPUT += @top_srcdir@/src/cooling/const_du
INPUT += @top_srcdir@/src/cooling/const_lambda
INPUT += @top_srcdir@/src/cooling/EAGLE
INPUT += @top_srcdir@/src/chemistry/EAGLE
......
......@@ -54,26 +54,30 @@
* @param phys_const The physical constants in internal units.
* @param us The internal system of units.
* @param cosmo The current cosmological model.
* @param hydro_props The properties of the hydro scheme.
* @param cooling The #cooling_function_data used in the run.
* @param p Pointer to the particle data.
* @param xp Pointer to the extended particle data.
* @param dt The time-step of this particle.
* @param dt_therm The time-step operator used for thermal quantities.
*/
__attribute__((always_inline)) INLINE static void cooling_cool_part(
const struct phys_const* restrict phys_const,
const struct unit_system* restrict us,
const struct cosmology* restrict cosmo,
const struct hydro_props* hydro_props,
const struct cooling_function_data* restrict cooling,
struct part* restrict p, struct xpart* restrict xp, float dt) {
struct part* restrict p, struct xpart* restrict xp, const float dt,
const float dt_therm) {
/* Internal energy floor */
const float u_floor = cooling->min_energy;
/* Get current internal energy */
const float u_old = hydro_get_physical_internal_energy(p, cosmo);
const float u_old = hydro_get_physical_internal_energy(p, xp, cosmo);
/* Current du_dt */
const float hydro_du_dt = hydro_get_internal_energy_dt(p);
const float hydro_du_dt = hydro_get_physical_internal_energy_dt(p, cosmo);
/* Get cooling function properties */
float cooling_du_dt = -cooling->cooling_rate;
......@@ -86,7 +90,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
}
/* Update the internal energy time derivative */
hydro_set_internal_energy_dt(p, hydro_du_dt + cooling_du_dt);
hydro_set_physical_internal_energy_dt(p, cosmo, hydro_du_dt + cooling_du_dt);
/* Store the radiated energy */
xp->cooling_data.radiated_energy += -hydro_get_mass(p) * cooling_du_dt * dt;
......@@ -103,16 +107,21 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
* @param phys_const The physical constants in internal units.
* @param cosmo The current cosmological model.
* @param us The internal system of units.
* @param hydro_props The properties of the hydro scheme.
* @param p Pointer to the particle data.
* @param xp Pointer to the extedended particle data.
*/
__attribute__((always_inline)) INLINE static float cooling_timestep(
const struct cooling_function_data* restrict cooling,
const struct phys_const* restrict phys_const,
const struct cosmology* restrict cosmo,
const struct unit_system* restrict us, const struct part* restrict p) {
const struct unit_system* restrict us,
const struct hydro_props* hydro_props, const struct part* restrict p,
const struct xpart* xp) {
const float cooling_rate = cooling->cooling_rate;
const float internal_energy = hydro_get_physical_internal_energy(p, cosmo);
const float internal_energy =
hydro_get_physical_internal_energy(p, xp, cosmo);
return cooling->cooling_tstep_mult * internal_energy / fabsf(cooling_rate);
}
......@@ -126,7 +135,10 @@ __attribute__((always_inline)) INLINE static float cooling_timestep(
*
* @param p Pointer to the particle data.
* @param xp Pointer to the extended particle data.
* @param phys_const The physical constants in internal units.
* @param cooling The properties of the cooling function.
* @param us The internal system of units.
* @param cosmo The current cosmological model.
*/
__attribute__((always_inline)) INLINE static void cooling_first_init_part(
const struct phys_const* restrict phys_const,
......
......@@ -31,19 +31,20 @@
/**
* @brief Writes the current model of SPH to the file
* @param h_grpsph The HDF5 group in which to write
* @param h_grp The HDF5 group in which to write
* @param cooling the parameters of the cooling function.
*/
__attribute__((always_inline)) INLINE static void cooling_write_flavour(
hid_t h_grpsph) {
hid_t h_grp, const struct cooling_function_data* cooling) {
io_write_attribute_s(h_grpsph, "Cooling Model", "Constant du/dt");
io_write_attribute_s(h_grp, "Cooling Model", "Constant du/dt");
}
#endif
/**
* @brief Specifies which particle fields to write to a dataset
*
* @param parts The particle array.
* @param xparts The exended particle data array.
* @param list The list of i/o properties to write.
* @param cooling The #cooling_function_data
*
......
......@@ -146,7 +146,6 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
*
* @param cooling The #cooling_function_data used in the run.
* @param phys_const The physical constants in internal units.
* @param us The internal system of units.
* @param cosmo The current cosmological model.
* @param hydro_props The properties of the hydro scheme.
* @param us The internal system of units.
......
......@@ -44,17 +44,21 @@
* @param phys_const The physical constants in internal units.
* @param us The internal system of units.
* @param cosmo The current cosmological model.
* @param hydro_props The properties of the hydro scheme.
* @param cooling The #cooling_function_data used in the run.
* @param p Pointer to the particle data.
* @param xp Pointer to the extended particle data.
* @param dt The time-step of this particle.
* @param dt_therm The time-step operator used for thermal quantities.
*/
__attribute__((always_inline)) INLINE static void cooling_cool_part(
const struct phys_const* restrict phys_const,
const struct unit_system* restrict us,
const struct cosmology* restrict cosmo,
const struct hydro_props* hydro_props,
const struct cooling_function_data* restrict cooling,
struct part* restrict p, struct xpart* restrict xp, float dt) {}
struct part* restrict p, struct xpart* restrict xp, const float dt,
const float dt_therm) {}
/**
* @brief Computes the cooling time-step.
......@@ -64,14 +68,18 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
* @param cooling The #cooling_function_data used in the run.
* @param phys_const The physical constants in internal units.
* @param cosmo The current cosmological model.
* @param hydro_props The properties of the hydro scheme.
* @param us The internal system of units.
* @param p Pointer to the particle data.
* @param xp Pointer to the extended data of the particle.
*/
__attribute__((always_inline)) INLINE static float cooling_timestep(
const struct cooling_function_data* restrict cooling,
const struct phys_const* restrict phys_const,
const struct cosmology* restrict cosmo,
const struct unit_system* restrict us, const struct part* restrict p) {
const struct unit_system* restrict us,
const struct hydro_props* hydro_props, const struct part* restrict p,
const struct xpart* restrict xp) {
return FLT_MAX;
}
......
......@@ -29,12 +29,13 @@
/**
* @brief Writes the current model of SPH to the file
* @param h_grpsph The HDF5 group in which to write
* @param h_grp The HDF5 group in which to write
* @param cooling the parameters of the cooling function.
*/
__attribute__((always_inline)) INLINE static void cooling_write_flavour(
hid_t h_grpsph) {
hid_t h_grp, const struct cooling_function_data* cooling) {
io_write_attribute_s(h_grpsph, "Cooling Model", "None");
io_write_attribute_s(h_grp, "Cooling Model", "None");
}
#endif
......
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