EFTCAMB  Reference documentation for version 3.0
04p7_turning_point_parametrizations_1D.f90
Go to the documentation of this file.
1 !----------------------------------------------------------------------------------------
2 !
3 ! This file is part of EFTCAMB.
4 !
5 ! Copyright (C) 2013-2016 by the EFTCAMB authors
6 !
7 ! The EFTCAMB code is free software;
8 ! You can use it, redistribute it, and/or modify it under the terms
9 ! of the GNU General Public License as published by the Free Software Foundation;
10 ! either version 3 of the License, or (at your option) any later version.
11 ! The full text of the license can be found in the file eftcamb/LICENSE at
12 ! the top level of the EFTCAMB distribution.
13 !
14 !----------------------------------------------------------------------------------------
15 
19 
20 
21 !----------------------------------------------------------------------------------------
24 
26 
28 
29  use precision
30  use amlutils
31  use eft_def
32  use eftcamb_cache
34 
35  implicit none
36 
37  private
38 
39  public turning_point_parametrization_1d
40 
41  ! ---------------------------------------------------------------------------------------------
43  type, extends ( parametrized_function_1d ) :: turning_point_parametrization_1d
44 
45  real(dl) :: w0
46  real(dl) :: wa
47  real(dl) :: wat
48 
49  contains
50 
51  ! utility functions:
52  procedure :: set_param_number => turningpointparametrized1dsetparamnumber
53  procedure :: init_parameters => turningpointparametrized1dinitparams
54  procedure :: parameter_value => turningpointparametrized1dparametervalues
55  procedure :: feedback => turningpointparametrized1dfeedback
56 
57  ! evaluation procedures:
58  procedure :: value => turningpointparametrized1dvalue
59  procedure :: first_derivative => turningpointparametrized1dfirstderivative
60  procedure :: second_derivative => turningpointparametrized1dsecondderivative
61  procedure :: third_derivative => turningpointparametrized1dthirdderivative
62  procedure :: integral => turningpointparametrized1dintegral
63 
64  end type turning_point_parametrization_1d
65 
66 contains
67 
68  ! ---------------------------------------------------------------------------------------------
69  ! Implementation of the turning point function.
70  ! ---------------------------------------------------------------------------------------------
71 
72  ! ---------------------------------------------------------------------------------------------
74  subroutine turningpointparametrized1dsetparamnumber( self )
75 
76  implicit none
77 
78  class(turning_point_parametrization_1d) :: self
79 
80  ! initialize the number of parameters:
81  self%parameter_number = 3
82 
83  end subroutine turningpointparametrized1dsetparamnumber
84 
85  ! ---------------------------------------------------------------------------------------------
87  subroutine turningpointparametrized1dinitparams( self, array )
88 
89  implicit none
90 
91  class(turning_point_parametrization_1d) :: self
92  real(dl), dimension(self%parameter_number), intent(in) :: array
93 
94  self%w0 = array(1)
95  self%wa = array(2)
96  self%wat= array(3)
97 
98  end subroutine turningpointparametrized1dinitparams
99 
100  ! ---------------------------------------------------------------------------------------------
102  subroutine turningpointparametrized1dparametervalues( self, i, value )
103 
104  implicit none
105 
106  class(turning_point_parametrization_1d):: self
107  integer , intent(in) :: i
108  real(dl) , intent(out) :: value
109 
110  select case (i)
111  case(1)
112  value = self%w0
113  case(2)
114  value = self%wa
115  case(3)
116  value = self%wat
117  case default
118  write(*,*) 'Illegal index for parameter_names.'
119  write(*,*) 'Maximum value is:', self%parameter_number
120  call mpistop('EFTCAMB error')
121  end select
122 
123  end subroutine turningpointparametrized1dparametervalues
124 
125  ! ---------------------------------------------------------------------------------------------
127  subroutine turningpointparametrized1dfeedback( self, print_params )
128 
129  implicit none
130 
131  class(turning_point_parametrization_1d) :: self
132  logical, optional :: print_params
134 
135  integer :: i
136  real(dl) :: param_value
137  character(len=EFT_names_max_length) :: param_name
138  logical :: print_params_temp
139 
140  if ( present(print_params) ) then
141  print_params_temp = print_params
142  else
143  print_params_temp = .true.
144  end if
145 
146  write(*,*) 'Turning Point parametrization: ', self%name
147  if ( print_params_temp ) then
148  do i=1, self%parameter_number
149  call self%parameter_names( i, param_name )
150  call self%parameter_value( i, param_value )
151  write(*,'(a23,a,F12.6)') param_name, '=', param_value
152  end do
153  end if
154 
155  end subroutine turningpointparametrized1dfeedback
156 
157  ! ---------------------------------------------------------------------------------------------
159  function turningpointparametrized1dvalue( self, x, eft_cache )
160 
161  implicit none
162 
163  class(turning_point_parametrization_1d) :: self
164  real(dl), intent(in) :: x
165  type(eftcamb_timestep_cache), intent(in), optional :: eft_cache
166  real(dl) :: turningpointparametrized1dvalue
167 
168  turningpointparametrized1dvalue = self%w0 +self%wa*(self%wat - x)**2._dl
169 
170  end function turningpointparametrized1dvalue
171 
172  ! ---------------------------------------------------------------------------------------------
174  function turningpointparametrized1dfirstderivative( self, x, eft_cache )
175 
176  implicit none
177 
178  class(turning_point_parametrization_1d) :: self
179  real(dl), intent(in) :: x
180  type(eftcamb_timestep_cache), intent(in), optional :: eft_cache
181  real(dl) :: turningpointparametrized1dfirstderivative
182 
183  turningpointparametrized1dfirstderivative = 2._dl*self%wa*(x -self%wat)
184 
185  end function turningpointparametrized1dfirstderivative
186 
187  ! ---------------------------------------------------------------------------------------------
189  function turningpointparametrized1dsecondderivative( self, x, eft_cache )
190 
191  implicit none
192 
193  class(turning_point_parametrization_1d) :: self
194  real(dl), intent(in) :: x
195  type(eftcamb_timestep_cache), intent(in), optional :: eft_cache
196  real(dl) :: turningpointparametrized1dsecondderivative
197 
198  turningpointparametrized1dsecondderivative = 2._dl*self%wa
199 
200  end function turningpointparametrized1dsecondderivative
201 
202  ! ---------------------------------------------------------------------------------------------
204  function turningpointparametrized1dthirdderivative( self, x, eft_cache )
205 
206  implicit none
207 
208  class(turning_point_parametrization_1d) :: self
209  real(dl), intent(in) :: x
210  type(eftcamb_timestep_cache), intent(in), optional :: eft_cache
211  real(dl) :: turningpointparametrized1dthirdderivative
212 
213  turningpointparametrized1dthirdderivative = 0._dl
214 
215  end function turningpointparametrized1dthirdderivative
216 
217  ! ---------------------------------------------------------------------------------------------
219  function turningpointparametrized1dintegral( self, x, eft_cache )
220 
221  implicit none
222 
223  class(turning_point_parametrization_1d) :: self
224  real(dl), intent(in) :: x
225  type(eftcamb_timestep_cache), intent(in), optional :: eft_cache
226  real(dl) :: turningpointparametrized1dintegral
227 
228  turningpointparametrized1dintegral = x**(2._dl -3._dl*(1._dl +self%w0 +self%wa*self%wat**2._dl))*exp(-1.5_dl*(x -1._dl)*self%wa*(1._dl +x -4._dl*self%wat))
229 
230  end function turningpointparametrized1dintegral
231 
232  ! ---------------------------------------------------------------------------------------------
233 
235 
236 !----------------------------------------------------------------------------------------
This module contains the definition of the EFTCAMB caches. These are used to store parameters that ca...
This module contains the definition of the turning point parametrization, inheriting from parametrize...
This module contains the definitions of all the EFTCAMB compile time flags.
Definition: 01_EFT_def.f90:25
This module contains the abstract class for generic parametrizations for 1D functions that are used b...