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

Generate and return the square of the dimensionless Hubble Parameter \(E(z)^2 = \big(\frac{H(z)}{H_0}\big)^2\) for the default or the specified cosmological parameters.
More...

Detailed Description

Generate and return the square of the dimensionless Hubble Parameter \(E(z)^2 = \big(\frac{H(z)}{H_0}\big)^2\) for the default or the specified cosmological parameters.

Assuming \((\Omega_M, \Omega_\Lambda, \Omega_R, \Omega_K)\) 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 dimensionless Hubble Parameter at a given cosmological redshift \(z\) is defined as (Peebles, 1993, Principles of Physical Cosmology, pp 310-321),

\begin{equation} \large E(z) = \frac{H(z)}{H_0} = \sqrt{\Omega_R(1+z)^4 + \Omega_M(1+z)^3 + \Omega_K(1+z)^2 + \Omega_\Lambda} ~, \end{equation}

where \(H_0\) is the Hubble Constant.
Note that \(E(Z)\) is the time derivative of the logarithm of the scale factor \(a(t)\) of the Universe.

Parameters
[in]zplus1: The input scalar or array of the same rank as other array-like arguments, of type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128) representing the redshift plus one, \(\log(z+1)\), at which the square of the dimensionless Hubble Parameter 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 omegaR is also present.)
[in]omegaR: 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 radiation density in the universe.
(optional, default = OMEGA_R. It must be present if omegaK is also present.)
[in]omegaK: 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 curvature density of the universe.
(optional, default = OMEGA_K)
Returns
hubbleParamNormedSq : The output scalar or array of the same rank as other array-like arguments, of the same type and kind as the input argument zplus1 containing the square of the dimensionless Hubble Parameter at the desired redshift.


Possible calling interfaces

hubbleParamNormedSq = getHubbleParamNormedSq(zplus1)
hubbleParamNormedSq = getHubbleParamNormedSq(zplus1, omegaM, omegaL)
hubbleParamNormedSq = getHubbleParamNormedSq(zplus1, omegaM, omegaL, omegaR)
hubbleParamNormedSq = getHubbleParamNormedSq(zplus1, omegaM, omegaL, omegaR, omegaK)
Generate and return the square of the dimensionless Hubble Parameter for the default or the specifie...
This module contains procedures and generic interfaces and constants for cosmological calculations.
Warning
The condition omegaM + omegaL + omegaR + omegaK = 1 must hold in all circumstances.
The condition 1 <= zplus1 must hold in all circumstances.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1.
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.
Remarks
The procedures under discussion are elemental.
The complexity of the output value (instead of simply outputting the Hubble Parameter) is to ensure the highest computational efficiency of this and other dependent algorithms by minimizing the potentially redundant calculations.
Note
Dropping all optional arguments corresponds to the \(\Lambda\)CDM Universe with the latest experimental parameter inferences.
Note that omegaK (i.e., the spatial curvature density of the Universe) is defined as omegaK = 1 - omegaM - omegaL - omegaR.
However, it is requested explicitly in this
Setting omegaM = 1 and omegaL = 0 corresponds to the Einstein–de Sitter model of the universe proposed by Albert Einstein and Willem de Sitter in 1932.
See also
LOG_HUBBLE_CONST
HUBBLE_DISTANCE_MPC
HUBBLE_CONST
OMEGA_M
OMEGA_L
OMEGA_R
OMEGA_K


Example usage

