39 public power_law_parametrization_1d
43 type,
extends ( parametrized_function_1d ) :: power_law_parametrization_1d
45 real(dl) :: coefficient
51 procedure :: set_param_number => powerlawparametrized1dsetparamnumber
52 procedure :: init_parameters => powerlawparametrized1dinitparams
53 procedure :: parameter_value => powerlawparametrized1dparametervalues
54 procedure :: feedback => powerlawparametrized1dfeedback
57 procedure ::
value => powerlawparametrized1dvalue
58 procedure :: first_derivative => powerlawparametrized1dfirstderivative
59 procedure :: second_derivative => powerlawparametrized1dsecondderivative
60 procedure :: third_derivative => powerlawparametrized1dthirdderivative
61 procedure :: integral => powerlawparametrized1dintegral
63 end type power_law_parametrization_1d
73 subroutine powerlawparametrized1dsetparamnumber( self )
77 class(power_law_parametrization_1d) :: self
80 self%parameter_number = 2
82 end subroutine powerlawparametrized1dsetparamnumber
86 subroutine powerlawparametrized1dinitparams( self, array )
90 class(power_law_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 powerlawparametrized1dinitparams
100 subroutine powerlawparametrized1dparametervalues( self, i, value )
104 class(power_law_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 powerlawparametrized1dparametervalues
123 subroutine powerlawparametrized1dfeedback( self, print_params )
127 class(power_law_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(*,*)
'Power Law 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 powerlawparametrized1dfeedback
155 function powerlawparametrized1dvalue( self, x, eft_cache )
159 class(power_law_parametrization_1d) :: self
160 real(dl),
intent(in) :: x
161 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
162 real(dl) :: powerlawparametrized1dvalue
164 powerlawparametrized1dvalue = self%coefficient*x**self%exponent
166 end function powerlawparametrized1dvalue
170 function powerlawparametrized1dfirstderivative( self, x, eft_cache )
174 class(power_law_parametrization_1d) :: self
175 real(dl),
intent(in) :: x
176 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
177 real(dl) :: powerlawparametrized1dfirstderivative
179 powerlawparametrized1dfirstderivative = self%coefficient*self%exponent*x**(self%exponent-1._dl)
181 end function powerlawparametrized1dfirstderivative
185 function powerlawparametrized1dsecondderivative( self, x, eft_cache )
189 class(power_law_parametrization_1d) :: self
190 real(dl),
intent(in) :: x
191 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
192 real(dl) :: powerlawparametrized1dsecondderivative
194 powerlawparametrized1dsecondderivative = self%coefficient*self%exponent*(self%exponent-1._dl)*x**(self%exponent-2._dl)
196 end function powerlawparametrized1dsecondderivative
200 function powerlawparametrized1dthirdderivative( self, x, eft_cache )
204 class(power_law_parametrization_1d) :: self
205 real(dl),
intent(in) :: x
206 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
207 real(dl) :: powerlawparametrized1dthirdderivative
209 powerlawparametrized1dthirdderivative = self%coefficient*self%exponent*(self%exponent-1._dl)*(self%exponent-2._dl)*x**(self%exponent-3._dl)
211 end function powerlawparametrized1dthirdderivative
215 function powerlawparametrized1dintegral( self, x, eft_cache )
219 class(power_law_parametrization_1d) :: self
220 real(dl),
intent(in) :: x
221 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
222 real(dl) :: powerlawparametrized1dintegral
224 if ( self%exponent == 0. )
then 225 powerlawparametrized1dintegral = x**(-1._dl -3._dl*self%coefficient)
227 powerlawparametrized1dintegral = 1._dl/(x*exp((3._dl*(-1._dl + x**self%exponent)*self%coefficient)/self%exponent))
230 end function powerlawparametrized1dintegral
This module contains the definition of the EFTCAMB caches. These are used to store parameters that ca...
This module contains the definition of the power law parametrization, inheriting from parametrized_fu...
This module contains the definitions of all the EFTCAMB compile time flags.
This module contains the abstract class for generic parametrizations for 1D functions that are used b...