41 public eftcamb_parameter_cache, eftcamb_timestep_cache
44 character(*),
parameter :: cache_output_format =
'e18.10' 51 type :: eftcamb_parameter_cache
66 real(dl) :: grhornomass
72 integer :: num_nu_massive
73 integer :: nu_mass_eigenstates
74 real(dl),
allocatable,
dimension(:) :: grhormass
75 real(dl),
allocatable,
dimension(:) :: nu_masses
77 procedure( nu_background_wrapper ),
pointer,
nopass :: nu_background => null()
78 procedure( nu_rho_wrapper ),
pointer,
nopass :: nu_rho => null()
79 procedure( nu_drho_wrapper ),
pointer,
nopass :: nu_drho => null()
80 procedure( nu_pidot_wrapper ),
pointer,
nopass :: nu_pidot => null()
81 procedure( nu_pidotdot_wrapper ),
pointer,
nopass :: nu_pidotdot => null()
85 procedure :: initialize => eftcambparametercacheinit
86 procedure :: is_nan => eftcambparametercacheisnan
87 procedure :: print => eftcambparametercacheprint
89 end type eftcamb_parameter_cache
97 subroutine nu_background_wrapper( am, rhonu, pnu )
100 real(dl),
intent(in) :: am
101 real(dl),
intent(out) :: rhonu
102 real(dl),
intent(out) :: pnu
103 end subroutine nu_background_wrapper
106 subroutine nu_rho_wrapper( am, rhonu )
109 real(dl),
intent(in) :: am
110 real(dl),
intent(out) :: rhonu
111 end subroutine nu_rho_wrapper
115 function nu_drho_wrapper( am, adotoa, rhonu )
118 real(dl),
intent(in) :: am
121 real(dl) :: nu_drho_wrapper
122 end function nu_drho_wrapper
126 function nu_pidot_wrapper( am, adotoa, presnu )
129 real(dl),
intent(in) :: am
132 real(dl) :: nu_pidot_wrapper
133 end function nu_pidot_wrapper
137 function nu_pidotdot_wrapper( am, adotoa, Hdot, presnu, presnudot )
140 real(dl),
intent(in) :: am
144 real(dl) :: presnudot
145 real(dl) :: nu_pidotdot_wrapper
146 end function nu_pidotdot_wrapper
153 type :: eftcamb_timestep_cache
163 real(dl) :: gpresdotm_t
171 real(dl) :: grhonu_tot
172 real(dl) :: gpinu_tot
173 real(dl) :: grhonudot_tot
174 real(dl) :: gpinudot_tot
180 real(dl) :: eftomegav
181 real(dl) :: eftomegap
182 real(dl) :: eftomegapp
183 real(dl) :: eftomegappp
186 real(dl) :: eftlambda
187 real(dl) :: eftlambdadot
188 real(dl) :: eftgamma1v
189 real(dl) :: eftgamma1p
190 real(dl) :: eftgamma2v
191 real(dl) :: eftgamma2p
192 real(dl) :: eftgamma3v
193 real(dl) :: eftgamma3p
194 real(dl) :: eftgamma4v
195 real(dl) :: eftgamma4p
196 real(dl) :: eftgamma4pp
197 real(dl) :: eftgamma5v
198 real(dl) :: eftgamma5p
199 real(dl) :: eftgamma6v
200 real(dl) :: eftgamma6p
205 real(dl) :: gpresdotq
209 real(dl) :: efteomndot
211 real(dl) :: efteomxdot
218 real(dl) :: efteomvdot
247 real(dl) :: eft_kinetic
248 real(dl) :: eft_gradient
252 procedure :: initialize => eftcambtimestepcacheinit
253 procedure :: is_nan => eftcambtimestepcacheisnan
254 procedure :: open_cache_files => eftcambtimestepcacheopenfile
255 procedure :: dump_cache_files => eftcambtimestepcachedumpfile
256 procedure :: close_cache_files => eftcambtimestepcacheclosefile
258 end type eftcamb_timestep_cache
264 subroutine eftcambtimestepcacheinit( self )
268 class(eftcamb_timestep_cache) :: self
282 self%gpresm_t = 0._dl
283 self%gpresdotm_t = 0._dl
291 self%grhonu_tot = 0._dl
292 self%gpinu_tot = 0._dl
293 self%grhonudot_tot = 0._dl
294 self%gpinudot_tot = 0._dl
296 self%EFTOmegaV = 0._dl
297 self%EFTOmegaP = 0._dl
298 self%EFTOmegaPP = 0._dl
299 self%EFTOmegaPPP = 0._dl
302 self%EFTLambda = 0._dl
303 self%EFTLambdadot = 0._dl
304 self%EFTGamma1V = 0._dl
305 self%EFTGamma1P = 0._dl
306 self%EFTGamma2V = 0._dl
307 self%EFTGamma2P = 0._dl
308 self%EFTGamma3V = 0._dl
309 self%EFTGamma3P = 0._dl
310 self%EFTGamma4V = 0._dl
311 self%EFTGamma4P = 0._dl
312 self%EFTGamma4PP = 0._dl
313 self%EFTGamma5V = 0._dl
314 self%EFTGamma5P = 0._dl
315 self%EFTGamma6V = 0._dl
316 self%EFTGamma6P = 0._dl
320 self%grhodotq = 0._dl
321 self%gpresdotq = 0._dl
325 self%EFTeomNdot = 0._dl
327 self%EFTeomXdot = 0._dl
334 self%EFTeomVdot = 0._dl
347 self%pidotdot = 0._dl
360 self%EFT_kinetic = 0._dl
361 self%EFT_gradient = 0._dl
363 end subroutine eftcambtimestepcacheinit
367 subroutine eftcambtimestepcacheisnan( self, HaveNan )
371 class(eftcamb_timestep_cache),
intent(in) :: self
372 logical,
intent(out) :: havenan
376 havenan = havenan.or.isnan(self%a)
377 havenan = havenan.or.isnan(self%tau)
378 havenan = havenan.or.isnan(self%k)
379 havenan = havenan.or.isnan(self%adotoa)
380 havenan = havenan.or.isnan(self%Hdot)
381 havenan = havenan.or.isnan(self%Hdotdot)
382 havenan = havenan.or.isnan(self%grhoa2)
383 havenan = havenan.or.isnan(self%grhom_t)
384 havenan = havenan.or.isnan(self%gpresm_t)
385 havenan = havenan.or.isnan(self%gpresdotm_t)
386 havenan = havenan.or.isnan(self%grhob_t)
387 havenan = havenan.or.isnan(self%grhoc_t)
388 havenan = havenan.or.isnan(self%grhor_t)
389 havenan = havenan.or.isnan(self%grhog_t)
390 havenan = havenan.or.isnan(self%grhov_t)
391 havenan = havenan.or.isnan(self%gpiv_t)
392 havenan = havenan.or.isnan(self%grhonu_tot)
393 havenan = havenan.or.isnan(self%gpinu_tot)
394 havenan = havenan.or.isnan(self%grhonudot_tot)
395 havenan = havenan.or.isnan(self%gpinudot_tot)
396 havenan = havenan.or.isnan(self%EFTOmegaV)
397 havenan = havenan.or.isnan(self%EFTOmegaP)
398 havenan = havenan.or.isnan(self%EFTOmegaPP)
399 havenan = havenan.or.isnan(self%EFTOmegaPPP)
400 havenan = havenan.or.isnan(self%EFTc)
401 havenan = havenan.or.isnan(self%EFTcdot)
402 havenan = havenan.or.isnan(self%EFTLambda)
403 havenan = havenan.or.isnan(self%EFTLambdadot)
404 havenan = havenan.or.isnan(self%EFTGamma1V)
405 havenan = havenan.or.isnan(self%EFTGamma1P)
406 havenan = havenan.or.isnan(self%EFTGamma2V)
407 havenan = havenan.or.isnan(self%EFTGamma2P)
408 havenan = havenan.or.isnan(self%EFTGamma3V)
409 havenan = havenan.or.isnan(self%EFTGamma3P)
410 havenan = havenan.or.isnan(self%EFTGamma4V)
411 havenan = havenan.or.isnan(self%EFTGamma4P)
412 havenan = havenan.or.isnan(self%EFTGamma4PP)
413 havenan = havenan.or.isnan(self%EFTGamma5V)
414 havenan = havenan.or.isnan(self%EFTGamma5P)
415 havenan = havenan.or.isnan(self%EFTGamma6V)
416 havenan = havenan.or.isnan(self%EFTGamma6P)
417 havenan = havenan.or.isnan(self%grhoq)
418 havenan = havenan.or.isnan(self%gpresq)
419 havenan = havenan.or.isnan(self%grhodotq)
420 havenan = havenan.or.isnan(self%gpresdotq)
421 havenan = havenan.or.isnan(self%EFTeomF)
422 havenan = havenan.or.isnan(self%EFTeomN)
423 havenan = havenan.or.isnan(self%EFTeomNdot)
424 havenan = havenan.or.isnan(self%EFTeomX)
425 havenan = havenan.or.isnan(self%EFTeomXdot)
426 havenan = havenan.or.isnan(self%EFTeomY)
427 havenan = havenan.or.isnan(self%EFTeomG)
428 havenan = havenan.or.isnan(self%EFTeomU)
429 havenan = havenan.or.isnan(self%EFTeomL)
430 havenan = havenan.or.isnan(self%EFTeomM)
431 havenan = havenan.or.isnan(self%EFTeomV)
432 havenan = havenan.or.isnan(self%EFTeomVdot)
433 havenan = havenan.or.isnan(self%EFTpiA1)
434 havenan = havenan.or.isnan(self%EFTpiA2)
435 havenan = havenan.or.isnan(self%EFTpiB1)
436 havenan = havenan.or.isnan(self%EFTpiB2)
437 havenan = havenan.or.isnan(self%EFTpiC)
438 havenan = havenan.or.isnan(self%EFTpiD1)
439 havenan = havenan.or.isnan(self%EFTpiD2)
440 havenan = havenan.or.isnan(self%EFTpiE)
441 havenan = havenan.or.isnan(self%pi)
442 havenan = havenan.or.isnan(self%pidot)
443 havenan = havenan.or.isnan(self%pidotdot)
444 havenan = havenan.or.isnan(self%z)
445 havenan = havenan.or.isnan(self%clxg)
446 havenan = havenan.or.isnan(self%clxr)
447 havenan = havenan.or.isnan(self%dgpnu)
448 havenan = havenan.or.isnan(self%dgrho)
449 havenan = havenan.or.isnan(self%dgq)
450 havenan = havenan.or.isnan(self%EFTAT)
451 havenan = havenan.or.isnan(self%EFTBT)
452 havenan = havenan.or.isnan(self%EFTDT)
453 havenan = havenan.or.isnan(self%EFT_kinetic)
454 havenan = havenan.or.isnan(self%EFT_gradient)
456 end subroutine eftcambtimestepcacheisnan
460 subroutine eftcambtimestepcacheopenfile( self, outroot )
464 class(eftcamb_timestep_cache) :: self
465 character(len=*),
intent(in) :: outroot
470 write(*,
'(a)')
"***************************************************************" 471 write(*,
'(a)')
'EFTCAMB cache opening print files:' 472 write(*,
'(a)')
"***************************************************************" 475 call test_open( 111 )
476 call test_open( 222 )
477 call test_open( 333 )
478 call test_open( 444 )
479 call test_open( 555 )
480 call test_open( 666 )
481 call test_open( 777 )
482 call test_open( 888 )
483 call test_open( 999 )
484 call test_open( 1111 )
485 call test_open( 2222 )
488 call createtxtfile( trim(outroot)//
'cache_FRW.dat' ,111 )
489 call createtxtfile( trim(outroot)//
'cache_BDens.dat' ,222 )
490 call createtxtfile( trim(outroot)//
'cache_BPres.dat' ,333 )
491 call createtxtfile( trim(outroot)//
'cache_BackgroundEFT.dat' ,444 )
492 call createtxtfile( trim(outroot)//
'cache_SecondOrdEFT.dat' ,555 )
493 call createtxtfile( trim(outroot)//
'cache_BackgroundQ.dat' ,666 )
494 call createtxtfile( trim(outroot)//
'cache_EinsteinCoeff.dat' ,777 )
495 call createtxtfile( trim(outroot)//
'cache_PiCoeff.dat' ,888 )
496 call createtxtfile( trim(outroot)//
'cache_PiSolution.dat' ,999 )
497 call createtxtfile( trim(outroot)//
'cache_EinsteinSol.dat' ,1111)
498 call createtxtfile( trim(outroot)//
'cache_TensorCoeff.dat' ,2222)
501 write (111 ,
'(12a)')
'# ',
'a ',
'tau ',
'k ',
'adotoa ',
'Hdot ',
'Hdotdot ' 502 write (222 ,
'(12a)')
'# ',
'a ',
'tau ',
'k ',
'grhom_t ',
'grhob_t ',
'grhoc_t ',
'grhor_t ',
'grhog_t ',
'grhov_t ',
'grhonu_tot ',
'grhonudot_tot ' 503 write (333 ,
'(12a)')
'# ',
'a ',
'tau ',
'k ',
'gpresm_t ',
'gpresdotm_t ',
'gpiv_t ',
'gpinu_tot ',
'gpinudot_tot ' 504 write (444 ,
'(20a)')
'# ',
'a ',
'tau ',
'k ',
'EFTOmegaV ',
'EFTOmegaP ',
'EFTOmegaPP ',
'EFTOmegaPPP ',
'EFTc ',
'EFTcdot ',
'EFTLambda ',
'EFTLambdadot ' 505 write (555 ,
'(16a)')
'# ',
'a ',
'tau ',
'k ',
'EFTGamma1V ',
'EFTGamma1P ',
'EFTGamma2V ',
'EFTGamma2P ',
'EFTGamma3V ',
'EFTGamma3P ',
'EFTGamma4V ',
'EFTGamma4P ',
'EFTGamma4PP ',
'EFTGamma5V ',
'EFTGamma5P ',
'EFTGamma6V ',
'EFTGamma6P ' 506 write (666 ,
'(12a)')
'# ',
'a ',
'tau ',
'k ',
'grhoq ',
'gpresq ',
'grhodotq ',
'gpresdotq ' 507 write (777 ,
'(18a)')
'# ',
'a ',
'tau ',
'k ',
'EFTeomF ',
'EFTeomN ',
'EFTeomNdot ',
'EFTeomX ',
'EFTeomXdot ',
'EFTeomY ',
'EFTeomG ',
'EFTeomU ',
'EFTeomL ',
'EFTeomM ',
'EFTeomV ',
'EFTeomVdot ' 508 write (888 ,
'(14a)')
'# ',
'a ',
'tau ',
'k ',
'EFTpiA1 ',
'EFTpiA2 ',
'EFTpiB1 ',
'EFTpiB2 ',
'EFTpiC ',
'EFTpiD1 ',
'EFTpiD2 ',
'EFTpiE ' 509 write (999 ,
'(12a)')
'# ',
'a ',
'tau ',
'k ',
'pi ',
'pidot ',
'pidotdot ' 510 write (1111,
'(12a)')
'# ',
'a ',
'tau ',
'k ',
'z ',
'clxg ',
'clxr ',
'dgpnu ',
'dgrho ',
'dgq ' 511 write (2222,
'(12a)')
'# ',
'a ',
'tau ',
'k ',
'EFTAT ',
'EFTBT ',
'EFTDT ' 516 subroutine test_open( number )
520 integer,
intent(in) :: number
523 inquire( unit=number, opened=is_open )
525 write(*,*)
'EFTCAMB ERROR: Oputput unit', number,
'is already open.' 526 write(*,*)
'EFTCAMB cannot use it and cannot proceed.' 527 call mpistop(
'EFTCAMB error')
530 end subroutine test_open
532 end subroutine eftcambtimestepcacheopenfile
536 subroutine eftcambtimestepcacheclosefile( self )
540 class(eftcamb_timestep_cache) :: self
543 call test_close( 111 )
544 call test_close( 222 )
545 call test_close( 333 )
546 call test_close( 444 )
547 call test_close( 555 )
548 call test_close( 666 )
549 call test_close( 777 )
550 call test_close( 888 )
551 call test_close( 999 )
552 call test_close( 1111 )
553 call test_close( 2222 )
567 write(*,
'(a)')
"***************************************************************" 568 write(*,
'(a)')
'EFTCAMB cache printing done.' 569 write(*,
'(a)')
"***************************************************************" 574 subroutine test_close( number )
578 integer,
intent(in) :: number
581 inquire( unit=number, opened=is_open )
582 if ( .not. is_open )
then 583 write(*,*)
'EFTCAMB ERROR: Oputput unit', number,
'is not open.' 584 write(*,*)
'EFTCAMB is trying to close it and cannot proceed.' 585 call mpistop(
'EFTCAMB error')
588 end subroutine test_close
590 end subroutine eftcambtimestepcacheclosefile
594 subroutine eftcambtimestepcachedumpfile( self )
598 class(eftcamb_timestep_cache) :: self
601 write (111 ,
'(12'//cache_output_format//
')') self%a, self%tau, self%k, self%adotoa, self%Hdot, self%Hdotdot
603 write (222 ,
'(14'//cache_output_format//
')') self%a, self%tau, self%k, self%grhom_t, self%grhob_t, self%grhoc_t, self%grhor_t, self%grhog_t, self%grhov_t, self%grhonu_tot, self%grhonudot_tot
605 write (333 ,
'(12'//cache_output_format//
')') self%a, self%tau, self%k, self%gpresm_t, self%gpresdotm_t, self%gpiv_t, self%gpinu_tot, self%gpinudot_tot
607 write (444 ,
'(14'//cache_output_format//
')') self%a, self%tau, self%k, self%EFTOmegaV, self%EFTOmegaP, self%EFTOmegaPP, self%EFTOmegaPPP, self%EFTc, self%EFTcdot, self%EFTLambda, self%EFTLambdadot
609 write (555 ,
'(18'//cache_output_format//
')') self%a, self%tau, self%k, self%EFTGamma1V, self%EFTGamma1P, self%EFTGamma2V, self%EFTGamma2P, self%EFTGamma3V, self%EFTGamma3P, self%EFTGamma4V, self%EFTGamma4P, self%EFTGamma4PP, self%EFTGamma5V, self%EFTGamma5P, self%EFTGamma6V, self%EFTGamma6P
611 write (666 ,
'(12'//cache_output_format//
')') self%a, self%tau, self%k, self%grhoq, self%gpresq, self%grhodotq, self%gpresdotq
613 write (777 ,
'(18'//cache_output_format//
')') self%a, self%tau, self%k, self%EFTeomF, self%EFTeomN, self%EFTeomNdot, self%EFTeomX, self%EFTeomXdot, self%EFTeomY, self%EFTeomG, self%EFTeomU, self%EFTeomL, self%EFTeomM, self%EFTeomV, self%EFTeomVdot
615 write (888 ,
'(14'//cache_output_format//
')') self%a, self%tau, self%k, self%EFTpiA1, self%EFTpiA2, self%EFTpiB1, self%EFTpiB2, self%EFTpiC, self%EFTpiD1, self%EFTpiD2, self%EFTpiE
617 write (999 ,
'(12'//cache_output_format//
')') self%a, self%tau, self%k, self%pi, self%pidot, self%pidotdot
619 write (1111,
'(12'//cache_output_format//
')') self%a, self%tau, self%k, self%z, self%clxg, self%clxr, self%dgpnu, self%dgrho, self%dgq
621 write (2222,
'(12'//cache_output_format//
')') self%a, self%tau, self%k, self%EFTAT, self%EFTBT, self%EFTDT
623 end subroutine eftcambtimestepcachedumpfile
627 subroutine eftcambparametercacheinit( self )
631 class(eftcamb_parameter_cache) :: self
644 self%grhornomass = 0._dl
649 self%Num_Nu_Massive = 0
650 self%Nu_mass_eigenstates = 0
651 if (
allocated(self%grhormass) )
deallocate(self%grhormass)
652 if (
allocated(self%nu_masses) )
deallocate(self%nu_masses)
653 if (
associated(self%Nu_background) )
nullify(self%Nu_background)
654 if (
associated(self%Nu_rho) )
nullify(self%Nu_rho)
655 if (
associated(self%Nu_pidot) )
nullify(self%Nu_pidot)
656 if (
associated(self%Nu_pidotdot) )
nullify(self%Nu_pidotdot)
658 end subroutine eftcambparametercacheinit
662 subroutine eftcambparametercacheprint( self )
666 class(eftcamb_parameter_cache) :: self
671 write(*,
'(a)')
"***************************************************************" 672 write(*,
'(a)')
'EFTCAMB parameters cache content:' 673 write(*,
'(a)')
"***************************************************************" 674 write(*,
'(a14,E13.6)')
' Omega_CDM : ', self%omegac
675 write(*,
'(a14,E13.6)')
' Omega_b : ', self%omegab
676 write(*,
'(a14,E13.6)')
' Omega_v : ', self%omegav
677 write(*,
'(a14,E13.6)')
' Omega_k : ', self%omegak
678 write(*,
'(a14,E13.6)')
' Omega_n : ', self%omegan
679 write(*,
'(a14,E13.6)')
' Omega_g : ', self%omegag
680 write(*,
'(a14,E13.6)')
' Omega_r : ', self%omegar
681 write(*,
'(a14,F12.6)')
' h : ', self%h0
682 write(*,
'(a14,E13.6)')
' h_Mpc : ', self%h0_Mpc
683 write(*,
'(a14,E13.6)')
' grhog : ', self%grhog
684 write(*,
'(a14,E13.6)')
' grnonomass : ', self%grhornomass
685 write(*,
'(a14,E13.6)')
' grhoc : ', self%grhoc
686 write(*,
'(a14,E13.6)')
' grhob : ', self%grhob
687 write(*,
'(a14,E13.6)')
' grhov : ', self%grhov
688 write(*,
'(a14,E13.6)')
' grhok : ', self%grhok
689 write(*,
'(a22,I10)')
' Num_Nu_Massive : ', self%Num_Nu_Massive
690 write(*,
'(a22,I10)')
' Nu_mass_eigenstates : ', self%Nu_mass_eigenstates
691 do i=1, self%Nu_mass_eigenstates
692 write(*,
'(a11,I3,a9,E13.6)')
' grhormass(',i,
') : ', self%grhormass(i)
693 write(*,
'(a11,I3,a9,E13.6)')
' nu_masses(',i,
') : ', self%nu_masses(i)
695 write(*,
'(a)')
"***************************************************************" 697 end subroutine eftcambparametercacheprint
701 subroutine eftcambparametercacheisnan( self, HaveNan )
705 class(eftcamb_parameter_cache),
intent(in) :: self
706 logical,
intent(out) :: havenan
712 havenan = havenan.or.isnan(self%omegac)
713 havenan = havenan.or.isnan(self%omegab)
714 havenan = havenan.or.isnan(self%omegav)
715 havenan = havenan.or.isnan(self%omegak)
716 havenan = havenan.or.isnan(self%omegan)
717 havenan = havenan.or.isnan(self%omegag)
718 havenan = havenan.or.isnan(self%omegar)
719 havenan = havenan.or.isnan(self%h0)
720 havenan = havenan.or.isnan(self%h0_Mpc)
721 havenan = havenan.or.isnan(self%grhog)
722 havenan = havenan.or.isnan(self%grhornomass)
723 havenan = havenan.or.isnan(self%grhoc)
724 havenan = havenan.or.isnan(self%grhob)
725 havenan = havenan.or.isnan(self%grhov)
726 havenan = havenan.or.isnan(self%grhok)
727 havenan = havenan.or.isnan(self%Num_Nu_Massive*1.0_dl)
728 havenan = havenan.or.isnan(self%Nu_mass_eigenstates*1.0)
730 do i=1, self%Nu_mass_eigenstates
731 havenan = havenan.or.isnan(self%grhormass(i)).or.isnan(self%nu_masses(i))
734 end subroutine eftcambparametercacheisnan
This module contains the definition of the EFTCAMB caches. These are used to store parameters that ca...