1program example
2
3 use pm_kind, only: SK, IK, RKH ! All real kinds are supported.
5 use pm_io, only: display_type
6
7 implicit none
8
9 type(display_type) :: disp
10 disp = display_type(file = "main.out.F90")
11
12 call disp%skip()
13 call disp%show("getHubbleParamNormedSq(zplus1 = 1.1)")
14 call disp%show( getHubbleParamNormedSq(zplus1 = 1.1) )
15 call disp%skip()
16
17 call disp%skip()
18 call disp%show("getHubbleParamNormedSq(zplus1 = 1.1d0)")
19 call disp%show( getHubbleParamNormedSq(zplus1 = 1.1d0) )
20 call disp%skip()
21
22 call disp%skip()
23 call disp%show("getHubbleParamNormedSq(zplus1 = 1.1_RKH)")
24 call disp%show( getHubbleParamNormedSq(zplus1 = 1.1_RKH) )
25 call disp%skip()
26
27 call disp%skip()
28 call disp%show("getHubbleParamNormedSq(zplus1 = [real :: 1, 2, 3, 4])")
29 call disp%show( getHubbleParamNormedSq(zplus1 = [real :: 1, 2, 3, 4]) )
30 call disp%skip()
31
32 call disp%skip()
33 call disp%show("getHubbleParamNormedSq(zplus1 = [real :: 1, 2, 3, 4], omegaM = 0.3, omegaL = 0.7)")
34 call disp%show( getHubbleParamNormedSq(zplus1 = [real :: 1, 2, 3, 4], omegaM = 0.3, omegaL = 0.7) )
35 call disp%skip()
36
37 call disp%skip()
38 call disp%show("getHubbleParamNormedSq(zplus1 = [real :: 1, 2, 3, 4], omegaM = 0.3, omegaL = 0.5, omegaR = 0.2)")
39 call disp%show( getHubbleParamNormedSq(zplus1 = [real :: 1, 2, 3, 4], omegaM = 0.3, omegaL = 0.5, omegaR = 0.2) )
40 call disp%skip()
41
42 call disp%skip()
43 call disp%show("getHubbleParamNormedSq(zplus1 = [real :: 1, 2, 3, 4], omegaM = 0.3, omegaL = 0.5, omegaR = 0.1, omegaK = 0.1)")
44 call disp%show( getHubbleParamNormedSq(zplus1 = [real :: 1, 2, 3, 4], omegaM = 0.3, omegaL = 0.5, omegaR = 0.1, omegaK = 0.1) )
45 call disp%skip()
46
47 ! Visualize the Hubble Parameter.
48
49 block
50
51 use pm_cosmology, only: HUBBLE_CONST
52 use pm_arraySpace, only: getLogSpace
53
54 integer(IK) , parameter :: NP = 1000_IK
55 real :: zplus1(NP)
56 integer(IK) :: i, fileUnit
57
58 open(newunit = fileUnit, file = "getHubbleParamNormedSq.RK.txt")
59 zplus1 = getLogSpace(logx1 = log(1.), logx2 = log(10.), count = NP)
60 do i = 1_IK, size(zplus1, 1, IK)
61 write(fileUnit, "(*(g0,:,', '))") zplus1(i) &
62 , real(HUBBLE_CONST) * sqrt(getHubbleParamNormedSq(zplus1(i))) &
63 , real(HUBBLE_CONST) * sqrt(getHubbleParamNormedSq(zplus1(i), 1.0, 0.0)) &
64 , real(HUBBLE_CONST) * sqrt(getHubbleParamNormedSq(zplus1(i), 0.0, 1.0)) &
65 , real(HUBBLE_CONST) * sqrt(getHubbleParamNormedSq(zplus1(i), .30, .30, .40)) &
66 , real(HUBBLE_CONST) * sqrt(getHubbleParamNormedSq(zplus1(i), .25, .25, .25, .25))
67 end do
68 close(fileUnit)
69
70 end block
71
72end program example
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
This module contains procedures and generic interfaces for generating arrays with linear or logarithm...
real(RKB), parameter HUBBLE_CONST
The scalar real constant of kind with highest available precision RKB representing the Hubble constan...
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
integer, parameter RKH
The scalar integer constant of intrinsic default kind, representing the highest-precision real kind t...
Definition: pm_kind.F90:858
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
2getHubbleParamNormedSq(zplus1 = 1.1)
3+1.10260999
4
5
6getHubbleParamNormedSq(zplus1 = 1.1d0)
7+1.1026100000000001
8
9
10getHubbleParamNormedSq(zplus1 = 1.1_RKH)
11+1.10260999999999999999999999999999999
12
13
14getHubbleParamNormedSq(zplus1 = [real :: 1, 2, 3, 4])
15+1.00000000, +3.17000008, +9.05999947, +20.5300007
16
17
18getHubbleParamNormedSq(zplus1 = [real :: 1, 2, 3, 4], omegaM = 0.3, omegaL = 0.7)
19+1.00000000, +3.10000014, +8.80000019, +19.9000015
20
21
22getHubbleParamNormedSq(zplus1 = [real :: 1, 2, 3, 4], omegaM = 0.3, omegaL = 0.5, omegaR = 0.2)
23+1.00000000, +6.10000038, +24.8000011, +70.9000015
24
25
26getHubbleParamNormedSq(zplus1 = [real :: 1, 2, 3, 4], omegaM = 0.3, omegaL = 0.5, omegaR = 0.1, omegaK = 0.1)
27+1.00000000, +4.90000010, +17.6000004, +46.9000015
28
29

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
9linewidth = 2
10fontsize = 17
11
12marker ={ "CK" : "-"
13 , "IK" : "."
14 , "RK" : "-"
15 }
16xlab = { "CK" : "redshift: z ( real/imaginary components )"
17 , "IK" : "redshift: z ( integer-valued )"
18 , "RK" : "redshift: z ( real-valued )"
19 }
20legends = [ r"$(\Omega_M, \Omega_\Lambda, \Omega_R, \Omega_K) = (0.3, 0.7, 0.0, 0.0)$"
21 , r"$(\Omega_M, \Omega_\Lambda, \Omega_R, \Omega_K) = (1.0, 0.0, 0.0, 0.0)$"
22 , r"$(\Omega_M, \Omega_\Lambda, \Omega_R, \Omega_K) = (0.0, 1.0, 0.0, 0.0)$"
23 , r"$(\Omega_M, \Omega_\Lambda, \Omega_R, \Omega_K) = (.30, .30, .40, 0.0)$"
24 , r"$(\Omega_M, \Omega_\Lambda, \Omega_R, \Omega_K) = (.25, .25, .25, .25)$"
25 ]
26
27for kind in ["IK", "CK", "RK"]:
28
29 pattern = "*." + kind + ".txt"
30 fileList = glob.glob(pattern)
31 if len(fileList) == 1:
32
33 df = pd.read_csv(fileList[0], delimiter = ", ")
34
35 fig = plt.figure(figsize = 1.25 * np.array([6.4, 4.8]), dpi = 200)
36 ax = plt.subplot()
37
38 if kind == "CK":
39 plt.plot( df.values[:, 0] - 1
40 , df.values[:,1:6]
41 , marker[kind]
42 , linewidth = linewidth
43 #, color = "r"
44 )
45 plt.plot( df.values[:, 1] - 1
46 , df.values[:,1:6]
47 , marker[kind]
48 , linewidth = linewidth
49 #, color = "blue"
50 )
51 else:
52 plt.plot( df.values[:, 0] - 1
53 , df.values[:,1:6]
54 , marker[kind]
55 , linewidth = linewidth
56 #, color = "r"
57 )
58 ax.legend ( legends
59 , fontsize = fontsize
60 )
61
62 plt.xticks(fontsize = fontsize - 2)
63 plt.yticks(fontsize = fontsize - 2)
64 ax.set_xlabel(xlab[kind], fontsize = 17)
65 ax.set_ylabel("The Hubble Parameter [km / s / Mpc]", fontsize = 17)
66 #ax.set_xlim([0.0, 5])
67 #ax.set_ylim([0.05, 0.5])
68 #ax.set_xscale("log")
69 ax.set_yscale("log")
70
71 plt.grid(visible = True, which = "both", axis = "both", color = "0.85", linestyle = "-")
72 ax.tick_params(axis = "y", which = "minor")
73 ax.tick_params(axis = "x", which = "minor")
74
75 plt.tight_layout()
76 plt.savefig(fileList[0].replace(".txt",".png"))
77
78 elif len(fileList) > 1:
79
80 sys.exit("Ambiguous file list exists.")

Visualization of the example output
Test:
test_pm_cosmology


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, Wednesday 5:43 PM, December 25, 2013, Institute for Fusion Studies, The University of Texas Austin

Definition at line 2963 of file pm_cosmology.F90.


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