-
Notifications
You must be signed in to change notification settings - Fork 2
/
volume_comoving.pro
62 lines (43 loc) · 1.69 KB
/
volume_comoving.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
;;*** VOLUME_COMOVING
;;
;; AIM: calculate comoving volume between two redshift points
;; e.g. http://www.astro.ufl.edu/~guzman/ast7939/projects/project01.html
;; or Hogg 2000: astro-ph/9905116
;;******************************************************************
FUNCTION comoving, z
common cosm,Olam,Omat,H0
Otot = Omat+Olam
c = 3E5 ;km/s
Dl = lumdist(z,H0=H0,Omega_m=Omat, Lambda0=Olam,/silent) ;Mpc
Rodr = (c/H0)*((1-Otot)*(1+z)^2+Olam+Omat*(1+z)^3)^(-0.5)
dV = Rodr*4*!PI*(Dl/(1.+z))^2
return,dV
END
;;------------------------------------------------------------------
FUNCTION volume_comoving, z1, z2,area=area, Olam=Olam_in, Omat=Omat_in,H0=H0_in
common cosm, Olam,Omat,H0
if n_elements(z1) eq 0 or n_elements(z2) eq 0 then begin
message,'usage: vol=volume_comoving(z1,z2,[area=]) where z1<z2, area=radians'
return,0
endif
if z1 gt z2 then begin
message,'usage: vol=volume_comoving(z1,z2,[area=]) where z1<z2, area=radians'
return,0
endif
if keyword_set(area) then begin
if area gt !PI*4 then begin
message,'usage: vol=volume_comoving(z1,z2,[area=]) where z1<z2, area=radians'
message,'suspicious: area appears to be > 4*PI'
return,0
endif
endif
;; default cosmological parameters
if not(keyword_set(Olam_in)) then Olam=0.7 else Olam=Olam_in
if not(keyword_set(Omat_in)) then Omat=0.3 else Omat=Omat_in
if not(keyword_set(H0_in)) then H0=70. else H0=H0_in
;; return integral of dV = (c/H0) * Dl^2 / (E(z) * (1+z)^2) dA dz
;; between z1 and z2
;; if area not input than use 4!PI, else calculate for given dA
if not(keyword_set(area)) then return, QROMB('comoving',z1,z2) $
else return, area*QROMB('comoving',z1,z2)/(!PI*4)
END