Skip to content

Commit 09bef2d

Browse files
committed
Update changelog.h
2 parents 62a0db0 + 348395b commit 09bef2d

File tree

6 files changed

+107
-89
lines changed

6 files changed

+107
-89
lines changed

compas_matlab_utils/ComparisonPlots.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ function ComparisonPlots(filename1, name1, filename2, name2)
160160
end %end of ComparisonPlots
161161

162162

163-
%Plot double compact objects; returns DCO counts
163+
%Plot double compact objects; returns DCO counts, and counts of CEs leading
164+
%to DCOs
164165
function [BNScount, NSBHcount, BBHcount, BNSCE, NSBHCE, BBHCE, CEBBH1count] = ...
165166
DCOplot(file, name, fignumber, colour, point)
166167
global Msunkg G AU

compas_matlab_utils/CosmicHistoryIntegrator.m

Lines changed: 90 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
function [Zlist, MergerRateByRedshiftByZ, SFRfractionZ]=...
2-
CosmicHistoryIntegrator(filename,zlist,metallicitychoice, makeplots)
2+
CosmicHistoryIntegrator(filename, zlistformation, zlistdetection, Msimulated, makeplots)
33
% Integrator for the binary black hole merger rate over cosmic history
44
% COMPAS (Compact Object Mergers: Population Astrophysics and Statistics)
55
% software package
66
%
77
% USAGE:
88
% [Zlist, MergerRateByRedshiftByZ]=...
9-
% CosmicHistoryIntegrator(filename, zlistformation, zlistmerger, zlistdetection, Msimulated, [,makeplots])
9+
% CosmicHistoryIntegrator(filename, zlistformation, zlistmerger, [,makeplots])
1010
%
1111
% INPUTS:
1212
% filename: name of population synthesis input file
1313
% should be in COMPAS output h5 format
1414
% zlistformation: vector of redshifts at which the formation rate is
1515
% computed
16-
% zlistmerger: vector of redshifts at which the merger rate is computed
17-
% zlistdetection: vector of redshifts at which the detection rate is
18-
% computed
16+
% zlistdetection: vector of redshifts at which the detection rate is computed
1917
% Msimulated: total star forming mass represented by the simulation (for
2018
% normalisation)
2119
% makeplots: if set to 1, generates a set of useful plots (default = 0)
@@ -56,89 +54,94 @@
5654
Mpc=Mpcm/c; %Gpc in seconds
5755
yr=3.15569e7; %year in seconds
5856

59-
if (nargin<2)
57+
if (nargin<4)
6058
error('Not enough input arguments.');
6159
end;
62-
if (nargin<4), makeplots=0; end;
60+
if (nargin<5), makeplots=0; end;
6361

6462
%cosmology calculator
65-
[zvec,tL]=Cosmology();
63+
[tL]=Cosmology(zlistformation);
6664
%load COMPAS data
67-
[M1,M2,Z,Tdelay]=DataRead(filename, max(tL));
65+
[M1,M2,Z,Tdelay]=DataRead(filename);
66+
Zlist=unique(Z);
6867
%metallicity-specific SFR
69-
[Zlist,SFR,SFRfractionZ]=Metallicity(Z,zvec,metallicitychoice);
68+
[SFR,Zweight]=Metallicity(Zlist,zlistformation);
7069

7170

7271
%Consider the contribution of every simulated binary to the merger rate
7372
%in every redshift bin by considering when it would have to be formed to
7473
%merge at that redshift and normalizing by the relevant
7574
%metallicity-specific star formation rate
76-
dz=zvec(2)-zvec(1);
77-
tLmerge=tL(floor(zlist/(zvec(2)-zvec(1)))+1);
78-
MergerRateByRedshiftByZ=zeros(length(zlist),length(Zlist));
75+
dz=zlistformation(2)-zlistformation(1);
76+
tLmerge=tL(floor(zlistformation/dz)+1);
77+
MergerRateByRedshiftByZ=zeros(length(zlistformation),length(Zlist));
7978
for(i=1:length(M1)),
8079
Zcounter=find(Zlist==Z(i));
8180
zformindex=find(tL>=Tdelay(i),1);
82-
for(k=1:length(zlist)),
81+
for(k=1:length(zlistformation)),
8382
zformindex=find(tL>=(Tdelay(i)+tLmerge(k)),1);
8483
MergerRateByRedshiftByZ(k,Zcounter)=...
8584
MergerRateByRedshiftByZ(k,Zcounter)+...
86-
SFR(zformindex)*SFRfractionZ(zformindex,Zcounter)/Msimulated;
85+
SFR(zformindex)*Zweight(zformindex,Zcounter)/Msimulated;
8786
end;
8887
end;
8988

9089
if(makeplots==1), %make a set of default plots
91-
MakePlots(M1,M2,Z,Tdelay,zvec,SFR,SFRfractionZ,...
92-
zlist,Zlist,MergerRateByRedshiftByZ);
90+
MakePlots(M1,M2,Z,Tdelay,zlistformation,Zlist,SFR,Zweight,...
91+
MergerRateByRedshiftByZ);
9392
end;
9493

9594
end %end of CosmicHistoryIntegrator
9695

9796

