39 public linear_parametrization_1d
43 type,
extends ( parametrized_function_1d ) :: linear_parametrization_1d
45 real(dl) :: linear_value
50 procedure :: set_param_number => linearparametrized1dsetparamnumber
51 procedure :: init_parameters => linearparametrized1dinitparams
52 procedure :: parameter_value => linearparametrized1dparametervalues
53 procedure :: feedback => linearparametrized1dfeedback
56 procedure ::
value => linearparametrized1dvalue
57 procedure :: first_derivative => linearparametrized1dfirstderivative
58 procedure :: second_derivative => linearparametrized1dsecondderivative
59 procedure :: third_derivative => linearparametrized1dthirdderivative
60 procedure :: integral => linearparametrized1dintegral
62 end type linear_parametrization_1d
72 subroutine linearparametrized1dsetparamnumber( self )
76 class(linear_parametrization_1d) :: self
79 self%parameter_number = 1
81 end subroutine linearparametrized1dsetparamnumber
85 subroutine linearparametrized1dinitparams( self, array )
89 class(linear_parametrization_1d) :: self
90 real(dl),
dimension(self%parameter_number),
intent(in) :: array
92 self%linear_value = array(1)
94 end subroutine linearparametrized1dinitparams
98 subroutine linearparametrized1dparametervalues( self, i, value )
102 class(linear_parametrization_1d) :: self
103 integer ,
intent(in) :: i
104 real(dl) ,
intent(out) ::
value 108 value = self%linear_value
110 write(*,*)
'Illegal index for parameter_names.' 111 write(*,*)
'Maximum value is:', self%parameter_number
112 call mpistop(
'EFTCAMB error')
115 end subroutine linearparametrized1dparametervalues
119 subroutine linearparametrized1dfeedback( self, print_params )
123 class(linear_parametrization_1d) :: self
124 logical,
optional :: print_params
128 real(dl) :: param_value
129 character(len=EFT_names_max_length) :: param_name
130 logical :: print_params_temp
132 if (
present(print_params) )
then 133 print_params_temp = print_params
135 print_params_temp = .true.
138 write(*,*)
'Linear function: ', self%name
139 if ( print_params_temp )
then 140 do i=1, self%parameter_number
141 call self%parameter_names( i, param_name )
142 call self%parameter_value( i, param_value )
143 write(*,
'(a23,a,F12.6)') param_name,
'=', param_value
147 end subroutine linearparametrized1dfeedback
151 function linearparametrized1dvalue( self, x, eft_cache )
155 class(linear_parametrization_1d) :: self
156 real(dl),
intent(in) :: x
157 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
158 real(dl) :: linearparametrized1dvalue
160 linearparametrized1dvalue = self%linear_value*x
162 end function linearparametrized1dvalue
166 function linearparametrized1dfirstderivative( self, x, eft_cache )
170 class(linear_parametrization_1d) :: self
171 real(dl),
intent(in) :: x
172 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
173 real(dl) :: linearparametrized1dfirstderivative
175 linearparametrized1dfirstderivative = self%linear_value
177 end function linearparametrized1dfirstderivative
181 function linearparametrized1dsecondderivative( self, x, eft_cache )
185 class(linear_parametrization_1d) :: self
186 real(dl),
intent(in) :: x
187 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
188 real(dl) :: linearparametrized1dsecondderivative
190 linearparametrized1dsecondderivative = 0._dl
192 end function linearparametrized1dsecondderivative
196 function linearparametrized1dthirdderivative( self, x, eft_cache )
200 class(linear_parametrization_1d) :: self
201 real(dl),
intent(in) :: x
202 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
203 real(dl) :: linearparametrized1dthirdderivative
205 linearparametrized1dthirdderivative = 0._dl
207 end function linearparametrized1dthirdderivative
211 function linearparametrized1dintegral( self, x, eft_cache )
215 class(linear_parametrization_1d) :: self
216 real(dl),
intent(in) :: x
217 type(eftcamb_timestep_cache),
intent(in),
optional :: eft_cache
218 real(dl) :: linearparametrized1dintegral
220 linearparametrized1dintegral = exp(-3._dl*(x-1._dl)*self%linear_value)/x
222 end function linearparametrized1dintegral
This module contains the definition of the EFTCAMB caches. These are used to store parameters that ca...
This module contains the definition of the linear parametrization, inheriting from parametrized_funct...
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...