diff --git a/src/Makefile.am b/src/Makefile.am index e00acf87999414616f1d07fb9eb0456e8f008bb6..8984b85dd740ddf9d5bf1bb1e4d1c99180be9bbf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -98,8 +98,8 @@ nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h runner_doiact_functions_hydro.h runner_doiact_functions_stars.h runner_doiact_functions_black_holes.h \ runner_doiact_functions_limiter.h runner_doiact_limiter.h units.h intrinsics.h minmax.h \ kick.h timestep.h drift.h adiabatic_index.h io_properties.h dimension.h part_type.h periodic.h memswap.h \ - dump.h logger.h sign.h logger_io.h timestep_limiter.h timestep_sync.h timestep_sync_part.h hashmap.h \ - gravity.h gravity_io.h gravity_cache.h \ + dump.h logger.h sign.h logger_io.h timestep_limiter.h timestep_limiter_iact.h timestep_sync.h timestep_sync_part.h \ + hashmap.h gravity.h gravity_io.h gravity_cache.h \ gravity/Default/gravity.h gravity/Default/gravity_iact.h gravity/Default/gravity_io.h \ gravity/Default/gravity_debug.h gravity/Default/gravity_part.h \ gravity/Potential/gravity.h gravity/Potential/gravity_iact.h gravity/Potential/gravity_io.h \ diff --git a/src/hydro/AnarchyDU/hydro_iact.h b/src/hydro/AnarchyDU/hydro_iact.h index 17618830d438ec73e0f3eb2a6053df34d285da68..215c88982b6824c1be3912e2ad67e5b67b0b6197 100644 --- a/src/hydro/AnarchyDU/hydro_iact.h +++ b/src/hydro/AnarchyDU/hydro_iact.h @@ -570,49 +570,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( pi->min_ngb_time_bin = min(pi->min_ngb_time_bin, pj->time_bin); } -/** - * @brief Timestep limiter loop - * - * @param r2 Comoving square distance between the two particles. - * @param dx Comoving vector separating both particles (pi - pj). - * @param hi Comoving smoothing-length of part*icle i. - * @param hj Comoving smoothing-length of part*icle j. - * @param pi First part*icle. - * @param pj Second part*icle (not updated). - * @param a Current scale factor. - * @param H Current Hubble parameter. - * - */ -__attribute__((always_inline)) INLINE static void runner_iact_limiter( - float r2, const float* dx, float hi, float hj, struct part* restrict pi, - struct part* restrict pj, float a, float H) { - - /* Nothing to do here if both particles are active */ -} - -/** - * @brief Timestep limiter loop (non-symmetric version) - * - * @param r2 Comoving square distance between the two particles. - * @param dx Comoving vector separating both particles (pi - pj). - * @param hi Comoving smoothing-length of part*icle i. - * @param hj Comoving smoothing-length of part*icle j. - * @param pi First part*icle. - * @param pj Second part*icle (not updated). - * @param a Current scale factor. - * @param H Current Hubble parameter. - * - */ -__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter( - float r2, const float* dx, float hi, float hj, struct part* restrict pi, - struct part* restrict pj, float a, float H) { - - /* Wake up the neighbour? */ - if (pj->time_bin > pi->time_bin + 2) { - - /* Store the smallest time bin that woke up this particle */ - pj->wakeup = max(pj->wakeup, -pi->time_bin); - } -} - #endif /* SWIFT_ANARCHY_DU_HYDRO_IACT_H */ diff --git a/src/hydro/AnarchyPU/hydro_iact.h b/src/hydro/AnarchyPU/hydro_iact.h index bb53221908d71535d090e8d2581e466fcf1009f9..9abd09a5f68c9762fec3b57b6d61e3cdd045d6c3 100644 --- a/src/hydro/AnarchyPU/hydro_iact.h +++ b/src/hydro/AnarchyPU/hydro_iact.h @@ -554,49 +554,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( pi->force.h_dt -= mj * dvdr * r_inv / rhoj * wi_dr; } -/** - * @brief Timestep limiter loop - * - * @param r2 Comoving square distance between the two particles. - * @param dx Comoving vector separating both particles (pi - pj). - * @param hi Comoving smoothing-length of part*icle i. - * @param hj Comoving smoothing-length of part*icle j. - * @param pi First part*icle. - * @param pj Second part*icle (not updated). - * @param a Current scale factor. - * @param H Current Hubble parameter. - * - */ -__attribute__((always_inline)) INLINE static void runner_iact_limiter( - float r2, const float* dx, float hi, float hj, struct part* restrict pi, - struct part* restrict pj, float a, float H) { - - /* Nothing to do here if both particles are active */ -} - -/** - * @brief Timestep limiter loop (non-symmetric version) - * - * @param r2 Comoving square distance between the two particles. - * @param dx Comoving vector separating both particles (pi - pj). - * @param hi Comoving smoothing-length of part*icle i. - * @param hj Comoving smoothing-length of part*icle j. - * @param pi First part*icle. - * @param pj Second part*icle (not updated). - * @param a Current scale factor. - * @param H Current Hubble parameter. - * - */ -__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter( - float r2, const float* dx, float hi, float hj, struct part* restrict pi, - struct part* restrict pj, float a, float H) { - - /* Wake up the neighbour? */ - if (pi->viscosity.v_sig > - const_limiter_max_v_sig_ratio * pj->viscosity.v_sig) { - - pj->wakeup = time_bin_awake; - } -} - #endif /* SWIFT_ANARCHY_PU_HYDRO_IACT_H */ diff --git a/src/hydro/Default/hydro_iact.h b/src/hydro/Default/hydro_iact.h index 07c8f0edc3885376be828480492de10b35d857e3..eb6612fe48e8a4990404a47cd4ec6398fbf6f252 100644 --- a/src/hydro/Default/hydro_iact.h +++ b/src/hydro/Default/hydro_iact.h @@ -517,49 +517,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( pi->force.h_dt -= mj * dvdr * pi->force.f * r_inv / rhoj * wi_dr; } -/** - * @brief Timestep limiter loop - * - * @param r2 Comoving square distance between the two particles. - * @param dx Comoving vector separating both particles (pi - pj). - * @param hi Comoving smoothing-length of part*icle i. - * @param hj Comoving smoothing-length of part*icle j. - * @param pi First part*icle. - * @param pj Second part*icle (not updated). - * @param a Current scale factor. - * @param H Current Hubble parameter. - * - */ -__attribute__((always_inline)) INLINE static void runner_iact_limiter( - float r2, const float* dx, float hi, float hj, struct part* restrict pi, - struct part* restrict pj, float a, float H) { - - /* Nothing to do here if both particles are active */ -} - -/** - * @brief Timestep limiter loop (non-symmetric version) - * - * @param r2 Comoving square distance between the two particles. - * @param dx Comoving vector separating both particles (pi - pj). - * @param hi Comoving smoothing-length of part*icle i. - * @param hj Comoving smoothing-length of part*icle j. - * @param pi First part*icle. - * @param pj Second part*icle (not updated). - * @param a Current scale factor. - * @param H Current Hubble parameter. - * - */ -__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter( - float r2, const float* dx, float hi, float hj, struct part* restrict pi, - struct part* restrict pj, float a, float H) { - - /* Wake up the neighbour? */ - if (pi->viscosity.v_sig > - const_limiter_max_v_sig_ratio * pj->viscosity.v_sig) { - - pj->wakeup = time_bin_awake; - } -} - #endif /* SWIFT_DEFAULT_HYDRO_IACT_H */ diff --git a/src/hydro/Gadget2/hydro_iact.h b/src/hydro/Gadget2/hydro_iact.h index 118a29d771facbafbb15ecef90d3d3c726e1b92c..27e8e8d8a2717a818c823bfa306e184d42c4a0ca 100644 --- a/src/hydro/Gadget2/hydro_iact.h +++ b/src/hydro/Gadget2/hydro_iact.h @@ -1052,37 +1052,4 @@ runner_iact_nonsym_2_vec_force( #endif -/** - * @brief Timestep limiter loop - */ -__attribute__((always_inline)) INLINE static void runner_iact_limiter( - float r2, const float *dx, float hi, float hj, struct part *restrict pi, - struct part *restrict pj, float a, float H) { - - /* Nothing to do here if both particles are active */ -} - -/** - * @brief Timestep limiter loop (non-symmetric version) - */ -__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter( - float r2, const float *dx, float hi, float hj, struct part *restrict pi, - struct part *restrict pj, float a, float H) { - - /* Wake up the neighbour? */ - if (pi->force.v_sig > const_limiter_max_v_sig_ratio * pj->force.v_sig) { - - // ALEXEI seems to crash with this option when running with debug checks - // on comparing ti_kick to ti_start in kick_part. Use code below instead - // (commented MATTHIEU) - // pj->wakeup = time_bin_awake; - - // MATTHIEU - if (pj->wakeup == time_bin_not_awake) - pj->wakeup = time_bin_awake; - else if (pj->wakeup > 0) - pj->wakeup = -pj->wakeup; - } -} - #endif /* SWIFT_GADGET2_HYDRO_IACT_H */ diff --git a/src/hydro/GizmoMFM/hydro_iact.h b/src/hydro/GizmoMFM/hydro_iact.h index 08e3de538a5e2cd775a69abab9bcb11fb09e7a9b..e8b8efaeb71553cfdb776ee0510de9c25ef70bb7 100644 --- a/src/hydro/GizmoMFM/hydro_iact.h +++ b/src/hydro/GizmoMFM/hydro_iact.h @@ -488,29 +488,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( runner_iact_fluxes_common(r2, dx, hi, hj, pi, pj, 0, a, H); } -/** - * @brief Timestep limiter loop - */ -__attribute__((always_inline)) INLINE static void runner_iact_limiter( - float r2, const float *dx, float hi, float hj, struct part *restrict pi, - struct part *restrict pj, float a, float H) { - - /* Nothing to do here if both particles are active */ -} - -/** - * @brief Timestep limiter loop (non-symmetric version) - */ -__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter( - float r2, const float *dx, float hi, float hj, struct part *restrict pi, - struct part *restrict pj, float a, float H) { - - /* Wake up the neighbour? */ - if (pi->timestepvars.vmax > - const_limiter_max_v_sig_ratio * pj->timestepvars.vmax) { - - pj->wakeup = time_bin_awake; - } -} - #endif /* SWIFT_GIZMO_MFM_HYDRO_IACT_H */ diff --git a/src/hydro/GizmoMFV/hydro_iact.h b/src/hydro/GizmoMFV/hydro_iact.h index 2ac5474f0e767879656129f486fb276608d13622..1b8aac4ff89e4945a314ff72c44bff8dbfe1502c 100644 --- a/src/hydro/GizmoMFV/hydro_iact.h +++ b/src/hydro/GizmoMFV/hydro_iact.h @@ -503,29 +503,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( runner_iact_fluxes_common(r2, dx, hi, hj, pi, pj, 0, a, H); } -/** - * @brief Timestep limiter loop - */ -__attribute__((always_inline)) INLINE static void runner_iact_limiter( - float r2, const float *dx, float hi, float hj, struct part *restrict pi, - struct part *restrict pj, float a, float H) { - - /* Nothing to do here if both particles are active */ -} - -/** - * @brief Timestep limiter loop (non-symmetric version) - */ -__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter( - float r2, const float *dx, float hi, float hj, struct part *restrict pi, - struct part *restrict pj, float a, float H) { - - /* Wake up the neighbour? */ - if (pi->timestepvars.vmax > - const_limiter_max_v_sig_ratio * pj->timestepvars.vmax) { - - pj->wakeup = time_bin_awake; - } -} - #endif /* SWIFT_GIZMO_MFV_HYDRO_IACT_H */ diff --git a/src/hydro/Minimal/hydro_iact.h b/src/hydro/Minimal/hydro_iact.h index 78d3301a16a0439371944b9189acbd88c9b4c653..ca896b8b303e57e8beb7f5a74eae85d6f5b8e870 100644 --- a/src/hydro/Minimal/hydro_iact.h +++ b/src/hydro/Minimal/hydro_iact.h @@ -436,31 +436,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( pi->min_ngb_time_bin = min(pi->min_ngb_time_bin, pj->time_bin); } -/** - * @brief Timestep limiter loop - */ -__attribute__((always_inline)) INLINE static void runner_iact_limiter( - float r2, const float *dx, float hi, float hj, struct part *restrict pi, - struct part *restrict pj, float a, float H) { - - /* Nothing to do here if both particles are active */ -} - -/** - * @brief Timestep limiter loop (non-symmetric version) - */ -__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter( - float r2, const float *dx, float hi, float hj, struct part *restrict pi, - struct part *restrict pj, float a, float H) { - - /* Wake up the neighbour? */ - if (pj->time_bin > pi->time_bin + 2) { - - // message("aa"); - - /* Store the smallest time bin that woke up this particle */ - pj->wakeup = max(pj->wakeup, -pi->time_bin); - } -} - #endif /* SWIFT_MINIMAL_HYDRO_IACT_H */ diff --git a/src/hydro/Planetary/hydro_iact.h b/src/hydro/Planetary/hydro_iact.h index 3a8d1f4e88fa9df0a1dcea500baf56e46bae7cd1..15340d302d55bbdbe37fc28d72b1e7f37b1269bf 100644 --- a/src/hydro/Planetary/hydro_iact.h +++ b/src/hydro/Planetary/hydro_iact.h @@ -348,28 +348,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( pi->force.v_sig = max(pi->force.v_sig, v_sig); } -/** - * @brief Timestep limiter loop - */ -__attribute__((always_inline)) INLINE static void runner_iact_limiter( - float r2, const float *dx, float hi, float hj, struct part *restrict pi, - struct part *restrict pj, float a, float H) { - - /* Nothing to do here if both particles are active */ -} - -/** - * @brief Timestep limiter loop (non-symmetric version) - */ -__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter( - float r2, const float *dx, float hi, float hj, struct part *restrict pi, - struct part *restrict pj, float a, float H) { - - /* Wake up the neighbour? */ - if (pi->force.v_sig > const_limiter_max_v_sig_ratio * pj->force.v_sig) { - - pj->wakeup = time_bin_awake; - } -} - #endif /* SWIFT_PLANETARY_HYDRO_IACT_H */ diff --git a/src/hydro/PressureEnergy/hydro_iact.h b/src/hydro/PressureEnergy/hydro_iact.h index f0bd99152202f613cefc2efe7dcb713fbffac509..f40253a08170e9af7c4b0be708c0c605ead469cf 100644 --- a/src/hydro/PressureEnergy/hydro_iact.h +++ b/src/hydro/PressureEnergy/hydro_iact.h @@ -437,28 +437,5 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( /* Update the signal velocity. */ pi->force.v_sig = max(pi->force.v_sig, v_sig); } -/** - * @brief Timestep limiter loop - */ -__attribute__((always_inline)) INLINE static void runner_iact_limiter( - float r2, const float* dx, float hi, float hj, struct part* restrict pi, - struct part* restrict pj, float a, float H) { - - /* Nothing to do here if both particles are active */ -} - -/** - * @brief Timestep limiter loop (non-symmetric version) - */ -__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter( - float r2, const float* dx, float hi, float hj, struct part* restrict pi, - struct part* restrict pj, float a, float H) { - - /* Wake up the neighbour? */ - if (pi->force.v_sig > const_limiter_max_v_sig_ratio * pj->force.v_sig) { - - pj->wakeup = time_bin_awake; - } -} #endif /* SWIFT_PRESSURE_ENERGY_HYDRO_IACT_H */ diff --git a/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_iact.h b/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_iact.h index 3e0fec0459e7ac17b90d49007c7b38a18f4d8dbc..6ed6dd2c36dd81a69ef1116a3f101c80b2c90f1e 100644 --- a/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_iact.h +++ b/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_iact.h @@ -426,28 +426,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( pi->force.v_sig = max(pi->force.v_sig, v_sig); } -/** - * @brief Timestep limiter loop - */ -__attribute__((always_inline)) INLINE static void runner_iact_limiter( - float r2, const float* dx, float hi, float hj, struct part* restrict pi, - struct part* restrict pj, float a, float H) { - - /* Nothing to do here if both particles are active */ -} - -/** - * @brief Timestep limiter loop (non-symmetric version) - */ -__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter( - float r2, const float* dx, float hi, float hj, struct part* restrict pi, - struct part* restrict pj, float a, float H) { - - /* Wake up the neighbour? */ - if (pi->force.v_sig > const_limiter_max_v_sig_ratio * pj->force.v_sig) { - - pj->wakeup = time_bin_awake; - } -} - #endif /* SWIFT_PRESSURE_ENERGY_MORRIS_HYDRO_IACT_H */ diff --git a/src/hydro/PressureEntropy/hydro_iact.h b/src/hydro/PressureEntropy/hydro_iact.h index d5045d77f2850408b33a70e9b9d6d880577bea0f..194932f65e14a649b0c64d1f72e93c540521e717 100644 --- a/src/hydro/PressureEntropy/hydro_iact.h +++ b/src/hydro/PressureEntropy/hydro_iact.h @@ -404,28 +404,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( pi->entropy_dt += mj * visc_term * r_inv * dvdr; } -/** - * @brief Timestep limiter loop - */ -__attribute__((always_inline)) INLINE static void runner_iact_limiter( - float r2, const float *dx, float hi, float hj, struct part *restrict pi, - struct part *restrict pj, float a, float H) { - - /* Nothing to do here if both particles are active */ -} - -/** - * @brief Timestep limiter loop (non-symmetric version) - */ -__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter( - float r2, const float *dx, float hi, float hj, struct part *restrict pi, - struct part *restrict pj, float a, float H) { - - /* Wake up the neighbour? */ - if (pi->force.v_sig > const_limiter_max_v_sig_ratio * pj->force.v_sig) { - - pj->wakeup = time_bin_awake; - } -} - #endif /* SWIFT_PRESSURE_ENTROPY_HYDRO_IACT_H */ diff --git a/src/hydro/Shadowswift/hydro_iact.h b/src/hydro/Shadowswift/hydro_iact.h index 791e4c7924df9806fa9150d03c08a543771a7049..eda8e3759d9e08dac8073ebed9fb36dd0c5b99f6 100644 --- a/src/hydro/Shadowswift/hydro_iact.h +++ b/src/hydro/Shadowswift/hydro_iact.h @@ -342,28 +342,3 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( runner_iact_fluxes_common(r2, dx, hi, hj, pi, pj, 0, a, H); } - -/** - * @brief Timestep limiter loop - */ -__attribute__((always_inline)) INLINE static void runner_iact_limiter( - float r2, const float *dx, float hi, float hj, struct part *restrict pi, - struct part *restrict pj, float a, float H) { - - /* Nothing to do here if both particles are active */ -} - -/** - * @brief Timestep limiter loop (non-symmetric version) - */ -__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter( - float r2, const float *dx, float hi, float hj, struct part *restrict pi, - struct part *restrict pj, float a, float H) { - - /* Wake up the neighbour? */ - if (pi->timestepvars.vmax > - const_limiter_max_v_sig_ratio * pj->timestepvars.vmax) { - - pj->wakeup = time_bin_awake; - } -} diff --git a/src/runner_doiact_limiter.c b/src/runner_doiact_limiter.c index 7387cc1e898cab508648779c43e90aee6325169c..ac65ca063cffd89e26673b0a8d4df6fbfa263e56 100644 --- a/src/runner_doiact_limiter.c +++ b/src/runner_doiact_limiter.c @@ -26,10 +26,10 @@ #include "active.h" #include "cell.h" #include "engine.h" -#include "hydro.h" #include "runner.h" #include "space_getsid.h" #include "timers.h" +#include "timestep_limiter_iact.h" /* Import the limiter loop functions. */ #define FUNCTION limiter diff --git a/src/timestep_limiter_iact.h b/src/timestep_limiter_iact.h new file mode 100644 index 0000000000000000000000000000000000000000..ba515260edd3f498e1bfd358da3ddc62b75e9768 --- /dev/null +++ b/src/timestep_limiter_iact.h @@ -0,0 +1,47 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2018 Matthieu Schaller (matthieu.schaller@durham.ac.uk) + * + * 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 <http://www.gnu.org/licenses/>. + * + ******************************************************************************/ +#ifndef SWIFT_TIMESTEP_LIMITER_IACT_H +#define SWIFT_TIMESTEP_LIMITER_IACT_H + +/** + * @brief Timestep limiter loop + */ +__attribute__((always_inline)) INLINE static void runner_iact_limiter( + float r2, const float *dx, float hi, float hj, struct part *restrict pi, + struct part *restrict pj, float a, float H) { + + /* Nothing to do here if both particles are active */ +} + +/** + * @brief Timestep limiter loop (non-symmetric version) + */ +__attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter( + float r2, const float *dx, float hi, float hj, struct part *restrict pi, + struct part *restrict pj, float a, float H) { + + /* Wake up the neighbour? */ + if (pj->time_bin > pi->time_bin + 2) { + + /* Store the smallest time bin that woke up this particle */ + pj->wakeup = max(pj->wakeup, -pi->time_bin); + } +} + +#endif /* SWIFT_TIMESTEP_LIMITER_IACT_H */