98-
%Load the data stored in COMPAS output format from a file
99-
%Select only binary black hole mergers of interest, and return the
97+
%Load the data stored in COMPAS .h5 output format from a file
98+
%Select only double compact object mergers of interest, and return the
10099
%component masses, metallicities, and star formation to merger delay times
101-
function [M1,M2,Z,Tdelay]=DataRead(filename, tHubble)
102-
global BH
103-
if(exist(filename, 'file')~=2),
100+
function [M1,M2,Z,Tdelay]=DataRead(file)
101+
if(exist(file, 'file')~=2),
104102
error('Input file does not exist');
105-
end;
106-
data = importdata(filename, '\t', 2);
107-
108-
colnames=data.textdata(2,:);
109-
Z1index=find(strcmp(colnames,'Metallicity1'));
110-
M1index=find(strcmp(colnames,'M1'));
111-
M2index=find(strcmp(colnames,'M2'));
112-
tcindex=find(strcmp(colnames,'tc'));
113-
tformindex=find(strcmp(colnames,'tform'));
114-
type1index=find(strcmp(colnames,'stellarType1'));
115-
type2index=find(strcmp(colnames,'stellarType2'));
116-
nonRLOF=data.data(:,find(strcmp(colnames,'RLOFSecondaryAfterCEE')))==0;
117-
Pessimistic=data.data(:,find(strcmp(colnames,'optimisticCEFlag')))==0;
118-
tc=data.data(:,tcindex);
119-
tform=data.data(:,tformindex);
120-
Ttotal=(tc+tform)*1e6; %convert Megayears to years
121-
%select only binaries where both members are black holes at the last
122-
%step, the total delay time is less than the age of the Universe, there
123-
%is no Roche-lobe overflow immediately after the common-envelope phase,
124-
%and the Pessimistic common-envelope conditions are met
125-
select=Ttotal<tHubble & nonRLOF & Pessimistic & ...
126-
data.data(:,type1index)==14 & data.data(:,type2index)==14;
127-
128-
M1=data.data(select,M1index);
129-
M2=data.data(select,M2index);
130-
Z=data.data(select,Z1index);
131-
Tdelay=Ttotal(select);
103+
end;
104+
type1=h5read(file,'/BSE_Double_Compact_Objects/Stellar_Type(1)');
105+
type2=h5read(file,'/BSE_Double_Compact_Objects/Stellar_Type(2)');
106+
mass1=h5read(file,'/BSE_Double_Compact_Objects/Mass(1)');
107+
mass2=h5read(file,'/BSE_Double_Compact_Objects/Mass(2)');
108+
seedDCO=h5read(file,'/BSE_Double_Compact_Objects/SEED');
109+
merges=h5read(file,'/BSE_Double_Compact_Objects/Merges_Hubble_Time');
110+
a=h5read(file,'/BSE_Double_Compact_Objects/SemiMajorAxis@DCO');
111+
e=h5read(file,'/BSE_Double_Compact_Objects/Eccentricity@DCO');
112+
Ttotal=(h5read(file,'/BSE_Double_Compact_Objects/Time')+h5read(file,'/BSE_Double_Compact_Objects/Coalescence_Time'))*1e6; %to years
113+
%mergingBBH=(type1==14) & (type2==14) & merges;
114+
%BBH=(type1==14) & (type2==14);
115+
%mergingBNS=(type1==13) & (type2==13) & merges;
116+
%BNS=(type1==13) & (type2==13);
117+
%mergingNSBH=(((type1==13) & (type2==14)) | ((type1==14) & (type2==13))) & merges;
118+
%NSBH=(((type1==13) & (type2==14)) | ((type1==14) & (type2==13)));
119+
%mergingDCO=mergingBNS | mergingNSBH | mergingBBH;
120+
%BNScount=sum(mergingBNS); NSBHcount=sum(mergingNSBH); BBHcount=sum(mergingBBH);
121+
chirpmass=mass1.^0.6.*mass2.^0.6./(mass1+mass2).^0.2;
122+
q=mass2./mass1;
123+
seedCE=h5read(file,'/BSE_Common_Envelopes/SEED');
124+
[isCE,CEIndex]=ismember(seedDCO,seedCE);
125+
optCE=h5read(file,'/BSE_Common_Envelopes/Optimistic_CE');
126+
RLOFCE=h5read(file,'/BSE_Common_Envelopes/Immediate_RLOF>CE');
127+
OKCE=zeros(size(seedDCO)); OKCE(CEIndex==0)=1; OKCE(CEIndex>0)=(~optCE(CEIndex(CEIndex>0))) & (~RLOFCE(CEIndex(CEIndex>0)));
128+
%BNSCE=sum(mergingBNS & isCE & OKCE); NSBHCE=sum(mergingNSBH & isCE & OKCE); BBHCE=sum(mergingBBH & isCE & OKCE);
129+
mergingDCO=merges & OKCE;
130+
Zsys=h5read(file,'/BSE_System_Parameters/Metallicity@ZAMS(1)');
131+
seedsys=h5read(file,'/BSE_System_Parameters/SEED');
132+
[blah,sysIndex]=ismember(seedDCO,seedsys);
133+
Zdco=Zsys(sysIndex);
134+
M1=mass1(mergingDCO); M2=mass2(mergingDCO); Z=Zdco(mergingDCO); Tdelay=Ttotal(mergingDCO);
132135
end %end of DataRead
133136

134137
%Compute the star formation rate and lookback time (in years)
135138
%for an array of redshifts
136-
function [zvec,tL]=Cosmology()
139+
function [tL]=Cosmology(zvec)
137140
global Mpcm
138141
global Mpc
139142
global yr
140-
zmax=10; dz=0.001; zvec=0:dz:zmax;
141-
Nz=length(zvec);
143+
%zmax=10; dz=0.001; zvec=0:dz:zmax;
144+
Nz=length(zvec); dz=zvec(2)-zvec(1);
142145

143146
%Planck cosmology
144147
OmegaM=0.236+0.046; %2012arXiv1212.5226H
@@ -157,66 +160,72 @@
157160
end %end of Cosmology
158161

159162

