diff --git a/src/Makefile.am b/src/Makefile.am index 689e28dcf73d486ca675c662dda41b9197146a01..5ecfac826c10568a0e98c7f4feaced9e9152aaa1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -235,7 +235,7 @@ nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h black_holes/Default/black_holes_struct.h \ black_holes/EAGLE/black_holes.h black_holes/EAGLE/black_holes_io.h \ black_holes/EAGLE/black_holes_part.h black_holes/EAGLE/black_holes_iact.h \ - black_holes/EAGLE/black_holes_properties.h \ + black_holes/EAGLE/black_holes_properties.h black_holes/EAGLE/black_holes_parameters.h \ black_holes/EAGLE/black_holes_struct.h \ pressure_floor/GEAR/pressure_floor.h pressure_floor/none/pressure_floor.h \ pressure_floor/GEAR/pressure_floor_iact.h pressure_floor/none/pressure_floor_iact.h \ diff --git a/src/black_holes/EAGLE/black_holes_iact.h b/src/black_holes/EAGLE/black_holes_iact.h index bc56134b022acf9d7b6464ec70628cea27bbab2d..2bfb38c877db577d88a6e79ca2614b943f76a916 100644 --- a/src/black_holes/EAGLE/black_holes_iact.h +++ b/src/black_holes/EAGLE/black_holes_iact.h @@ -20,6 +20,7 @@ #define SWIFT_EAGLE_BH_IACT_H /* Local includes */ +#include "black_holes_parameters.h" #include "gravity.h" #include "hydro.h" #include "random.h" @@ -146,11 +147,13 @@ runner_iact_nonsym_bh_gas_swallow(const float r2, const float *dx, /* Start by checking the repositioning criteria */ - /* Note the factor 9 is taken from EAGLE. Will be turned into a parameter */ + /* (Square of) Max repositioning distance allowed based on the softening */ const float max_dist_repos2 = kernel_gravity_softening_plummer_equivalent_inv * - kernel_gravity_softening_plummer_equivalent_inv * 9.f * - grav_props->epsilon_baryon_cur * grav_props->epsilon_baryon_cur; + kernel_gravity_softening_plummer_equivalent_inv * + const_max_repositioning_distance_ratio * + const_max_repositioning_distance_ratio * grav_props->epsilon_baryon_cur * + grav_props->epsilon_baryon_cur; /* This gas neighbour is close enough that we can consider it's potential for repositioning */ @@ -250,11 +253,13 @@ runner_iact_nonsym_bh_bh_swallow(const float r2, const float *dx, const float v2_pec = v2 * cosmo->a2_inv; - /* Note the factor 9 is taken from EAGLE. Will be turned into a parameter */ + /* (Square of) Max repositioning distance allowed based on the softening */ const float max_dist_repos2 = kernel_gravity_softening_plummer_equivalent_inv * - kernel_gravity_softening_plummer_equivalent_inv * 9.f * - grav_props->epsilon_baryon_cur * grav_props->epsilon_baryon_cur; + kernel_gravity_softening_plummer_equivalent_inv * + const_max_repositioning_distance_ratio * + const_max_repositioning_distance_ratio * grav_props->epsilon_baryon_cur * + grav_props->epsilon_baryon_cur; /* This gas neighbour is close enough that we can consider it's potential for repositioning */ @@ -285,10 +290,11 @@ runner_iact_nonsym_bh_bh_swallow(const float r2, const float *dx, h = hj; } - /* Note the factor 9 is taken from EAGLE. Will be turned into a parameter */ + /* (Square of) Max swallowing distance allowed based on the softening */ const float max_dist_merge2 = kernel_gravity_softening_plummer_equivalent_inv * - kernel_gravity_softening_plummer_equivalent_inv * 9.f * + kernel_gravity_softening_plummer_equivalent_inv * + const_max_merging_distance_ratio * const_max_merging_distance_ratio * grav_props->epsilon_baryon_cur * grav_props->epsilon_baryon_cur; const float G_Newton = grav_props->G_Newton; diff --git a/src/black_holes/EAGLE/black_holes_parameters.h b/src/black_holes/EAGLE/black_holes_parameters.h new file mode 100644 index 0000000000000000000000000000000000000000..cb6438bc85b4f113e5f1b1f6122ebf9fcc7088c6 --- /dev/null +++ b/src/black_holes/EAGLE/black_holes_parameters.h @@ -0,0 +1,39 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Coypright (c) 2019 Matthieu Schaller (schaller@strw.leidenuniv.nl) + * + * 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_EAGLE_BLACK_HOLES_PARAMETERS_H +#define SWIFT_EAGLE_BLACK_HOLES_PARAMETERS_H + +/* Configuration file */ +#include "config.h" + +/** + * @file EAGLE/black_holes_parameters.h + * @brief Parameters of the EAGLE black holes + * model that need to be defined at compile time. + */ + +/*! Maximal distance for merging particles in units of the (spline not Plummer) + * softening length. */ +#define const_max_merging_distance_ratio 3.f + +/*! Maximal distance for repositioning particles in units of the (spline not + * Plummer) softening length. */ +#define const_max_repositioning_distance_ratio 3.f + +#endif /* SWIFT_EAGLE_BLACK_HOLES_PARAMETERS_H */