Skip to content
GitLab
Menu
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
f874b6c9
Commit
f874b6c9
authored
Jul 10, 2019
by
Matthieu Schaller
Browse files
When merging BHs, accumulate the number of seeds
parent
ef7b5f19
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/black_holes/EAGLE/black_holes.h
View file @
f874b6c9
...
...
@@ -59,6 +59,8 @@ __attribute__((always_inline)) INLINE static void black_holes_first_init_bpart(
bp
->
total_accreted_mass
=
0
.
f
;
bp
->
accretion_rate
=
0
.
f
;
bp
->
formation_time
=
-
1
.
f
;
bp
->
cumulative_number_seeds
=
1
;
bp
->
number_of_mergers
=
0
;
}
/**
...
...
@@ -244,6 +246,36 @@ __attribute__((always_inline)) INLINE static void black_holes_swallow_part(
*/
__attribute__
((
always_inline
))
INLINE
static
void
black_holes_swallow_bpart
(
struct
bpart
*
bpi
,
const
struct
bpart
*
bpj
,
const
struct
cosmology
*
cosmo
)
{
/* Get the current dynamical masses */
const
float
bpi_dyn_mass
=
bpi
->
mass
;
const
float
bpj_dyn_mass
=
bpj
->
mass
;
/* Increase the masses of the BH. */
bpi
->
mass
+=
bpj
->
mass
;
bpi
->
gpart
->
mass
+=
bpj
->
mass
;
bpi
->
subgrid_mass
+=
bpj
->
subgrid_mass
;
/* Update the BH momentum */
const
float
BH_mom
[
3
]
=
{
bpi_dyn_mass
*
bpi
->
v
[
0
]
+
bpj_dyn_mass
*
bpj
->
v
[
0
],
bpi_dyn_mass
*
bpi
->
v
[
1
]
+
bpj_dyn_mass
*
bpj
->
v
[
1
],
bpi_dyn_mass
*
bpi
->
v
[
2
]
+
bpj_dyn_mass
*
bpj
->
v
[
2
]};
bpi
->
v
[
0
]
=
BH_mom
[
0
]
/
bpi
->
mass
;
bpi
->
v
[
1
]
=
BH_mom
[
1
]
/
bpi
->
mass
;
bpi
->
v
[
2
]
=
BH_mom
[
2
]
/
bpi
->
mass
;
bpi
->
gpart
->
v_full
[
0
]
=
bpi
->
v
[
0
];
bpi
->
gpart
->
v_full
[
1
]
=
bpi
->
v
[
1
];
bpi
->
gpart
->
v_full
[
2
]
=
bpi
->
v
[
2
];
/* Update the energy reservoir */
bpi
->
energy_reservoir
+=
bpj
->
energy_reservoir
;
/* Add up all the BH seeds */
bpi
->
cumulative_number_seeds
+=
bpj
->
cumulative_number_seeds
;
/* We had another merger */
bpi
->
number_of_mergers
++
;
}
/**
...
...
@@ -446,6 +478,8 @@ INLINE static void black_holes_create_from_gas(
/* We haven't accreted anything yet */
bp
->
total_accreted_mass
=
0
.
f
;
bp
->
cumulative_number_seeds
=
1
;
bp
->
number_of_mergers
=
0
;
/* Initial metal masses */
const
float
gas_mass
=
hydro_get_mass
(
p
);
...
...
src/black_holes/EAGLE/black_holes_io.h
View file @
f874b6c9
...
...
@@ -77,7 +77,7 @@ INLINE static void black_holes_write_particles(const struct bpart *bparts,
int
*
num_fields
)
{
/* Say how much we want to write */
*
num_fields
=
1
2
;
*
num_fields
=
1
3
;
/* List what we want to write */
list
[
0
]
=
io_make_output_field_convert_bpart
(
...
...
@@ -106,6 +106,9 @@ INLINE static void black_holes_write_particles(const struct bpart *bparts,
list
[
11
]
=
io_make_output_field
(
"TotalAccretedMass"
,
FLOAT
,
1
,
UNIT_CONV_MASS_PER_UNIT_TIME
,
bparts
,
total_accreted_mass
);
list
[
12
]
=
io_make_output_field
(
"CumulativeNumberSeeds"
,
INT
,
1
,
UNIT_CONV_NO_UNITS
,
bparts
,
cumulative_number_seeds
);
#ifdef DEBUG_INTERACTIONS_BLACK_HOLES
...
...
src/black_holes/EAGLE/black_holes_part.h
View file @
f874b6c9
...
...
@@ -103,6 +103,12 @@ struct bpart {
/*! Integer number of neighbours */
int
num_ngbs
;
/*! Number of seeds in this BH (i.e. itself + the merged ones) */
int
cumulative_number_seeds
;
/*! Total number of BH merger events (i.e. not including all progenies) */
int
number_of_mergers
;
/*! Properties used in the feedback loop to distribute to gas neighbours. */
struct
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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