160-
%Compute the fraction of star formation that happens in a given metallicity
161-
%bin as a function of redshift
162-
function [Zlist,SFR,SFRfractionZ]=Metallicity(zvec,Z)
163+
%Compute the weight of each star-forming metallicity as a function of redshift
164+
function [SFR,Zweight]=Metallicity(Zvec, zvec)
163165
%M_/odot per Mpc^3 per year -- Neijssel+ 2019 preferred model
164166
%would be SFR=0.015*(1+zvec).^2.7./(1+((1+zvec)/2.9).^5.6) in Madau & Dickinson, 2014, (15)
165167
SFR=0.01*(1+zvec).^2.77./(1+((1+zvec)/2.9).^4.7);
166-
Zmean=0.035.*10.^(-0.23*zvec);
167-
Zmu=log(Zmean)-0.39^2/2;
168-
dlogZ=0.01;
169-
logZvec=-12:dlogZ:0; %natural log
170-
dPdlogZ=1/0.39/sqrt(2*pi)*exp(-(logZvec'-Zmu).^2/2/0.39^2);
171-
dPdlogZ=dPdlogZ./(sum(dPdlogZ,1)*dlogZ); %normalise
172-
Zrange=log(max(Z))-log(min(Z)); %ugly correction for not including tails
173-
PdrawZ=1/Zrange;
174-
minlogZindex=find(exp(logZvec)>=min(Z),1, 'first');
175-
maxlogZindex=find(exp(logZvec)<=max(Z),1, 'last');
176-
dPdlogZ(minlogZindex,:)=dPdlogZ(minlogZindex,:)+sum(dPdlogZ(1:minlogZindex,:),1)*dlogZ/(sum(Z==min(Z))/length(Z))*PdrawZ;
177-
dPdlogZ(maxlogZindex,:)=dPdlogZ(maxlogZindex,:)+sum(dPdlogZ(maxlogZindex:end,:),1)*dlogZ/(sum(Z==max(Z))/length(Z))*PdrawZ;
178-
dPdlogZ=dPdlogZ./(sum(dPdlogZ,1)*dlogZ); %normalise
168+
if(length(Zvec)>1),
169+
Zmean=0.035.*10.^(-0.23*zvec);
170+
Zmu=log(Zmean)-0.39^2/2;
171+
dlogZ=0.01;
172+
logZvec=-12:dlogZ:0; %natural log
173+
dPdlogZ=1/0.39/sqrt(2*pi)*exp(-(logZvec'-Zmu).^2/2/0.39^2);
174+
dPdlogZ=dPdlogZ./(sum(dPdlogZ,1)*dlogZ); %normalise
175+
Zrange=log(max(Zvec))-log(min(Zvec)); %ugly correction for not including tails
176+
PdrawZ=1/Zrange;
177+
minlogZindex=find(exp(logZvec)>=min(Zvec),1, 'first');
178+
maxlogZindex=find(exp(logZvec)>=max(Zvec),1, 'last');
179+
dPdlogZ(minlogZindex,:)=dPdlogZ(minlogZindex,:)+sum(dPdlogZ(1:minlogZindex,:),1)*dlogZ/(sum(Zvec==min(Zvec))/length(Zvec))*PdrawZ;
180+
dPdlogZ(maxlogZindex,:)=dPdlogZ(maxlogZindex,:)+sum(dPdlogZ(maxlogZindex:end,:),1)*dlogZ/(sum(Zvec==max(Zvec))/length(Zvec))*PdrawZ;
181+
dPdlogZ(1:minlogZindex,:)=0; dPdlogZ(maxlogZindex:size(dPdlogZ,1),:)=0;
182+
dPdlogZ=dPdlogZ./(sum(dPdlogZ,1)*dlogZ); %normalise
183+
for(i=1:length(Zvec))
184+
index=find(exp(logZvec)>=Zvec(i), 1, 'first');
185+
Zweight(:,i)=dPdlogZ(index,:)*dlogZ;
186+
end;
187+
else %relevant for single-metallicity runs -- just give all binaries the same unit weight
188+
Zweight(1:length(zvec),1:length(Zvec))=1;
189+
end;
179190
end %end of Metallicity
180191

181192

182193
%Make a set of default plots
183-
function MakePlots(M1,M2,Z,Tdelay,zvec,SFR,SFRfractionZ,...
184-
zlist,Zlist,MergerRateByRedshiftByZ)
194+
function MakePlots(M1,M2,Z,Tdelay,zvec,Zlist,SFR,Zweight,...
195+
MergerRateByRedshiftByZ)
185196

186197
figure(1),colormap jet;
187-
plot(zlist, MergerRateByRedshiftByZ, 'LineWidth', 2),
198+
plot(zvec, MergerRateByRedshiftByZ*1e9, 'LineWidth', 2),
188199
legend(num2str(Zlist)),
189200
set(gca, 'FontSize', 20); %for labels
190201
xlabel('z'),
191-
ylabel('Pessimistic non-RLOF BBH merger rate, per Gpc^3 per yr')
192-
disp(['Total BBH merger rate at z=0: ', ...
202+
ylabel('DCO merger rate per Gpc^3 per yr')
203+
disp(['Total DCO merger rate at z=0: ', ...
193204
num2str(sum(MergerRateByRedshiftByZ(:,1))),...
194205
' per Gpc^3 per year']);
195206

196-
197207
figure(2), colormap jet;
198208
scatter(M1,M2,20,log(Z)/log(10),'filled');
199209
set(gca, 'FontSize', 20); %for labels
200210
H=colorbar; H.Label.String='log_{10} metallicity';
201-
xlabel('Primary BH mass [M_o]'), ylabel('Secondary BH mass [M_o]');
211+
xlabel('Primary mass [M_o]'), ylabel('Secondary mass [M_o]');
202212

203213
figure(3), colormap jet;
204-
scatter(M1+M2,log(Tdelay/1e6)/log(10),20,log(Z)/log(10),'filled');
214+
scatter(M1+M2,log10(Tdelay/1e6),20,log10(Z),'filled');
205215
set(gca, 'FontSize', 20); %for labels
206216
H=colorbar; H.Label.String='log_{10} metallicity';
207-
xlabel('Total BBH mass [M_o]'), ylabel('log(Tdelay/Myr)');
217+
xlabel('Total DCO mass [M_o]'), ylabel('log_{10}(Tdelay/Myr)');
208218

209219
figure(4), colormap jet;
210-
plot(zvec, SFR)
220+
plot(zvec, SFR*1e9)
211221
set(gca, 'FontSize', 20); %for labels
212222
xlabel('z'), ylabel('Star-formation rate, M_o per Gpc^3 per yr');
213-
214223

215224
figure(5), colormap jet;
216-
plot(zvec, SFRfractionZ)
225+
plot(zvec, Zweight)
217226
set(gca, 'FontSize', 20); %for labels
218227
legend(num2str(Zlist))
219-
xlabel('z'), ylabel('Z-specific SFR fraction');
228+
xlabel('z'), ylabel('Z-specific SFR weight');
220229

221230
end %end of MakePlots
222231

online-docs/pages/quick-links.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Quick Links
66

77
./User guide/Program options/program-options-list-defaults
88
./User guide/COMPAS output/standard-logfiles-record-types
9-
./User guide/COMPAS output/standard-logfiles-record-specification-stellar.html
10-
./User guide/COMPAS output/standard-logfiles-record-specification-binary.html
9+
./User guide/COMPAS output/standard-logfiles-record-specification-stellar
10+
./User guide/COMPAS output/standard-logfiles-record-specification-binary
1111
./how-to-cite

src/BaseStar.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3904,10 +3904,14 @@ double BaseStar::DrawSNKickMagnitude(const double p_Sigma,
39043904

39053905
case KICK_MAGNITUDE_DISTRIBUTION::LOGNORMAL: { // LOGNORMAL
39063906
// Only draw Disberg & Mandel (2025) kicks for CCSN or PPISN (if they receive a kick)
3907-
// use Maxwellians with sigma set in CalculateSNKickMagnitude() for other SN types
3907+
// use Maxwellians with sigma set in CalculateSNKickMagnitude() for other SN types
39083908
SN_EVENT thisSNevent = utils::SNEventType(m_SupernovaDetails.events.current); // current SN event
3909-
if (thisSNevent == SN_EVENT::CCSN || (thisSNevent == SN_EVENT::PPISN && OPTIONS->NatalKickForPPISN()))
3910-
kickMagnitude = gsl_cdf_lognormal_Pinv(p_Rand, DISBERG_MANDEL_MU, DISBERG_MANDEL_SIGMA);
3909+
if (thisSNevent == SN_EVENT::CCSN || (thisSNevent == SN_EVENT::PPISN && OPTIONS->NatalKickForPPISN())) {
3910+
// maximum kick of DISBERG_MANDEL_MAX_KICK = 1000 km/s, following Disberg & Mandel (2025)
3911+
// normalise the draw so that the kick is uniformly drawn from the inverse CDF below this maximum
3912+
double cdfMax = gsl_cdf_lognormal_P(DISBERG_MANDEL_MAX_KICK, DISBERG_MANDEL_MU, DISBERG_MANDEL_SIGMA);
3913+
kickMagnitude = gsl_cdf_lognormal_Pinv(p_Rand*cdfMax, DISBERG_MANDEL_MU, DISBERG_MANDEL_SIGMA);
3914+
}
39113915
else
39123916
kickMagnitude = DrawKickMagnitudeDistributionMaxwell(p_Sigma, p_Rand);
39133917
} break;

src/changelog.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,11 +1591,14 @@
15911591
// 03.20.06 IM - June 25, 2025 - Enhancements:
15921592
// - The MAXWELLIAN NS CCSN kick changed from the Hobbs value of 265 km/s to 217 km/s based on 48 younger than 10 Myr pulsars with proper motions from Disberg & Mandel (2025) sample; corrects Hobbs+ 2005 missing Jacobian
15931593
// - Implemented a LOGNORMAL NS CCSN kick magnitude distribution based on Disberg & Mandel, 2025
1594-
// 03.20.07 AB - Jun 25, 2025 - Defect repair:
1594+
// 03.20.07 IM - June 25, 2025 - Enhancement:
1595+
// - Added a maximum threshold of 1000 km/s for Disberg & Mandel (2025) LOGNORMAL kicks, matching paper
1596+
// 03.20.08 AB - Jun 26, 2025 - Defect repair:
15951597
// - Fix for issue #400; correct Zsol values are now used in stellar wind prescriptions
15961598
// - To avoid ambiguous ZSOL, we now use ZSOL_HURLEY = 0.02, ZSOL_ANDERS = 0.019, and ZSOL_ASPLUND = 0.0142
1599+
// - Fixed error in MainSequence::CalculateInitialMainSequenceCoreMass()
15971600

1598-
const std::string VERSION_STRING = "03.20.07";
1601+
const std::string VERSION_STRING = "03.20.08";
15991602

16001603

16011604
# endif // __changelog_h__

src/constants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ constexpr double MULLERMANDEL_SIGMAKICK = 0.3;
397397
// Constants for Disberg & Mandel (2025) SN kick prescription
398398
constexpr double DISBERG_MANDEL_MU = 5.60;
399399
constexpr double DISBERG_MANDEL_SIGMA = 0.68;
400+
constexpr double DISBERG_MANDEL_MAX_KICK = 1000.0;
400401

401402
constexpr double HOBBS_CORRECTED_SIGMA = 217.0; // Best fit Maxwellian sigma for 48 younger than 10 Myr pulsars with proper motions from Disberg & Mandel (2025) sample; corrects Hobbs+ 2005 missing Jacobian
402403

0 commit comments

Comments
 (0)