39 public exponential_parametrization_1d
43 type,
extends ( parametrized_function_1d ) :: exponential_parametrization_1d
45 real(dl) :: coefficient
51 procedure :: set_param_number => exponentialparametrized1dsetparamnumber
52 procedure :: init_parameters => exponentialparametrized1dinitparams
53 procedure :: parameter_value => exponentialparametrized1dparametervalues
54 procedure :: feedback => exponentialparametrized1dfeedback
57 procedure ::
value => exponentialparametrized1dvalue
58 procedure :: first_derivative => exponentialparametrized1dfirstderivative
59 procedure :: second_derivative => exponentialparametrized1dsecondderivative
60 procedure :: third_derivative => exponentialparametrized1dthirdderivative
61 procedure :: integral => exponentialparametrized1dintegral
63 end type exponential_parametrization_1d
73 subroutine exponentialparametrized1dsetparamnumber( self )
77 class(exponential_parametrization_1d) :: self
80 self%parameter_number = 2
82 end subroutine exponentialparametrized1dsetparamnumber
86 subroutine exponentialparametrized1dinitparams( self, array )
90 class(exponential_parametrization_1d) :: self
91 real(dl),
dimension(self%parameter_number),
intent(in) :: array
93 self%coefficient = array(1)
94 self%exponent = array(2)
96 end subroutine exponentialparametrized1dinitparams
100 subroutine exponentialparametrized1dparametervalues( self, i, value )
104 class(exponential_parametrization_1d):: self
105 integer ,
intent(in) :: i
106 real(dl) ,
intent(out) ::
value 110 value = self%coefficient
112 value = self%exponent
114 write(*,*)
'Illegal index for parameter_names.' 115 write(*,*)
'Maximum value is:', self%parameter_number
116 call mpistop(
'EFTCAMB error')
119 end subroutine exponentialparametrized1dparametervalues
123 subroutine exponentialparametrized1dfeedback( self, print_params )
127 class(exponential_parametrization_1d) :: self
128 logical,
optional :: print_params
132 real(dl) :: param_value
133 character(len=EFT_names_max_length) :: param_name
134 logical :: print_params_temp
136 if (
present(print_params) )
then 137 print_params_temp = print_params
139 print_params_temp = .true.
142 write(*,*)
'Exponential function: ', self%name
143 if ( print_params_temp )
then 144 do i=1, self%parameter_number
145 call self%parameter_names( i, param_name )
146 call self%parameter_value( i, param_value )
147 write(*,
'(a23,a,F12.6)') param_name,
'=', param_value
151 end subroutine exponentialparametrized1dfeedback
155 function exponentialparametrized1dvalue( self, x, eft_cache )
159 class(exponential_parametrization_1d) :: self
160 real(dl),
intent(in) :: x
161 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
162 real(dl) :: exponentialparametrized1dvalue
164 exponentialparametrized1dvalue = exp(self%coefficient*x**self%exponent) -1._dl
165 end function exponentialparametrized1dvalue
169 function exponentialparametrized1dfirstderivative( self, x, eft_cache )
173 class(exponential_parametrization_1d) :: self
174 real(dl),
intent(in) :: x
175 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
176 real(dl) :: exponentialparametrized1dfirstderivative
178 exponentialparametrized1dfirstderivative = self%coefficient*self%exponent*x**(self%exponent-1._dl)*exp(self%coefficient*x**self%exponent)
180 end function exponentialparametrized1dfirstderivative
184 function exponentialparametrized1dsecondderivative( self, x, eft_cache )
188 class(exponential_parametrization_1d) :: self
189 real(dl),
intent(in) :: x
190 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
191 real(dl) :: exponentialparametrized1dsecondderivative
193 exponentialparametrized1dsecondderivative = self%coefficient*self%exponent*(self%exponent -1._dl +x**self%exponent*self%coefficient*self%exponent)*x**(self%exponent-2._dl)*exp(self%coefficient*x**self%exponent)
195 end function exponentialparametrized1dsecondderivative
199 function exponentialparametrized1dthirdderivative( self, x, eft_cache )
203 class(exponential_parametrization_1d) :: self
204 real(dl),
intent(in) :: x
205 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
206 real(dl) :: exponentialparametrized1dthirdderivative
208 exponentialparametrized1dthirdderivative = self%coefficient*self%exponent*exp(self%coefficient*x**self%exponent)*x**(self%exponent-3._dl)&
209 & *(2._dl +self%exponent*(-3._dl +self%exponent +x**self%exponent*self%coefficient*(-3._dl +self%exponent*(3._dl +x**self%exponent*self%coefficient))))
211 end function exponentialparametrized1dthirdderivative
215 function exponentialparametrized1dintegral( self, x, eft_cache )
219 class(exponential_parametrization_1d) :: self
220 real(dl),
intent(in) :: x
221 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
222 real(dl) :: exponentialparametrized1dintegral
224 exponentialparametrized1dintegral = 0._dl
227 write(*,*)
'ExponentialParametrized1DIntegral is not implemented.' 228 write(*,*)
'Calculations cannot proceed.' 229 call mpistop(
'EFTCAMB error')
231 end function exponentialparametrized1dintegral
This module contains the definition of the EFTCAMB caches. These are used to store parameters that ca...
This module contains the definitions of all the EFTCAMB compile time flags.
This module contains the definition of the exponential parametrization, inheriting from parametrized_...
This module contains the abstract class for generic parametrizations for 1D functions that are used b...