Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
83b3429f
Commit
83b3429f
authored
Dec 08, 2019
by
Matthieu Schaller
Browse files
Store the last redshift at which a BH has had its last minor or major merger.
parent
66559894
Changes
14
Hide whitespace changes
Inline
Side-by-side
examples/EAGLE_ICs/EAGLE_12/eagle_12.yml
View file @
83b3429f
...
...
@@ -182,4 +182,6 @@ EAGLEAGN:
coupling_efficiency
:
0.15
# Fraction of the radiated energy that couples to the gas in feedback events.
AGN_delta_T_K
:
3.16228e8
# Change in temperature to apply to the gas particle in an AGN feedback event in Kelvin.
AGN_num_ngb_to_heat
:
1.
# Target number of gas neighbours to heat in an AGN feedback event.
max_reposition_mass
:
2e8
# Maximal BH mass considered for BH repositioning in solar masses.
\ No newline at end of file
max_reposition_mass
:
2e8
# Maximal BH mass considered for BH repositioning in solar masses.
threshold_major_merger
:
0.333
# Mass ratio threshold to consider a BH merger as 'major'
threshold_minor_merger
:
0.1
# Mass ratio threshold to consider a BH merger as 'minor'
examples/EAGLE_ICs/EAGLE_25/eagle_25.yml
View file @
83b3429f
...
...
@@ -183,4 +183,6 @@ EAGLEAGN:
coupling_efficiency
:
0.15
# Fraction of the radiated energy that couples to the gas in feedback events.
AGN_delta_T_K
:
3.16228e8
# Change in temperature to apply to the gas particle in an AGN feedback event in Kelvin.
AGN_num_ngb_to_heat
:
1.
# Target number of gas neighbours to heat in an AGN feedback event.
max_reposition_mass
:
2e8
# Maximal BH mass considered for BH repositioning in solar masses.
\ No newline at end of file
max_reposition_mass
:
2e8
# Maximal BH mass considered for BH repositioning in solar masses.
threshold_major_merger
:
0.333
# Mass ratio threshold to consider a BH merger as 'major'
threshold_minor_merger
:
0.1
# Mass ratio threshold to consider a BH merger as 'minor'
examples/EAGLE_ICs/EAGLE_50/eagle_50.yml
View file @
83b3429f
...
...
@@ -184,3 +184,5 @@ EAGLEAGN:
AGN_delta_T_K
:
3.16228e8
# Change in temperature to apply to the gas particle in an AGN feedback event in Kelvin.
AGN_num_ngb_to_heat
:
1.
# Target number of gas neighbours to heat in an AGN feedback event.
max_reposition_mass
:
2e8
# Maximal BH mass considered for BH repositioning in solar masses.
threshold_major_merger
:
0.333
# Mass ratio threshold to consider a BH merger as 'major'
threshold_minor_merger
:
0.1
# Mass ratio threshold to consider a BH merger as 'minor'
examples/EAGLE_low_z/EAGLE_12/eagle_12.yml
View file @
83b3429f
...
...
@@ -177,4 +177,6 @@ EAGLEAGN:
coupling_efficiency
:
0.15
# Fraction of the radiated energy that couples to the gas in feedback events.
AGN_delta_T_K
:
3.16228e8
# Change in temperature to apply to the gas particle in an AGN feedback event in Kelvin.
AGN_num_ngb_to_heat
:
1.
# Target number of gas neighbours to heat in an AGN feedback event.
max_reposition_mass
:
2e8
# Maximal BH mass considered for BH repositioning in solar masses.
\ No newline at end of file
max_reposition_mass
:
2e8
# Maximal BH mass considered for BH repositioning in solar masses.
threshold_major_merger
:
0.333
# Mass ratio threshold to consider a BH merger as 'major'
threshold_minor_merger
:
0.1
# Mass ratio threshold to consider a BH merger as 'minor'
examples/EAGLE_low_z/EAGLE_25/eagle_25.yml
View file @
83b3429f
...
...
@@ -185,4 +185,6 @@ EAGLEAGN:
coupling_efficiency
:
0.15
# Fraction of the radiated energy that couples to the gas in feedback events.
AGN_delta_T_K
:
3.16228e8
# Change in temperature to apply to the gas particle in an AGN feedback event in Kelvin.
AGN_num_ngb_to_heat
:
1.
# Target number of gas neighbours to heat in an AGN feedback event.
max_reposition_mass
:
2e8
# Maximal BH mass considered for BH repositioning in solar masses.
\ No newline at end of file
max_reposition_mass
:
2e8
# Maximal BH mass considered for BH repositioning in solar masses.
threshold_major_merger
:
0.333
# Mass ratio threshold to consider a BH merger as 'major'
threshold_minor_merger
:
0.1
# Mass ratio threshold to consider a BH merger as 'minor'
examples/EAGLE_low_z/EAGLE_50/eagle_50.yml
View file @
83b3429f
...
...
@@ -176,4 +176,6 @@ EAGLEAGN:
coupling_efficiency
:
0.15
# Fraction of the radiated energy that couples to the gas in feedback events.
AGN_delta_T_K
:
3.16228e8
# Change in temperature to apply to the gas particle in an AGN feedback event in Kelvin.
AGN_num_ngb_to_heat
:
1.
# Target number of gas neighbours to heat in an AGN feedback event.
max_reposition_mass
:
2e8
# Maximal BH mass considered for BH repositioning in solar masses.
\ No newline at end of file
max_reposition_mass
:
2e8
# Maximal BH mass considered for BH repositioning in solar masses.
threshold_major_merger
:
0.333
# Mass ratio threshold to consider a BH merger as 'major'
threshold_minor_merger
:
0.1
# Mass ratio threshold to consider a BH merger as 'minor'
examples/EAGLE_low_z/EAGLE_6/eagle_6.yml
View file @
83b3429f
...
...
@@ -186,4 +186,6 @@ EAGLEAGN:
coupling_efficiency
:
0.15
# Fraction of the radiated energy that couples to the gas in feedback events.
AGN_delta_T_K
:
3.16228e8
# Change in temperature to apply to the gas particle in an AGN feedback event in Kelvin.
AGN_num_ngb_to_heat
:
1.
# Target number of gas neighbours to heat in an AGN feedback event.
max_reposition_mass
:
2e8
# Maximal BH mass considered for BH repositioning in solar masses.
\ No newline at end of file
max_reposition_mass
:
2e8
# Maximal BH mass considered for BH repositioning in solar masses.
threshold_major_merger
:
0.333
# Mass ratio threshold to consider a BH merger as 'major'
threshold_minor_merger
:
0.1
# Mass ratio threshold to consider a BH merger as 'minor'
examples/parameter_example.yml
View file @
83b3429f
...
...
@@ -435,3 +435,5 @@ EAGLEAGN:
AGN_delta_T_K
:
3.16228e8
# Change in temperature to apply to the gas particle in an AGN feedback event in Kelvin.
AGN_num_ngb_to_heat
:
1.
# Target number of gas neighbours to heat in an AGN feedback event.
max_reposition_mass
:
2e8
# Maximal BH mass considered for BH repositioning in solar masses.
threshold_major_merger
:
0.333
# Mass ratio threshold to consider a BH merger as 'major'
threshold_minor_merger
:
0.1
# Mass ratio threshold to consider a BH merger as 'minor'
src/black_holes/Default/black_holes.h
View file @
83b3429f
...
...
@@ -163,9 +163,14 @@ __attribute__((always_inline)) INLINE static void black_holes_swallow_part(
* @param bpi The #bpart to update.
* @param bpj The #bpart 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
black_holes_swallow_bpart
(
struct
bpart
*
bpi
,
const
struct
bpart
*
bpj
,
const
struct
cosmology
*
cosmo
)
{
struct
bpart
*
bpi
,
const
struct
bpart
*
bpj
,
const
struct
cosmology
*
cosmo
,
const
double
time
,
const
int
with_cosmology
,
const
struct
black_holes_props
*
props
)
{
/* Nothing to do here: No merging in the default model */
}
...
...
src/black_holes/EAGLE/black_holes.h
View file @
83b3429f
...
...
@@ -63,6 +63,8 @@ __attribute__((always_inline)) INLINE static void black_holes_first_init_bpart(
bp
->
cumulative_number_seeds
=
1
;
bp
->
number_of_mergers
=
0
;
bp
->
last_high_Eddington_fraction_scale_factor
=
-
1
.
f
;
bp
->
last_minor_merger_time
=
-
1
.;
bp
->
last_major_merger_time
=
-
1
.;
black_holes_mark_bpart_as_not_swallowed
(
&
bp
->
merger_data
);
}
...
...
@@ -280,14 +282,35 @@ __attribute__((always_inline)) INLINE static void black_holes_swallow_part(
* @param bpi The #bpart to update.
* @param bpj The #bpart 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
black_holes_swallow_bpart
(
struct
bpart
*
bpi
,
const
struct
bpart
*
bpj
,
const
struct
cosmology
*
cosmo
)
{
struct
bpart
*
bpi
,
const
struct
bpart
*
bpj
,
const
struct
cosmology
*
cosmo
,
const
double
time
,
const
int
with_cosmology
,
const
struct
black_holes_props
*
props
)
{
/* Get the current dynamical masses */
const
float
bpi_dyn_mass
=
bpi
->
mass
;
const
float
bpj_dyn_mass
=
bpj
->
mass
;
/* Is this merger ratio above the threshold for recording? */
const
double
merger_ratio
=
bpj
->
subgrid_mass
/
bpi
->
subgrid_mass
;
if
(
merger_ratio
>
props
->
major_merger_threshold
)
{
if
(
with_cosmology
)
{
bpi
->
last_major_merger_scale_factor
=
cosmo
->
a
;
}
else
{
bpi
->
last_major_merger_time
=
time
;
}
}
else
if
(
merger_ratio
>
props
->
minor_merger_threshold
)
{
if
(
with_cosmology
)
{
bpi
->
last_minor_merger_scale_factor
=
cosmo
->
a
;
}
else
{
bpi
->
last_minor_merger_time
=
time
;
}
}
/* Increase the masses of the BH. */
bpi
->
mass
+=
bpj
->
mass
;
bpi
->
gpart
->
mass
+=
bpj
->
mass
;
...
...
@@ -573,6 +596,10 @@ INLINE static void black_holes_create_from_gas(
/* Last time this BH had a high Eddington fraction */
bp
->
last_high_Eddington_fraction_scale_factor
=
-
1
.
f
;
/* Last time of mergers */
bp
->
last_minor_merger_time
=
-
1
.;
bp
->
last_major_merger_time
=
-
1
.;
/* First initialisation */
black_holes_init_bpart
(
bp
);
...
...
src/black_holes/EAGLE/black_holes_io.h
View file @
83b3429f
...
...
@@ -114,7 +114,7 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
int
with_cosmology
)
{
/* Say how much we want to write */
*
num_fields
=
1
5
;
*
num_fields
=
1
7
;
/* List what we want to write */
list
[
0
]
=
io_make_output_field_convert_bpart
(
...
...
@@ -191,16 +191,40 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
list
[
14
]
=
io_make_output_field
(
"LastHighEddingtonFractionScaleFactors"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
0
.
f
,
bparts
,
last_high_Eddington_fraction_scale_factor
,
"Scale-factors at which the black holes last reached a
n
Eddington "
"ratio
> 0.1
. -1 if never reached."
);
"Scale-factors at which the black holes last reached a
large
Eddington "
"ratio. -1 if never reached."
);
}
else
{
list
[
14
]
=
io_make_output_field
(
"LastHighEddingtonFractionTimes"
,
FLOAT
,
1
,
UNIT_CONV_TIME
,
0
.
f
,
bparts
,
last_high_Eddington_fraction_time
,
"Times at which the black holes last reached a
n
Eddington ratio
> 0.1
. "
"Times at which the black holes last reached a
large
Eddington ratio. "
"-1 if never reached."
);
}
if
(
with_cosmology
)
{
list
[
15
]
=
io_make_output_field
(
"LastMinorMergerScaleFactors"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
0
.
f
,
bparts
,
last_minor_merger_scale_factor
,
"Scale-factors at which the black holes last had a minor merger."
);
}
else
{
list
[
15
]
=
io_make_output_field
(
"LastMinorMergerScaleTimes"
,
FLOAT
,
1
,
UNIT_CONV_TIME
,
0
.
f
,
bparts
,
last_minor_merger_time
,
"Times at which the black holes last had a minor merger."
);
}
if
(
with_cosmology
)
{
list
[
16
]
=
io_make_output_field
(
"LastMajorMergerScaleFactors"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
0
.
f
,
bparts
,
last_major_merger_scale_factor
,
"Scale-factors at which the black holes last had a major merger."
);
}
else
{
list
[
16
]
=
io_make_output_field
(
"LastMajorMergerScaleTimes"
,
FLOAT
,
1
,
UNIT_CONV_TIME
,
0
.
f
,
bparts
,
last_major_merger_time
,
"Times at which the black holes last had a major merger."
);
}
#ifdef DEBUG_INTERACTIONS_BLACK_HOLES
list
+=
*
num_fields
;
...
...
src/black_holes/EAGLE/black_holes_part.h
View file @
83b3429f
...
...
@@ -121,6 +121,26 @@ struct bpart {
float
last_high_Eddington_fraction_scale_factor
;
};
/*! Union for the last minor merger point in time */
union
{
/*! Last time the BH had a a high Eddington fraction */
float
last_minor_merger_time
;
/*! Last scale factor the BH had a a high Eddington fraction */
float
last_minor_merger_scale_factor
;
};
/*! Union for the last major merger point in time */
union
{
/*! Last time the BH had a a high Eddington fraction */
float
last_major_merger_time
;
/*! Last scale factor the BH had a a high Eddington fraction */
float
last_major_merger_scale_factor
;
};
/*! Properties used in the feedback loop to distribute to gas neighbours. */
struct
{
...
...
src/black_holes/EAGLE/black_holes_properties.h
View file @
83b3429f
...
...
@@ -82,6 +82,14 @@ struct black_holes_props {
/*! Maximal mass of BH to reposition */
float
max_reposition_mass
;
/* ---- Properties of the merger model ---------- */
/*! Mass ratio above which a merger is considered 'minor' */
float
minor_merger_threshold
;
/*! Mass ratio above which a merger is considered 'major' */
float
major_merger_threshold
;
/* ---- Common conversion factors --------------- */
/*! Conversion factor from temperature to internal energy */
...
...
@@ -151,8 +159,8 @@ INLINE static void black_holes_props_init(struct black_holes_props *bp,
/* Accretion parameters ---------------------------------- */
bp
->
f_Edd
=
parser_get_param_float
(
params
,
"EAGLEAGN:max_eddington_fraction"
);
bp
->
f_Edd_recording
=
parser_get_param_float
(
params
,
"EAGLEAGN:eddington_fraction_for_recording"
);
bp
->
f_Edd_recording
=
parser_get_param_float
(
params
,
"EAGLEAGN:eddington_fraction_for_recording"
);
bp
->
epsilon_r
=
parser_get_param_float
(
params
,
"EAGLEAGN:radiative_efficiency"
);
bp
->
epsilon_f
=
...
...
@@ -175,6 +183,14 @@ INLINE static void black_holes_props_init(struct black_holes_props *bp,
/* Convert to internal units */
bp
->
max_reposition_mass
*=
phys_const
->
const_solar_mass
;
/* Merger parameters ------------------------------------- */
bp
->
minor_merger_threshold
=
parser_get_param_float
(
params
,
"EAGLEAGN:threshold_minor_merger"
);
bp
->
major_merger_threshold
=
parser_get_param_float
(
params
,
"EAGLEAGN:threshold_major_merger"
);
/* Common conversion factors ----------------------------- */
/* Calculate temperature to internal energy conversion factor (all internal
...
...
src/runner_black_holes.c
View file @
83b3429f
...
...
@@ -275,6 +275,8 @@ void runner_do_bh_swallow(struct runner *r, struct cell *c, int timer) {
struct
engine
*
e
=
r
->
e
;
struct
space
*
s
=
e
->
s
;
const
int
with_cosmology
=
(
e
->
policy
&
engine_policy_cosmology
);
const
struct
black_holes_props
*
props
=
e
->
black_holes_properties
;
struct
bpart
*
bparts
=
s
->
bparts
;
const
size_t
nr_bpart
=
s
->
nr_bparts
;
#ifdef WITH_MPI
...
...
@@ -349,7 +351,8 @@ void runner_do_bh_swallow(struct runner *r, struct cell *c, int timer) {
lock_lock
(
&
s
->
lock
);
/* Swallow the gas particle (i.e. update the BH properties) */
black_holes_swallow_bpart
(
bp
,
cell_bp
,
e
->
cosmology
);
black_holes_swallow_bpart
(
bp
,
cell_bp
,
e
->
cosmology
,
e
->
time
,
with_cosmology
,
props
);
/* Release the space as we are done updating the bpart */
if
(
lock_unlock
(
&
s
->
lock
)
!=
0
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment