/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2020 Loic Hausammann (loic.hausammann@epfl.ch)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
******************************************************************************/
#ifndef SWIFT_DEFAULT_SINK_H
#define SWIFT_DEFAULT_SINK_H
#include
/* Local includes */
#include "minmax.h"
#include "random.h"
#include "sink_part.h"
#include "sink_properties.h"
/**
* @brief Computes the time-step of a given sink particle.
*
* @param sp Pointer to the sink-particle data.
*/
__attribute__((always_inline)) INLINE static float sink_compute_timestep(
const struct sink* const sp) {
return FLT_MAX;
}
/**
* @brief Initialises the sink-particles for the first time
*
* This function is called only once just after the ICs have been
* read in to do some conversions.
*
* @param sp The particle to act upon
* @param sink_props The properties of the sink particles scheme.
*/
__attribute__((always_inline)) INLINE static void sink_first_init_sink(
struct sink* sp, const struct sink_props* sink_props) {}
/**
* @brief Prepares a particle for the sink calculation.
*
* @param p The particle to act upon
*/
__attribute__((always_inline)) INLINE static void sink_init_part(
struct part* restrict p) {}
/**
* @brief Prepares a sink-particle for its interactions
*
* @param sp The particle to act upon
*/
__attribute__((always_inline)) INLINE static void sink_init_sink(
struct sink* sp) {}
/**
* @brief Predict additional particle fields forward in time when drifting
*
* @param sp The particle
* @param dt_drift The drift time-step for positions.
*/
__attribute__((always_inline)) INLINE static void sink_predict_extra(
struct sink* restrict sp, float dt_drift) {}
/**
* @brief Sets the values to be predicted in the drifts to their values at a
* kick time
*
* @param sp The particle.
*/
__attribute__((always_inline)) INLINE static void sink_reset_predicted_values(
struct sink* restrict sp) {}
/**
* @brief Kick the additional variables
*
* @param sp The particle to act upon
* @param dt The time-step for this kick
*/
__attribute__((always_inline)) INLINE static void sink_kick_extra(
struct sink* sp, float dt) {}
/**
* @brief Calculate if the gas has the potential of becoming
* a sink.
*
* Return 0 if no sink formation should occur.
* Note: called in runner_do_sink_formation
*
* @param sink_props the sink properties to use.
* @param p the gas particles.
* @param xp the additional properties of the gas particles.
* @param phys_const the physical constants in internal units.
* @param cosmo the cosmological parameters and properties.
* @param hydro_props The properties of the hydro scheme.
* @param us The internal system of units.
* @param cooling The cooling data struct.
*
*/
INLINE static int sink_is_forming(
const struct part* restrict p, const struct xpart* restrict xp,
const struct sink_props* sink_props, const struct phys_const* phys_const,
const struct cosmology* cosmo,
const struct hydro_props* restrict hydro_props,
const struct unit_system* restrict us,
const struct cooling_function_data* restrict cooling,
const struct entropy_floor_properties* restrict entropy_floor) {
return 0;
}
/**
* @brief Decides whether a particle should be converted into a
* sink or not.
*
* No SF should occur, so return 0.
* Note: called in runner_do_sink_formation
*
* @param p The #part.
* @param xp The #xpart.
* @param sink_props The properties of the sink model.
* @param e The #engine (for random numbers).
* @param dt_sink The time-step of this particle
* @return 1 if a conversion should be done, 0 otherwise.
*/
INLINE static int sink_should_convert_to_sink(
const struct part* p, const struct xpart* xp,
const struct sink_props* sink_props, const struct engine* e,
const double dt_sink) {
return 0;
}
/**
* @brief Copies the properties of the gas particle over to the
* sink particle.
*
* Nothing to do here.
*
* @param e The #engine
* @param p the gas particles.
* @param xp the additional properties of the gas particles.
* @param sink the new created sink particle with its properties.
* @param sink_props the sink properties to use.
* @param phys_const the physical constants in internal units.
* @param cosmo the cosmological parameters and properties.
* @param with_cosmology if we run with cosmology.
*/
INLINE static void sink_copy_properties(
const struct part* p, const struct xpart* xp, struct sink* sink,
const struct engine* e, const struct sink_props* sink_props,
const struct cosmology* cosmo, const int with_cosmology,
const struct phys_const* phys_const,
const struct hydro_props* restrict hydro_props,
const struct unit_system* restrict us,
const struct cooling_function_data* restrict cooling) {}
/**
* @brief Update the properties of a sink particles by swallowing
* a gas particle.
*
* @param sp The #sink to update.
* @param p The #part that is swallowed.
* @param xp The #xpart that is swallowed.
* @param cosmo The current cosmological model.
*/
__attribute__((always_inline)) INLINE static void sink_swallow_part(
struct sink* sp, const struct part* p, const struct xpart* xp,
const struct cosmology* cosmo) {}
/**
* @brief Update the properties of a sink particles by swallowing
* a sink particle.
*
* @param spi The #sink to update.
* @param spj The #sink that is swallowed.
* @param cosmo The current cosmological model.
* @param time Time since the start of the simulation (non-cosmo mode).
* @param with_cosmology Are we running with cosmology?
* @param props The properties of the black hole scheme.
*/
__attribute__((always_inline)) INLINE static void sink_swallow_sink(
struct sink* spi, const struct sink* spj, const struct cosmology* cosmo) {}
/**
* @brief Should the sink spawn a star particle?
*
* Nothing to do here.
*
* @param e The #engine
* @param sink the sink particle.
* @param sink_props the sink properties to use.
* @param phys_const the physical constants in internal units.
* @param cosmo the cosmological parameters and properties.
* @param with_cosmology if we run with cosmology.
* @param us The internal unit system.
*/
INLINE static int sink_spawn_star(struct sink* sink, const struct engine* e,
const struct sink_props* sink_props,
const struct cosmology* cosmo,
const int with_cosmology,
const struct phys_const* phys_const,
const struct unit_system* restrict us) {
return 0;
}
/**
* @brief Copy the properties of the sink particle towards the new star.
* This function also needs to update the sink particle.
*
* Nothing to do here.
*
* @param e The #engine
* @param sink the sink particle.
* @param sp The star particle.
* @param sink_props the sink properties to use.
* @param phys_const the physical constants in internal units.
* @param cosmo the cosmological parameters and properties.
* @param with_cosmology if we run with cosmology.
* @param us The internal unit system.
*/
INLINE static void sink_copy_properties_to_star(
struct sink* sink, struct spart* sp, const struct engine* e,
const struct sink_props* sink_props, const struct cosmology* cosmo,
const int with_cosmology, const struct phys_const* phys_const,
const struct unit_system* restrict us) {}
#endif /* SWIFT_DEFAULT_SINK_H */