ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_cosmology::getDisComTransNormedWU10 Interface Reference

Generate and return the approximate to the cosmological Transverse Comoving Distance normalized to Hubble Distance, given the user-specified cosmological parameters with negligible Curvature ( \(\Omega_K\)) and Radiation ( \(\Omega_R\)) density parameters. More...

Detailed Description

Generate and return the approximate to the cosmological Transverse Comoving Distance normalized to Hubble Distance, given the user-specified cosmological parameters with negligible Curvature ( \(\Omega_K\)) and Radiation ( \(\Omega_R\)) density parameters.

Assuming \((\Omega_M, \Omega_\Lambda, \Omega_R = 0, \Omega_K = 0)\) represent the normalized densities of Dark Matter, Dark Energy, Radiation Energy, and Curvature in a Universe with negligible neutrino mass such that \(\Omega_M + \Omega_\Lambda + \Omega_R + \Omega_K = 1\), the Transverse Comoving Distance to a given cosmological redshift \(z\) is defined as (e.g., Peebles, 1993),

\begin{equation} \large D_M(z; \Omega_M, \Omega_\Lambda) = \int_{0}^{z} \frac{D_H}{\sqrt{(1+z')^3\Omega_M + \Omega_\Lambda}} ~ dz' ~. \end{equation}

where

  1. \(D_M(z; \cdots)\) is the cosmological Transverse Comoving Distance as a function of redshift,
  2. \(D_H = \frac{C}{H_0}\) is the Hubble Distance,
  3. \(H_0\) is the Hubble Constant.
  4. \(C\) is the speed of light,
  5. \(z\) is the redshift,

The approximation used in this implementation is based on the work of Wickramasinghe and Ukwatta (2010), WU10.
The method of WU10 claims a relative numerical uncertainty of \(<0.0022\) in the computed Luminosity Distance (hence for the Transverse Comoving Distance) for \((\Omega_M, \Omega_\Lambda) = (0.7, 0.3)\).

Warning
The value returned by the procedures under this generic interface is \(\frac{\tilde{D}_M}{D_H}\), where \(\tilde{D}_M\) is the computed approximation to the true \(D_M\).
Note
To compute the approximate normalized luminosity distance, simply multiply the output of this routine with the factor (z + 1) where z stands for redshift.

Approximation error

The following plots depict the achieved relative percentage errors in the computation of the Transverse Comoving Distance for different values of \(\Omega_\Lambda\) and redshift \(z\).

Warning
Parameters
[in]zplus1: The input scalar or array of arbitrary rank of type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128) containing the redshift plus one, \((z+1)\), at which the Transverse Comoving Distance must be computed.
[in]omegaM: The input scalar or array of the same rank as other array-like arguments, of the same type and kind as the input argument zplus1 representing the normalized matter density in the universe.
(optional, default = OMEGA_M. It must be present if omegaL ( \(\Omega_\Lambda\)) is also present.)
[in]omegaL: The input scalar or array of the same rank as other array-like arguments, of the same type and kind as the input argument zplus1 representing the normalized Dark Energy density in the universe.
(optional, default = OMEGA_L. It must be present if omegaM is also present.)
Returns
disComTransNormedWU10 : The output of the same type, kind, and rank as the input argument zplus1 containing the approximate to the Transverse Comoving Distance at the desired redshift normalized to the Hubble Distance.


Possible calling interfaces

disComTransNormedWU10 = getDisComTransNormedWU10(zplus1)
disComTransNormedWU10 = getDisComTransNormedWU10(zplus1, omegaM, omegaL)
Generate and return the approximate to the cosmological Transverse Comoving Distance normalized to Hu...
This module contains procedures and generic interfaces and constants for cosmological calculations.
Warning
Beware that the actual precision of the output of the procedures under this generic interface is upper bounded by the approximation algorithm at around relative accuracy of 0.002.
This is the case regardless of the real kind and precision requested.
The pure procedure(s) documented herein become impure when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1.
By default, these procedures are pure in release build and impure in debug and testing builds.
See also
getDisComTransNormed


Example usage

1program example
2
3 use pm_kind, only: SK, IK
5 use pm_io, only: display_type
6
7 implicit none
8
9 type(display_type) :: disp
10
11 disp = display_type(file = "main.out.F90")
12
13 call disp%skip()
14 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
15 call disp%show("!Compute the Transverse Comoving Distance in units of Hubble Distance.")
16 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
17 call disp%skip()
18
19 call disp%skip()
20 call disp%show("getDisComTransNormedWU10(zplus1 = 1.)")
21 call disp%show( getDisComTransNormedWU10(zplus1 = 1.) )
22 call disp%skip()
23
24 call disp%skip()
25 call disp%show("getDisComTransNormedWU10(zplus1 = 1.1)")
26 call disp%show( getDisComTransNormedWU10(zplus1 = 1.1) )
27 call disp%skip()
28
29 call disp%skip()
30 call disp%show("getDisComTransNormedWU10(zplus1 = [ 2., 3.], omegaM = 0.4, omegaL = 0.6)")
31 call disp%show( getDisComTransNormedWU10(zplus1 = [ 2., 3.], omegaM = 0.4, omegaL = 0.6) )
32 call disp%skip()
33
34 ! Generate both the cosmic rate and the rate density.
35
36 block
37
38 use pm_val2str, only: getStr
39 use pm_arraySpace, only: getLinSpace
40 use pm_arraySpace, only: getLogSpace
41
42 real, allocatable :: zplus1(:), OmegaM(:), OmegaL(:)
43 integer :: fileUnit, i
44
45 OmegaM = [0.2, 0.3, 0.4]
46 OmegaL = 1. - OmegaM
47 zplus1 = 1. + getLogSpace(log(0.0001), log(10000.), 500_IK)
48
49 open(newunit = fileUnit, file = "getDisComTransNormedWU10.RK.txt")
50 write(fileUnit, "(*(g0,:,','))") "z", ("DisLum_"//getStr(OmegaM(i),"(g0.1)")//"_"//getStr(OmegaL(i),"(g0.1)"), i = 1, size(OmegaM))
51 do i = 1, size(zplus1)
52 write(fileUnit, "(*(g0,:,','))") zplus1(i) - 1., getDisComTransNormedWU10(zplus1(i), OmegaM, OmegaL)
53 end do
54 close(fileUnit)
55
56 end block
57
58end program example
Generate count evenly spaced points over the interval [x1, x2] if x1 < x2, or [x2,...
Generate count evenly-logarithmically-spaced points over the interval [base**logx1,...
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
Generate and return the conversion of the input value to an output Fortran string,...
Definition: pm_val2str.F90:167
This module contains procedures and generic interfaces for generating arrays with linear or logarithm...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
This module contains the generic procedures for converting values of different types and kinds to For...
Definition: pm_val2str.F90:58
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3!Compute the Transverse Comoving Distance in units of Hubble Distance.
4!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6
8+0.00000000
9
10
11getDisComTransNormedWU10(zplus1 = 1.1)
12+0.978205502E-1
13
14
15getDisComTransNormedWU10(zplus1 = [ 2., 3.], omegaM = 0.4, omegaL = 0.6)
16+0.730501294, +1.12001967
17
18

Postprocessing of the example output
1#!/usr/bin/env python
2
3import matplotlib.pyplot as plt
4import pandas as pd
5import numpy as np
6import glob
7import sys
8
9fontsize = 17
10
11marker ={ "CK" : "-"
12 , "IK" : "."
13 , "RK" : "-"
14 }
15xlab = { "CK" : "redshift: Z ( real/imaginary components )"
16 , "IK" : "redshift: Z ( integer-valued )"
17 , "RK" : "redshift: Z ( real-valued )"
18 }
19legends = [ "$\Omega_M = 0.2, \Omega_\Lambda = 0.8$"
20 , "$\Omega_M = 0.3, \Omega_\Lambda = 0.7$"
21 , "$\Omega_M = 0.4, \Omega_\Lambda = 0.6$"
22 ]
23
24for kind in ["IK", "CK", "RK"]:
25
26 pattern = "*." + kind + ".txt"
27 fileList = glob.glob(pattern)
28 if len(fileList) == 1:
29
30 df = pd.read_csv(fileList[0], delimiter = ",")
31
32 fig = plt.figure(figsize = 1.25 * np.array([6.4, 4.8]), dpi = 200)
33 ax = plt.subplot()
34
35 if kind == "CK":
36 plt.plot( df.values[:, 0]
37 , df.values[:,1:len(legends)+1]
38 , marker[kind]
39 #, color = "r"
40 )
41 plt.plot( df.values[:, 1]
42 , df.values[:,1:len(legends)+1]
43 , marker[kind]
44 #, color = "blue"
45 )
46 else:
47 plt.plot( df.values[:, 0]
48 , df.values[:,1:len(legends)+1]
49 , marker[kind]
50 #, color = "r"
51 )
52 ax.legend ( legends
53 , fontsize = fontsize
54 )
55
56 plt.xticks(fontsize = fontsize - 2)
57 plt.yticks(fontsize = fontsize - 2)
58 ax.set_xlabel(xlab[kind], fontsize = 17)
59 ax.set_ylabel("Luminosity Distance / Hubble Distance", fontsize = 17)
60 plt.grid(visible = True, which = "both", axis = "both", color = "0.85", linestyle = "-")
61 ax.tick_params(axis = "y", which = "minor")
62 ax.tick_params(axis = "x", which = "minor")
63 ax.set_xscale("log")
64 ax.set_yscale("log")
65
66 plt.savefig(fileList[0].replace(".txt",".png"))
67
68 elif len(fileList) > 1:
69
70 sys.exit("Ambiguous file list exists.")

Visualization of the example output
Test:
test_pm_cosmology
Todo:
High Priority: The origins of the glitch in the output of this algorithm at high redshifts (visible in the plots) must be investigated and corrected.


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, September 1, 2017, 12:00 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas Austin

Definition at line 2735 of file pm_cosmology.F90.


The documentation for this interface was generated from the following file: