The ParaMonte Documentation Website
Current view: top level - kernel/tests - Test_StarFormation_mod.f90 (source / functions) Hit Total Coverage
Test: ParaMonte 1.5.1 :: MPI Parallel Kernel - Code Coverage Report Lines: 177 177 100.0 %
Date: 2021-01-08 13:07:16 Functions: 21 21 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       2             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       3             : !!!!
       4             : !!!!   MIT License
       5             : !!!!
       6             : !!!!   ParaMonte: plain powerful parallel Monte Carlo library.
       7             : !!!!
       8             : !!!!   Copyright (C) 2012-present, The Computational Data Science Lab
       9             : !!!!
      10             : !!!!   This file is part of the ParaMonte library.
      11             : !!!!
      12             : !!!!   Permission is hereby granted, free of charge, to any person obtaining a
      13             : !!!!   copy of this software and associated documentation files (the "Software"),
      14             : !!!!   to deal in the Software without restriction, including without limitation
      15             : !!!!   the rights to use, copy, modify, merge, publish, distribute, sublicense,
      16             : !!!!   and/or sell copies of the Software, and to permit persons to whom the
      17             : !!!!   Software is furnished to do so, subject to the following conditions:
      18             : !!!!
      19             : !!!!   The above copyright notice and this permission notice shall be
      20             : !!!!   included in all copies or substantial portions of the Software.
      21             : !!!!
      22             : !!!!   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
      23             : !!!!   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
      24             : !!!!   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
      25             : !!!!   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
      26             : !!!!   DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
      27             : !!!!   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
      28             : !!!!   OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
      29             : !!!!
      30             : !!!!   ACKNOWLEDGMENT
      31             : !!!!
      32             : !!!!   ParaMonte is an honor-ware and its currency is acknowledgment and citations.
      33             : !!!!   As per the ParaMonte library license agreement terms, if you use any parts of
      34             : !!!!   this library for any purposes, kindly acknowledge the use of ParaMonte in your
      35             : !!!!   work (education/research/industry/development/...) by citing the ParaMonte
      36             : !!!!   library as described on this page:
      37             : !!!!
      38             : !!!!       https://github.com/cdslaborg/paramonte/blob/main/ACKNOWLEDGMENT.md
      39             : !!!!
      40             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      41             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      42             : 
      43             : !>  \brief This module contains tests of the module [StarFormation_mod](@ref starformation_mod).
      44             : !>  \author Amir Shahmoradi
      45             : 
      46             : module Test_StarFormation_mod
      47             : 
      48             :     use StarFormation_mod
      49             :     use Err_mod, only: Err_type
      50             :     use Test_mod, only: Test_type
      51             :     implicit none
      52             : 
      53             :     private
      54             :     public :: test_StarFormation
      55             : 
      56             :     type(Test_type) :: Test
      57             : 
      58             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      59             : 
      60             : contains
      61             : 
      62             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      63             : 
      64           3 :     subroutine test_StarFormation()
      65             :         implicit none
      66           3 :         Test = Test_type(moduleName=MODULE_NAME)
      67           3 :         call Test%run(test_getLogRateH06, "test_getLogRateH06")
      68           3 :         call Test%run(test_getLogRateL08, "test_getLogRateL08")
      69           3 :         call Test%run(test_getLogRateB10, "test_getLogRateB10")
      70           3 :         call Test%run(test_getLogRateM14, "test_getLogRateM14")
      71           3 :         call Test%run(test_getLogRateP15, "test_getLogRateP15")
      72           3 :         call Test%run(test_getLogRateM17, "test_getLogRateM17")
      73           3 :         call Test%run(test_getLogRateF18, "test_getLogRateF18")
      74           3 :         call Test%run(test_getBinaryMergerRate_1, "test_getBinaryMergerRate_1") ! The internal function passing as actual argument causes segfault with Gfortran (any version) on Windows subsystem for Linux.
      75           3 :         call Test%run(test_getBinaryMergerRate_2, "test_getBinaryMergerRate_2") ! The internal function passing as actual argument causes segfault with Gfortran (any version) on Windows subsystem for Linux.
      76           3 :         call Test%run(test_getBinaryMergerRateS15_1, "test_getBinaryMergerRateS15_1")
      77           3 :         call Test%run(test_getBinaryMergerRateS15_2, "test_getBinaryMergerRateS15_2")
      78           3 :         call Test%run(test_getBinaryMergerRateS15_3, "test_getBinaryMergerRateS15_3")
      79           3 :         call Test%run(test_getBinaryMergerRateS15_4, "test_getBinaryMergerRateS15_4")
      80           3 :         call Test%run(test_getLogBinaryMergerRateLognormH06_1, "test_getLogBinaryMergerRateLognormH06_1")
      81           3 :         call Test%run(test_getLogBinaryMergerRateLognormL08_1, "test_getLogBinaryMergerRateLognormL08_1")
      82           3 :         call Test%run(test_getLogBinaryMergerRateLognormB10_1, "test_getLogBinaryMergerRateLognormB10_1")
      83           3 :         call Test%run(test_getLogBinaryMergerRateLognormM14_1, "test_getLogBinaryMergerRateLognormM14_1")
      84           3 :         call Test%run(test_getLogBinaryMergerRateLognormM17_1, "test_getLogBinaryMergerRateLognormM17_1")
      85           3 :         call Test%run(test_getLogBinaryMergerRateLognormF18_1, "test_getLogBinaryMergerRateLognormF18_1")
      86           3 :         call Test%finalize()
      87           3 :     end subroutine test_StarFormation
      88             : 
      89             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      90             : 
      91           3 :     function test_getLogRateH06() result(assertion)
      92             : 
      93           3 :         use Cosmology_mod, only: getLogLumDisWicMpc
      94             :         use Constants_mod, only: RK, IK
      95             : 
      96             :         implicit none
      97             : 
      98             :         logical :: assertion
      99             :         real(RK), parameter :: zplus1 = 1.e1_RK
     100             :         real(RK), parameter :: logzplus1 = log(zplus1)
     101             :         real(RK), parameter :: logRate_ref = 9.87062241049176_RK
     102             :         real(RK), parameter :: tolerance = 1.e-10_RK
     103           3 :         real(RK)            :: difference
     104           3 :         real(RK)            :: logRate
     105             : 
     106           3 :         logRate = getLogRateH06( zplus1 = zplus1, logzplus1 = logzplus1, twiceLogLumDisMpc = getLogLumDisWicMpc(zplus1) )
     107           3 :         difference = abs( (logRate - logRate_ref) / logRate_ref )
     108           3 :         assertion = difference < tolerance
     109             : 
     110             :         ! LCOV_EXCL_START
     111             :         if (Test%isDebugMode .and. .not. assertion) then
     112             :             write(Test%outputUnit,"(*(g0,:,' '))")
     113             :             write(Test%outputUnit,"(*(g0,:,' '))") "logRate_ref   = ", logRate_ref
     114             :             write(Test%outputUnit,"(*(g0,:,' '))") "logRate       = ", logRate
     115             :             write(Test%outputUnit,"(*(g0,:,' '))") "difference    = ", difference
     116             :             write(Test%outputUnit,"(*(g0,:,' '))")
     117             :         end if
     118             :         ! LCOV_EXCL_STOP
     119             : 
     120           3 :     end function test_getLogRateH06
     121             : 
     122             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     123             : 
     124           3 :     function test_getLogRateL08() result(assertion)
     125             : 
     126           3 :         use Cosmology_mod, only: getLogLumDisWicMpc
     127             :         use Constants_mod, only: RK, IK
     128             : 
     129             :         implicit none
     130             : 
     131             :         logical :: assertion
     132             :         real(RK), parameter :: zplus1 = 1.e1_RK
     133             :         real(RK), parameter :: logzplus1 = log(zplus1)
     134             :         real(RK), parameter :: logRate_ref = 11.5870199718159_RK
     135             :         real(RK), parameter :: tolerance = 1.e-10_RK
     136           3 :         real(RK)            :: difference
     137           3 :         real(RK)            :: logRate
     138             : 
     139           3 :         logRate = getLogRateL08( zplus1 = zplus1, logzplus1 = logzplus1, twiceLogLumDisMpc = getLogLumDisWicMpc(zplus1) )
     140           3 :         difference = abs( (logRate - logRate_ref) / logRate_ref )
     141           3 :         assertion = difference < tolerance
     142             : 
     143             :         ! LCOV_EXCL_START
     144             :         if (Test%isDebugMode .and. .not. assertion) then
     145             :             write(Test%outputUnit,"(*(g0,:,' '))")
     146             :             write(Test%outputUnit,"(*(g0,:,' '))") "logRate_ref   = ", logRate_ref
     147             :             write(Test%outputUnit,"(*(g0,:,' '))") "logRate       = ", logRate
     148             :             write(Test%outputUnit,"(*(g0,:,' '))") "difference    = ", difference
     149             :             write(Test%outputUnit,"(*(g0,:,' '))")
     150             :         end if
     151             :         ! LCOV_EXCL_STOP
     152             : 
     153           3 :     end function test_getLogRateL08
     154             : 
     155             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     156             : 
     157           3 :     function test_getLogRateB10() result(assertion)
     158             : 
     159           3 :         use Cosmology_mod, only: getLogLumDisWicMpc
     160             :         use Constants_mod, only: RK, IK
     161             : 
     162             :         implicit none
     163             : 
     164             :         logical :: assertion
     165             :         real(RK), parameter :: zplus1 = 1.e1_RK
     166             :         real(RK), parameter :: logzplus1 = log(zplus1)
     167             :         real(RK), parameter :: logRate_ref = 13.9081968356527_RK
     168             :         real(RK), parameter :: tolerance = 1.e-10_RK
     169           3 :         real(RK)            :: difference
     170           3 :         real(RK)            :: logRate
     171             : 
     172           3 :         logRate = getLogRateB10( zplus1 = zplus1, logzplus1 = logzplus1, twiceLogLumDisMpc = getLogLumDisWicMpc(zplus1) )
     173           3 :         difference = abs( (logRate - logRate_ref) / logRate_ref )
     174           3 :         assertion = difference < tolerance
     175             : 
     176             :         ! LCOV_EXCL_START
     177             :         if (Test%isDebugMode .and. .not. assertion) then
     178             :             write(Test%outputUnit,"(*(g0,:,' '))")
     179             :             write(Test%outputUnit,"(*(g0,:,' '))") "logRate_ref   = ", logRate_ref
     180             :             write(Test%outputUnit,"(*(g0,:,' '))") "logRate       = ", logRate
     181             :             write(Test%outputUnit,"(*(g0,:,' '))") "difference    = ", difference
     182             :             write(Test%outputUnit,"(*(g0,:,' '))")
     183             :         end if
     184             :         ! LCOV_EXCL_STOP
     185             : 
     186           3 :     end function test_getLogRateB10
     187             : 
     188             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     189             : 
     190           3 :     function test_getLogRateM14() result(assertion)
     191             : 
     192           3 :         use Cosmology_mod, only: getLogLumDisWicMpc
     193             :         use Constants_mod, only: RK, IK
     194             : 
     195             :         implicit none
     196             : 
     197             :         logical :: assertion
     198             :         real(RK), parameter :: zplus1 = 1.e1_RK
     199             :         real(RK), parameter :: logzplus1 = log(zplus1)
     200             :         real(RK), parameter :: logRate_ref = 7.62065413866848_RK
     201             :         real(RK), parameter :: tolerance = 1.e-10_RK
     202           3 :         real(RK)            :: difference
     203           3 :         real(RK)            :: logRate
     204             : 
     205           3 :         logRate = getLogRateM14( zplus1 = zplus1, logzplus1 = logzplus1, twiceLogLumDisMpc = getLogLumDisWicMpc(zplus1) )
     206           3 :         difference = abs( (logRate - logRate_ref) / logRate_ref )
     207           3 :         assertion = difference < tolerance
     208             : 
     209             :         ! LCOV_EXCL_START
     210             :         if (Test%isDebugMode .and. .not. assertion) then
     211             :             write(Test%outputUnit,"(*(g0,:,' '))")
     212             :             write(Test%outputUnit,"(*(g0,:,' '))") "logRate_ref   = ", logRate_ref
     213             :             write(Test%outputUnit,"(*(g0,:,' '))") "logRate       = ", logRate
     214             :             write(Test%outputUnit,"(*(g0,:,' '))") "difference    = ", difference
     215             :             write(Test%outputUnit,"(*(g0,:,' '))")
     216             :         end if
     217             :         ! LCOV_EXCL_STOP
     218             : 
     219           3 :     end function test_getLogRateM14
     220             : 
     221             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     222             : 
     223           3 :     function test_getLogRateP15() result(assertion)
     224             : 
     225           3 :         use Cosmology_mod, only: getLogLumDisWicMpc
     226             :         use Constants_mod, only: RK, IK
     227             : 
     228             :         implicit none
     229             : 
     230             :         logical :: assertion
     231             :         real(RK), parameter :: zplus1 = 1.e1_RK
     232             :         real(RK), parameter :: logzplus1 = log(zplus1)
     233             :         real(RK), parameter :: logRate_ref = 7.87332272998867_RK
     234             :         real(RK), parameter :: tolerance = 1.e-10_RK
     235           3 :         real(RK)            :: difference
     236           3 :         real(RK)            :: logRate
     237             : 
     238           3 :         logRate = getLogRateP15( zplus1 = zplus1, logzplus1 = logzplus1, twiceLogLumDisMpc = getLogLumDisWicMpc(zplus1) )
     239           3 :         difference = abs( (logRate - logRate_ref) / logRate_ref )
     240           3 :         assertion = difference < tolerance
     241             : 
     242             :         ! LCOV_EXCL_START
     243             :         if (Test%isDebugMode .and. .not. assertion) then
     244             :             write(Test%outputUnit,"(*(g0,:,' '))")
     245             :             write(Test%outputUnit,"(*(g0,:,' '))") "logRate_ref   = ", logRate_ref
     246             :             write(Test%outputUnit,"(*(g0,:,' '))") "logRate       = ", logRate
     247             :             write(Test%outputUnit,"(*(g0,:,' '))") "difference    = ", difference
     248             :             write(Test%outputUnit,"(*(g0,:,' '))")
     249             :         end if
     250             :         ! LCOV_EXCL_STOP
     251             : 
     252           3 :     end function test_getLogRateP15
     253             : 
     254             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     255             : 
     256           3 :     function test_getLogRateM17() result(assertion)
     257             : 
     258           3 :         use Cosmology_mod, only: getLogLumDisWicMpc
     259             :         use Constants_mod, only: RK, IK
     260             : 
     261             :         implicit none
     262             : 
     263             :         logical :: assertion
     264             :         real(RK), parameter :: zplus1 = 1.e1_RK
     265             :         real(RK), parameter :: logzplus1 = log(zplus1)
     266             :         real(RK), parameter :: logRate_ref = 6.85265527251550_RK
     267             :         real(RK), parameter :: tolerance = 1.e-10_RK
     268           3 :         real(RK)            :: difference
     269           3 :         real(RK)            :: logRate
     270             : 
     271           3 :         logRate = getLogRateM17( zplus1 = zplus1, logzplus1 = logzplus1, twiceLogLumDisMpc = getLogLumDisWicMpc(zplus1) )
     272           3 :         difference = abs( (logRate - logRate_ref) / logRate_ref )
     273           3 :         assertion = difference < tolerance
     274             : 
     275             :         ! LCOV_EXCL_START
     276             :         if (Test%isDebugMode .and. .not. assertion) then
     277             :             write(Test%outputUnit,"(*(g0,:,' '))")
     278             :             write(Test%outputUnit,"(*(g0,:,' '))") "logRate_ref   = ", logRate_ref
     279             :             write(Test%outputUnit,"(*(g0,:,' '))") "logRate       = ", logRate
     280             :             write(Test%outputUnit,"(*(g0,:,' '))") "difference    = ", difference
     281             :             write(Test%outputUnit,"(*(g0,:,' '))")
     282             :         end if
     283             :         ! LCOV_EXCL_STOP
     284             : 
     285           3 :     end function test_getLogRateM17
     286             : 
     287             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     288             : 
     289           3 :     function test_getLogRateF18() result(assertion)
     290             : 
     291           3 :         use Cosmology_mod, only: getLogLumDisWicMpc
     292             :         use Constants_mod, only: RK, IK
     293             : 
     294             :         implicit none
     295             : 
     296             :         logical :: assertion
     297             :         real(RK), parameter :: zplus1 = 1.e1_RK
     298             :         real(RK), parameter :: logzplus1 = log(zplus1)
     299             :         real(RK), parameter :: logRate_ref = 6.81074639841109_RK
     300             :         real(RK), parameter :: tolerance = 1.e-10_RK
     301           3 :         real(RK)            :: difference
     302           3 :         real(RK)            :: logRate
     303             : 
     304           3 :         logRate = getLogRateF18( zplus1 = zplus1, logzplus1 = logzplus1, twiceLogLumDisMpc = getLogLumDisWicMpc(zplus1) )
     305           3 :         difference = abs( (logRate - logRate_ref) / logRate_ref )
     306           3 :         assertion = difference < tolerance
     307             : 
     308             :         ! LCOV_EXCL_START
     309             :         if (Test%isDebugMode .and. .not. assertion) then
     310             :             write(Test%outputUnit,"(*(g0,:,' '))")
     311             :             write(Test%outputUnit,"(*(g0,:,' '))") "logRate_ref   = ", logRate_ref
     312             :             write(Test%outputUnit,"(*(g0,:,' '))") "logRate       = ", logRate
     313             :             write(Test%outputUnit,"(*(g0,:,' '))") "difference    = ", difference
     314             :             write(Test%outputUnit,"(*(g0,:,' '))")
     315             :         end if
     316             :         ! LCOV_EXCL_STOP
     317             : 
     318           3 :     end function test_getLogRateF18
     319             : 
     320             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     321             : 
     322           3 :     function test_getBinaryMergerRateS15_1() result(assertion)
     323             : 
     324           3 :         use Constants_mod, only: RK
     325             : 
     326             :         implicit none
     327             : 
     328             :         logical :: assertion
     329             :         real(RK)    , parameter :: z = 1.e-2_RK
     330             :         real(RK)    , parameter :: tolerance = 1.e-10_RK
     331             :         real(RK)    , parameter :: binaryMergerRateS15_ref = .000000000000000_RK
     332           3 :         real(RK)                :: binaryMergerRateS15
     333           3 :         real(RK)                :: difference
     334             : 
     335           3 :         binaryMergerRateS15 = getBinaryMergerRateS15(z)
     336             : 
     337           3 :         difference = abs(binaryMergerRateS15 - binaryMergerRateS15_ref)
     338           3 :         assertion = difference < tolerance
     339             : 
     340             :         ! LCOV_EXCL_START
     341             :         if (Test%isDebugMode .and. .not. assertion) then
     342             :             write(Test%outputUnit,"(*(g0,:,' '))")
     343             :             write(Test%outputUnit,"(*(g0,:,' '))") "binaryMergerRateS15_ref    =", binaryMergerRateS15_ref
     344             :             write(Test%outputUnit,"(*(g0,:,' '))") "binaryMergerRateS15        =", binaryMergerRateS15
     345             :             write(Test%outputUnit,"(*(g0,:,' '))") "difference                 =", difference
     346             :             write(Test%outputUnit,"(*(g0,:,' '))")
     347             :         end if
     348             :         ! LCOV_EXCL_STOP
     349             : 
     350           3 :     end function test_getBinaryMergerRateS15_1
     351             : 
     352             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     353             : 
     354           3 :     function test_getBinaryMergerRateS15_2() result(assertion)
     355             : 
     356           3 :         use Constants_mod, only: RK
     357             : 
     358             :         implicit none
     359             : 
     360             :         logical :: assertion
     361             :         real(RK)    , parameter :: z = 2._RK
     362             :         real(RK)    , parameter :: tolerance = 1.e-10_RK
     363             :         real(RK)    , parameter :: binaryMergerRateS15_ref = .1242102965042102E-01_RK
     364           3 :         real(RK)                :: binaryMergerRateS15
     365           3 :         real(RK)                :: difference
     366             : 
     367           3 :         binaryMergerRateS15 = getBinaryMergerRateS15(z)
     368             : 
     369           3 :         difference = abs( (binaryMergerRateS15 - binaryMergerRateS15_ref) / binaryMergerRateS15_ref )
     370           3 :         assertion = difference < tolerance
     371             : 
     372             :         ! LCOV_EXCL_START
     373             :         if (Test%isDebugMode .and. .not. assertion) then
     374             :             write(Test%outputUnit,"(*(g0,:,' '))")
     375             :             write(Test%outputUnit,"(*(g0,:,' '))") "binaryMergerRateS15_ref    =", binaryMergerRateS15_ref
     376             :             write(Test%outputUnit,"(*(g0,:,' '))") "binaryMergerRateS15        =", binaryMergerRateS15
     377             :             write(Test%outputUnit,"(*(g0,:,' '))") "difference                 =", difference
     378             :             write(Test%outputUnit,"(*(g0,:,' '))")
     379             :         end if
     380             :         ! LCOV_EXCL_STOP
     381             : 
     382           3 :     end function test_getBinaryMergerRateS15_2
     383             : 
     384             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     385             : 
     386           3 :     function test_getBinaryMergerRateS15_3() result(assertion)
     387             : 
     388           3 :         use Constants_mod, only: RK
     389             : 
     390             :         implicit none
     391             : 
     392             :         logical :: assertion
     393             :         real(RK)    , parameter :: z = 4._RK
     394             :         real(RK)    , parameter :: tolerance = 1.e-10_RK
     395             :         real(RK)    , parameter :: binaryMergerRateS15_ref = .2658922023902166E-02_RK
     396           3 :         real(RK)                :: binaryMergerRateS15
     397           3 :         real(RK)                :: difference
     398             : 
     399           3 :         binaryMergerRateS15 = getBinaryMergerRateS15(z)
     400             : 
     401           3 :         difference = abs( (binaryMergerRateS15 - binaryMergerRateS15_ref) / binaryMergerRateS15_ref )
     402           3 :         assertion = difference < tolerance
     403             : 
     404             :         ! LCOV_EXCL_START
     405             :         if (Test%isDebugMode .and. .not. assertion) then
     406             :             write(Test%outputUnit,"(*(g0,:,' '))")
     407             :             write(Test%outputUnit,"(*(g0,:,' '))") "binaryMergerRateS15_ref    =", binaryMergerRateS15_ref
     408             :             write(Test%outputUnit,"(*(g0,:,' '))") "binaryMergerRateS15        =", binaryMergerRateS15
     409             :             write(Test%outputUnit,"(*(g0,:,' '))") "difference                 =", difference
     410             :             write(Test%outputUnit,"(*(g0,:,' '))")
     411             :         end if
     412             :         ! LCOV_EXCL_STOP
     413             : 
     414           3 :     end function test_getBinaryMergerRateS15_3
     415             : 
     416             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     417             : 
     418           3 :     function test_getBinaryMergerRateS15_4() result(assertion)
     419             : 
     420           3 :         use Constants_mod, only: RK
     421             : 
     422             :         implicit none
     423             : 
     424             :         logical :: assertion
     425             :         real(RK)    , parameter :: z = 10._RK
     426             :         real(RK)    , parameter :: tolerance = 1.e-10_RK
     427             :         real(RK)    , parameter :: binaryMergerRateS15_ref = 0._RK
     428           3 :         real(RK)                :: binaryMergerRateS15
     429           3 :         real(RK)                :: difference
     430             : 
     431           3 :         binaryMergerRateS15 = getBinaryMergerRateS15(z)
     432             : 
     433           3 :         difference = abs(binaryMergerRateS15 - binaryMergerRateS15_ref)
     434           3 :         assertion = difference < tolerance
     435             : 
     436             :         ! LCOV_EXCL_START
     437             :         if (Test%isDebugMode .and. .not. assertion) then
     438             :             write(Test%outputUnit,"(*(g0,:,' '))")
     439             :             write(Test%outputUnit,"(*(g0,:,' '))") "binaryMergerRateS15_ref    =", binaryMergerRateS15_ref
     440             :             write(Test%outputUnit,"(*(g0,:,' '))") "binaryMergerRateS15        =", binaryMergerRateS15
     441             :             write(Test%outputUnit,"(*(g0,:,' '))") "difference                 =", difference
     442             :             write(Test%outputUnit,"(*(g0,:,' '))")
     443             :         end if
     444             :         ! LCOV_EXCL_STOP
     445             : 
     446           3 :     end function test_getBinaryMergerRateS15_4
     447             : 
     448             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     449             : 
     450           3 :     function test_getLogBinaryMergerRateLognormH06_1() result(assertion)
     451             : 
     452           3 :         use Constants_mod, only: RK, IK
     453             : 
     454             :         implicit none
     455             : 
     456             :         logical                     :: assertion
     457             :         integer(IK)                 :: i
     458             :         real(RK)    , parameter     :: Logzplus1(*) = [0.01_RK, 0.1_RK, 0.5_RK, 1._RK, 1.6_RK, 2._RK, 4._RK]
     459             :         real(RK)    , parameter     :: tolerance = 1.e-10_RK
     460             :         real(RK)    , parameter     :: LogBinaryMergerRate_ref(*) = [ .000000000000000_RK &
     461             :                                                                     , -9.522643068294865_RK &
     462             :                                                                     , -5.516405042254531_RK &
     463             :                                                                     , -4.774988408220006_RK &
     464             :                                                                     , -5.693972784881680_RK &
     465             :                                                                     , -9.316295406531074_RK &
     466             :                                                                     , .000000000000000_RK &
     467             :                                                                     ]
     468             :         real(RK)                    :: LogBinaryMergerRate(size(Logzplus1))
     469             :         real(RK)                    :: Difference(size(Logzplus1))
     470             : 
     471          24 :         do i = 1, size(Logzplus1)
     472          24 :             LogBinaryMergerRate(i) = getLogBinaryMergerRateLognormH06(logzplus1 = Logzplus1(i))
     473             :         end do
     474             : 
     475          24 :         Difference = abs(LogBinaryMergerRate - LogBinaryMergerRate_ref)
     476          24 :         assertion = all(Difference < tolerance)
     477             : 
     478             :         ! LCOV_EXCL_START
     479             :         if (Test%isDebugMode .and. .not. assertion) then
     480             :             write(Test%outputUnit,"(*(g0,:,' '))")
     481             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate_ref    =", LogBinaryMergerRate_ref
     482             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate        =", LogBinaryMergerRate
     483             :             write(Test%outputUnit,"(*(g0,:,' '))") "Difference                 =", Difference
     484             :             write(Test%outputUnit,"(*(g0,:,' '))")
     485             :         end if
     486             :         ! LCOV_EXCL_STOP
     487             : 
     488           3 :     end function test_getLogBinaryMergerRateLognormH06_1
     489             : 
     490             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     491             : 
     492           3 :     function test_getLogBinaryMergerRateLognormL08_1() result(assertion)
     493             : 
     494           3 :         use Constants_mod, only: RK, IK
     495             : 
     496             :         implicit none
     497             : 
     498             :         logical                     :: assertion
     499             :         integer(IK)                 :: i
     500             :         real(RK)    , parameter     :: Logzplus1(*) = [0.01_RK, 0.1_RK, 0.5_RK, 1._RK, 1.5_RK, 2._RK, 4._RK]
     501             :         real(RK)    , parameter     :: tolerance = 1.e-10_RK
     502             :         real(RK)    , parameter     :: LogBinaryMergerRate_ref(*) = [ .000000000000000_RK &
     503             :                                                                     , -9.652689811083633_RK &
     504             :                                                                     , -5.676407092361923_RK &
     505             :                                                                     , -4.791335056013564_RK &
     506             :                                                                     , -5.330328192868819_RK &
     507             :                                                                     , -8.471291899297817_RK &
     508             :                                                                     , .000000000000000_RK &
     509             :                                                                     ]
     510             :         real(RK)                    :: LogBinaryMergerRate(size(Logzplus1))
     511             :         real(RK)                    :: Difference(size(Logzplus1))
     512             : 
     513          24 :         do i = 1, size(Logzplus1)
     514          24 :             LogBinaryMergerRate(i) = getLogBinaryMergerRateLognormL08(logzplus1 = Logzplus1(i))
     515             :         end do
     516             : 
     517          24 :         Difference = abs(LogBinaryMergerRate - LogBinaryMergerRate_ref)
     518          24 :         assertion = all(Difference < tolerance)
     519             : 
     520             :         ! LCOV_EXCL_START
     521             :         if (Test%isDebugMode .and. .not. assertion) then
     522             :             write(Test%outputUnit,"(*(g0,:,' '))")
     523             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate_ref    =", LogBinaryMergerRate_ref
     524             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate        =", LogBinaryMergerRate
     525             :             write(Test%outputUnit,"(*(g0,:,' '))") "Difference                 =", Difference
     526             :             write(Test%outputUnit,"(*(g0,:,' '))")
     527             :         end if
     528             :         ! LCOV_EXCL_STOP
     529             : 
     530           3 :     end function test_getLogBinaryMergerRateLognormL08_1
     531             : 
     532             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     533             : 
     534           3 :     function test_getLogBinaryMergerRateLognormB10_1() result(assertion)
     535             : 
     536           3 :         use Constants_mod, only: RK, IK
     537             : 
     538             :         implicit none
     539             : 
     540             :         logical                     :: assertion
     541             :         integer(IK)                 :: i
     542             :         real(RK)    , parameter     :: Logzplus1(*) = [0.01_RK, 0.1_RK, 0.5_RK, 1._RK, 1.5_RK, 2._RK, 4._RK]
     543             :         real(RK)    , parameter     :: tolerance = 1.e-10_RK
     544             :         real(RK)    , parameter     :: LogBinaryMergerRate_ref(*) = [ .000000000000000_RK &
     545             :                                                                     , -10.40986473440980_RK &
     546             :                                                                     , -6.500787335196973_RK &
     547             :                                                                     , -5.213677851636544_RK &
     548             :                                                                     , -5.042789011502691_RK &
     549             :                                                                     , -7.221407286252206_RK &
     550             :                                                                     , .000000000000000_RK &
     551             :                                                                     ]
     552             :         real(RK)                    :: LogBinaryMergerRate(size(Logzplus1))
     553             :         real(RK)                    :: Difference(size(Logzplus1))
     554             : 
     555          24 :         do i = 1, size(Logzplus1)
     556          24 :             LogBinaryMergerRate(i) = getLogBinaryMergerRateLognormB10(logzplus1 = Logzplus1(i))
     557             :         end do
     558             : 
     559          24 :         Difference = abs(LogBinaryMergerRate - LogBinaryMergerRate_ref)
     560          24 :         assertion = all(Difference < tolerance)
     561             : 
     562             :         ! LCOV_EXCL_START
     563             :         if (Test%isDebugMode .and. .not. assertion) then
     564             :             write(Test%outputUnit,"(*(g0,:,' '))")
     565             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate_ref    =", LogBinaryMergerRate_ref
     566             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate        =", LogBinaryMergerRate
     567             :             write(Test%outputUnit,"(*(g0,:,' '))") "Difference                 =", Difference
     568             :             write(Test%outputUnit,"(*(g0,:,' '))")
     569             :         end if
     570             :         ! LCOV_EXCL_STOP
     571             : 
     572           3 :     end function test_getLogBinaryMergerRateLognormB10_1
     573             : 
     574             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     575             : 
     576           3 :     function test_getLogBinaryMergerRateLognormM14_1() result(assertion)
     577             : 
     578           3 :         use Constants_mod, only: RK, IK
     579             : 
     580             :         implicit none
     581             : 
     582             :         logical                     :: assertion
     583             :         integer(IK)                 :: i
     584             :         real(RK)    , parameter     :: Logzplus1(*) = [0.01_RK, 0.1_RK, 0.5_RK, 1._RK, 1.5_RK, 2._RK, 4._RK]
     585             :         real(RK)    , parameter     :: tolerance = 1.e-10_RK
     586             :         real(RK)    , parameter     :: LogBinaryMergerRate_ref(*) = [ .000000000000000_RK &
     587             :                                                                     , -9.329653089161376_RK &
     588             :                                                                     , -5.659712865486435_RK &
     589             :                                                                     , -4.534167866418038_RK &
     590             :                                                                     , -5.833262100335860_RK &
     591             :                                                                     , -8.197338596152411_RK &
     592             :                                                                     , .000000000000000_RK &
     593             :                                                                     ]
     594             :         real(RK)                    :: LogBinaryMergerRate(size(Logzplus1))
     595             :         real(RK)                    :: Difference(size(Logzplus1))
     596             : 
     597          24 :         do i = 1, size(Logzplus1)
     598          24 :             LogBinaryMergerRate(i) = getLogBinaryMergerRateLognormM14(logzplus1 = Logzplus1(i))
     599             :         end do
     600             : 
     601          24 :         Difference = abs(LogBinaryMergerRate - LogBinaryMergerRate_ref)
     602          24 :         assertion = all(Difference < tolerance)
     603             : 
     604             :         ! LCOV_EXCL_START
     605             :         if (Test%isDebugMode .and. .not. assertion) then
     606             :             write(Test%outputUnit,"(*(g0,:,' '))")
     607             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate_ref    =", LogBinaryMergerRate_ref
     608             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate        =", LogBinaryMergerRate
     609             :             write(Test%outputUnit,"(*(g0,:,' '))") "Difference                 =", Difference
     610             :             write(Test%outputUnit,"(*(g0,:,' '))")
     611             :         end if
     612             :         ! LCOV_EXCL_STOP
     613             : 
     614           3 :     end function test_getLogBinaryMergerRateLognormM14_1
     615             : 
     616             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     617             : 
     618           3 :     function test_getLogBinaryMergerRateLognormM17_1() result(assertion)
     619             : 
     620           3 :         use Constants_mod, only: RK, IK
     621             : 
     622             :         implicit none
     623             : 
     624             :         logical                     :: assertion
     625             :         integer(IK)                 :: i
     626             :         real(RK)    , parameter     :: Logzplus1(*) = [0.01_RK, 0.1_RK, 0.5_RK, 1._RK, 1.5_RK, 2._RK, 4._RK]
     627             :         real(RK)    , parameter     :: tolerance = 1.e-10_RK
     628             :         real(RK)    , parameter     :: LogBinaryMergerRate_ref(*) = [ .000000000000000_RK &
     629             :                                                                     , -9.446407015893174_RK &
     630             :                                                                     , -5.792990136584658_RK &
     631             :                                                                     , -4.509045304093034_RK &
     632             :                                                                     , -5.807989007937440_RK &
     633             :                                                                     , -8.517966032962981_RK &
     634             :                                                                     , .000000000000000_RK &
     635             :                                                                     ]
     636             :         real(RK)                    :: LogBinaryMergerRate(size(Logzplus1))
     637             :         real(RK)                    :: Difference(size(Logzplus1))
     638             : 
     639          24 :         do i = 1, size(Logzplus1)
     640          24 :             LogBinaryMergerRate(i) = getLogBinaryMergerRateLognormM17(logzplus1 = Logzplus1(i))
     641             :         end do
     642             : 
     643          24 :         Difference = abs(LogBinaryMergerRate - LogBinaryMergerRate_ref)
     644          24 :         assertion = all(Difference < tolerance)
     645             : 
     646             :         ! LCOV_EXCL_START
     647             :         if (Test%isDebugMode .and. .not. assertion) then
     648             :             write(Test%outputUnit,"(*(g0,:,' '))")
     649             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate_ref    =", LogBinaryMergerRate_ref
     650             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate        =", LogBinaryMergerRate
     651             :             write(Test%outputUnit,"(*(g0,:,' '))") "Difference                 =", Difference
     652             :             write(Test%outputUnit,"(*(g0,:,' '))")
     653             :         end if
     654             :         ! LCOV_EXCL_STOP
     655             : 
     656           3 :     end function test_getLogBinaryMergerRateLognormM17_1
     657             : 
     658             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     659             : 
     660           3 :     function test_getLogBinaryMergerRateLognormF18_1() result(assertion)
     661             : 
     662           3 :         use Constants_mod, only: RK, IK
     663             : 
     664             :         implicit none
     665             : 
     666             :         logical                     :: assertion
     667             :         integer(IK)                 :: i
     668             :         real(RK)    , parameter     :: Logzplus1(*) = [0.01_RK, 0.1_RK, 0.5_RK, 1._RK, 1.5_RK, 2._RK, 4._RK]
     669             :         real(RK)    , parameter     :: tolerance = 1.e-10_RK
     670             :         real(RK)    , parameter     :: LogBinaryMergerRate_ref(*) = [ .000000000000000_RK &
     671             :                                                                     , -9.190714850567522_RK &
     672             :                                                                     , -5.417287541056011_RK &
     673             :                                                                     , -4.435837002244674_RK &
     674             :                                                                     , -6.128328470549945_RK &
     675             :                                                                     , -8.694199479455726_RK &
     676             :                                                                     , .000000000000000_RK &
     677             :                                                                     ]
     678             :         real(RK)                    :: LogBinaryMergerRate(size(Logzplus1))
     679             :         real(RK)                    :: Difference(size(Logzplus1))
     680             : 
     681          24 :         do i = 1, size(Logzplus1)
     682          24 :             LogBinaryMergerRate(i) = getLogBinaryMergerRateLognormF18(logzplus1 = Logzplus1(i))
     683             :         end do
     684             : 
     685          24 :         Difference = abs(LogBinaryMergerRate - LogBinaryMergerRate_ref)
     686          24 :         assertion = all(Difference < tolerance)
     687             : 
     688             :         ! LCOV_EXCL_START
     689             :         if (Test%isDebugMode .and. .not. assertion) then
     690             :             write(Test%outputUnit,"(*(g0,:,' '))")
     691             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate_ref    =", LogBinaryMergerRate_ref
     692             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate        =", LogBinaryMergerRate
     693             :             write(Test%outputUnit,"(*(g0,:,' '))") "Difference                 =", Difference
     694             :             write(Test%outputUnit,"(*(g0,:,' '))")
     695             :         end if
     696             :         ! LCOV_EXCL_STOP
     697             : 
     698           3 :     end function test_getLogBinaryMergerRateLognormF18_1
     699             : 
     700             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     701             : 
     702           3 :     function test_getBinaryMergerRate_1() result(assertion)
     703             : 
     704           3 :         use Constants_mod, only: RK, IK, HUGE_RK
     705             : 
     706             :         implicit none
     707             : 
     708             :         logical                     :: assertion
     709             :         integer(IK)                 :: i
     710             :         integer(IK) , parameter     :: nRefinement = 5_IK
     711             :         real(RK)    , parameter     :: Zplus1(*) = exp([0.01_RK, 0.1_RK, 0.5_RK, 1._RK, 1.5_RK, 2._RK, 4._RK])
     712             :         real(RK)    , parameter     :: zplus1Max = HUGE_RK
     713             :         real(RK)    , parameter     :: maxRelativeError = 1.e-3_RK
     714             :         real(RK)    , parameter     :: tolerance = 10 * maxRelativeError
     715             :         real(RK)    , parameter     :: LogBinaryMergerRate_ref(*) = [ 47135672.01905259_RK &
     716             :                                                                     , 4039350253.898525_RK &
     717             :                                                                     , 28704208268.10552_RK &
     718             :                                                                     , 11140236299.90150_RK &
     719             :                                                                     , 2721517859.383554_RK &
     720             :                                                                     , 713346416.5410618_RK &
     721             :                                                                     , 936072.0838233130_RK &
     722             :                                                                     ]
     723             :         real(RK)                    :: LogBinaryMergerRate(size(Zplus1))
     724             :         real(RK)                    :: Difference(size(Zplus1))
     725             : 
     726          24 :         do i = 1, size(Zplus1)
     727          21 :             LogBinaryMergerRate(i) = getBinaryMergerRate( zplus1  = Zplus1(i) &
     728             :                                                         , zplus1Max = zplus1Max &
     729             :                                                         , nRefinement = nRefinement &
     730             :                                                         , maxRelativeError = maxRelativeError &
     731             :                                                         , getMergerDelayTimePDF = getTestMergerDelayTimePDF &
     732             :                                                         , getStarFormationRateDensity = getLogRateDensityB10 &
     733          24 :                                                         )
     734             :         end do
     735             : 
     736          24 :         Difference = abs(LogBinaryMergerRate - LogBinaryMergerRate_ref) / LogBinaryMergerRate_ref
     737          24 :         assertion = all(Difference < tolerance)
     738             : 
     739           3 :         if (Test%isDebugMode .and. .not. assertion) then
     740             :         ! LCOV_EXCL_START
     741             :             write(Test%outputUnit,"(*(g0,:,' '))")
     742             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate_ref    =", LogBinaryMergerRate_ref
     743             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate        =", LogBinaryMergerRate
     744             :             write(Test%outputUnit,"(*(g0,:,' '))") "Difference                 =", Difference
     745             :             write(Test%outputUnit,"(*(g0,:,' '))")
     746             :         end if
     747             :         ! LCOV_EXCL_STOP
     748             : 
     749           3 :     end function test_getBinaryMergerRate_1
     750             : 
     751             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     752             : 
     753           3 :     function test_getBinaryMergerRate_2() result(assertion)
     754             : 
     755           3 :         use Constants_mod, only: RK, IK, HUGE_RK
     756             : 
     757             :         implicit none
     758             : 
     759             :         logical                     :: assertion
     760             :         integer(IK)                 :: i
     761             :         integer(IK) , parameter     :: nRefinement = 7_IK
     762             :         real(RK)    , parameter     :: zplus1Max = HUGE_RK
     763             :         real(RK)    , parameter     :: maxRelativeError = 1.e-5_RK
     764             :         real(RK)    , parameter     :: tolerance = 50 * maxRelativeError
     765             :         real(RK)    , parameter     :: Zplus1(*) = exp( [ 0.01_RK &
     766             :                                                         !, 0.1_RK
     767             :                                                         !, 0.5_RK
     768             :                                                         !, 1._RK
     769             :                                                         !, 1.5_RK
     770             :                                                         !, 2._RK
     771             :                                                         !, 4._RK
     772             :                                                         ] )
     773             :         real(RK)    , parameter     :: LogBinaryMergerRate_ref(*) = [ 80262853.72557181_RK &
     774             :                                                                     !, 6496053990.625437_RK &
     775             :                                                                     !, 40843786839.47808_RK &
     776             :                                                                     !, 15009263609.39050_RK &
     777             :                                                                     !, 3431922966.674707_RK &
     778             :                                                                     !, 873502037.5052428_RK &
     779             :                                                                     !, 1218944.513809759_RK &
     780             :                                                                     ]
     781           6 :         real(RK)                    :: LogBinaryMergerRate(size(Zplus1))
     782           6 :         real(RK)                    :: Difference(size(Zplus1))
     783             : 
     784           6 :         do i = 1, size(Zplus1)
     785           3 :             LogBinaryMergerRate(i) = getBinaryMergerRate( zplus1  = Zplus1(i) &
     786             :                                                         !, zplus1Max = zplus1Max &
     787             :                                                         !, nRefinement = nRefinement &
     788             :                                                         !, maxRelativeError = maxRelativeError &
     789             :                                                         , getMergerDelayTimePDF = getTestMergerDelayTimePDF &
     790             :                                                         , getStarFormationRateDensity = getLogRateDensityB10 &
     791           6 :                                                         )
     792             :         end do
     793             : 
     794           6 :         Difference = abs(LogBinaryMergerRate - LogBinaryMergerRate_ref) / LogBinaryMergerRate_ref
     795           6 :         assertion = all(Difference < tolerance)
     796             : 
     797           3 :         if (Test%isDebugMode .and. .not. assertion) then
     798             :         ! LCOV_EXCL_START
     799             :             write(Test%outputUnit,"(*(g0,:,' '))")
     800             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate_ref    =", LogBinaryMergerRate_ref
     801             :             write(Test%outputUnit,"(*(g0,:,' '))") "LogBinaryMergerRate        =", LogBinaryMergerRate
     802             :             write(Test%outputUnit,"(*(g0,:,' '))") "Difference                 =", Difference
     803             :             write(Test%outputUnit,"(*(g0,:,' '))")
     804             :         end if
     805             :         ! LCOV_EXCL_STOP
     806             : 
     807           3 :     end function test_getBinaryMergerRate_2
     808             : 
     809             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     810             : 
     811        3888 :     function getTestMergerDelayTimePDF(mergerDelayTime) result(mergerDelayTimePDF)
     812           3 :         use Statistics_mod, only: getLogProbLogNorm
     813             :         use Constants_mod, only: IK, RK
     814             :         implicit none
     815             :         real(RK), intent(in)    :: mergerDelayTime
     816             :         real(RK)                :: mergerDelayTimePDF
     817             :         real(RK), parameter     :: inverseVariance = 1._RK
     818             :         real(RK), parameter     :: logSqrtInverseVariance = log(sqrt(inverseVariance))
     819             :         mergerDelayTimePDF = getLogProbLogNorm  ( logMean = 1._RK &
     820             :                                                 , inverseVariance = inverseVariance &
     821             :                                                 , logSqrtInverseVariance = logSqrtInverseVariance &
     822             :                                                 , logPoint = mergerDelayTime &
     823        3888 :                                                 )
     824        3888 :     end function getTestMergerDelayTimePDF
     825             : 
     826             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     827             : 
     828             : end module Test_StarFormation_mod ! LCOV_EXCL_LINE

ParaMonte: Plain Powerful Parallel Monte Carlo Library 
The Computational Data Science Lab
© Copyright 2012 - 2021