diff --git a/examples/SubgridTests/BlackHoleSwallowing/makeIC.py b/examples/SubgridTests/BlackHoleSwallowing/makeIC.py index 5490924003ad3b86b042cc3b62c12f97ec60f8d4..3f2f734f6d45cd6d1f62433fdb8ce88886d4319f 100644 --- a/examples/SubgridTests/BlackHoleSwallowing/makeIC.py +++ b/examples/SubgridTests/BlackHoleSwallowing/makeIC.py @@ -21,8 +21,8 @@ import h5py from numpy import * # Some constants -solar_mass_cgs = 1.988480e33 -kpc_in_cm = 3.085678e21 +solar_mass_cgs = 1.988410e33 +kpc_in_cm = 3.08567758149e21 mp_cgs = 1.67e-24 boltzmann_k_cgs = 1.38e-16 @@ -34,8 +34,8 @@ P_cgs = rho_cgs*u0_cgs*(gamma - 1.) # Background pressure fileName = "bh_swallowing.hdf5" # Units -unit_l_cgs = 3.085678e24 # kpc -unit_m_cgs = 1.988480e43 # 10^10 Msun +unit_l_cgs = 3.08567758149e24 # kpc +unit_m_cgs = 1.988410e43 # 10^10 Msun unit_v_cgs = 1e5 # km / s unit_A_cgs = 1. unit_T_cgs = 1. diff --git a/examples/SubgridTests/BlackHoleSwallowing/swallowing.yml b/examples/SubgridTests/BlackHoleSwallowing/swallowing.yml index 2390918132e73de031b3795d17d9a2cbe9863680..6db2b83d55832f1ecc58551be3ca3f763a711c29 100644 --- a/examples/SubgridTests/BlackHoleSwallowing/swallowing.yml +++ b/examples/SubgridTests/BlackHoleSwallowing/swallowing.yml @@ -1,7 +1,7 @@ # Define the system of units to use internally. InternalUnitSystem: - UnitMass_in_cgs: 1.98848e43 # 10^10 M_sun in grams - UnitLength_in_cgs: 3.08567758e24 # Mpc in centimeters + UnitMass_in_cgs: 1.98841e43 # 10^10 M_sun in grams + UnitLength_in_cgs: 3.08567758149e24 # Mpc in centimeters UnitVelocity_in_cgs: 1e5 # km/s in centimeters per second UnitCurrent_in_cgs: 1. # Amperes UnitTemp_in_cgs: 1. # Kelvin @@ -34,6 +34,17 @@ Statistics: time_first: 0. delta_time: 1.e-5 # non cosmology time between statistics output +# Parameters for the self-gravity scheme +Gravity: + eta: 0.025 # Constant dimensionless multiplier for time integration. + theta: 0.7 # Opening angle (Multipole acceptance criterion) + mesh_side_length: 128 + comoving_DM_softening: 0.003320 # Comoving softening for DM (3.32 ckpc) + max_physical_DM_softening: 0.001300 # Physical softening for DM (1.30 pkpc) + comoving_baryon_softening: 0.001790 # Comoving softening for baryons (1.79 ckpc) + max_physical_baryon_softening: 0.000700 # Physical softening for baryons (0.70 pkpc) + dithering: 0 + # Parameters for the hydrodynamics scheme SPH: resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation @@ -47,7 +58,6 @@ InitialConditions: Scheduler: max_top_level_cells: 8 - tasks_per_cell: 500 # Parameters for the EAGLE "equation of state" EAGLEEntropyFloor: diff --git a/src/runner_black_holes.c b/src/runner_black_holes.c index 32301896f737f9cc3ce4600c58bfd8f506f7757f..593fee6c2e90637dc5e334aa0179853582fb11e9 100644 --- a/src/runner_black_holes.c +++ b/src/runner_black_holes.c @@ -347,23 +347,20 @@ void runner_do_bh_swallow(struct runner *r, struct cell *c, int timer) { if (bp->id == BH_id) { - /* Lock the space as we are going to work directly on the bpart list - */ - lock_lock(&s->lock); + /* Is the swallowing BH itself flagged for swallowing by + another BH? */ + if (black_holes_get_bpart_swallow_id(&bp->merger_data) != -1) { - /* If bpart is inhibited, it cannot do any swallowing */ - if (bpart_is_inhibited(bp, e)) { - message("BH %lld inhibited -- DOES NOT swallow BH %lld", bp->id, - cell_bp->id); - - /* Pretend it was found */ + /* Pretend it was found and abort */ + black_holes_mark_bpart_as_not_swallowed(&cell_bp->merger_data); found = 1; - - if (lock_unlock(&s->lock) != 0) - error("Failed to unlock the space."); break; } + /* Lock the space as we are going to work directly on the + * space's bpart list */ + lock_lock(&s->lock); + /* Swallow the BH particle (i.e. update the swallowing BH * properties with the properties of cell_bp) */ black_holes_swallow_bpart(bp, cell_bp, e->cosmology, e->time, @@ -410,6 +407,16 @@ void runner_do_bh_swallow(struct runner *r, struct cell *c, int timer) { if (bp->id == BH_id) { + /* Is the swallowing BH itself flagged for swallowing by + another BH? */ + if (black_holes_get_bpart_swallow_id(&bp->merger_data) != -1) { + + /* Pretend it was found and abort */ + black_holes_mark_bpart_as_not_swallowed(&cell_bp->merger_data); + found = 1; + break; + } + message("BH %lld removing BH particle %lld (foreign BH case)", bp->id, cell_bp->id);