EFTCAMB  Reference documentation for version 3.0
05p1_constant_parametrizations_2D.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 constant_parametrization_2d
40 
41  ! ---------------------------------------------------------------------------------------------
43  type, extends ( parametrized_function_2d ) :: constant_parametrization_2d
44 
45  real(dl) :: constant_value
46 
47  contains
48 
49  ! utility functions:
50  procedure :: set_param_number => constantparametrized2dsetparamnumber
51  procedure :: init_parameters => constantparametrized2dinitparams
52  procedure :: parameter_value => constantparametrized2dparametervalues
53  procedure :: feedback => constantparametrized2dfeedback
54 
55  ! evaluation procedures:
56  procedure :: value => constantparametrized2dvalue
57  procedure :: first_derivative_x => constantparametrized2dfirstderivativex
58  procedure :: first_derivative_y => constantparametrized2dfirstderivativey
59  procedure :: second_derivative_x => constantparametrized2dsecondderivativex
60  procedure :: second_derivative_y => constantparametrized2dsecondderivativey
61  procedure :: second_derivative_xy => constantparametrized2dsecondderivativexy
62 
63  end type constant_parametrization_2d
64 
65 contains
66 
67  ! ---------------------------------------------------------------------------------------------
68  ! Implementation of the constant function.
69  ! ---------------------------------------------------------------------------------------------
70 
71  ! ---------------------------------------------------------------------------------------------
73  subroutine constantparametrized2dsetparamnumber( self )
74 
75  implicit none
76 
77  class(constant_parametrization_2d) :: self
78 
79  ! initialize the number of parameters:
80  self%parameter_number = 1
81 
82  end subroutine constantparametrized2dsetparamnumber
83 
84  ! ---------------------------------------------------------------------------------------------
86  subroutine constantparametrized2dinitparams( self, array )
87 
88  implicit none
89 
90  class(constant_parametrization_2d) :: self
91  real(dl), dimension(self%parameter_number), intent(in) :: array
92 
93  self%constant_value = array(1)
94 
95  end subroutine constantparametrized2dinitparams
96 
97  ! ---------------------------------------------------------------------------------------------
99  subroutine constantparametrized2dfeedback( self, print_params )
100 
101  implicit none
102 
103  class(constant_parametrization_2d) :: self
104  logical, optional :: print_params
106 
107  integer :: i
108  real(dl) :: param_value
109  character(len=EFT_names_max_length) :: param_name
110  logical :: print_params_temp
111 
112  if ( present(print_params) ) then
113  print_params_temp = print_params
114  else
115  print_params_temp = .true.
116  end if
117 
118  write(*,*) 'Constant function: ', self%name
119  if ( print_params_temp ) then
120  do i=1, self%parameter_number
121  call self%parameter_names( i, param_name )
122  call self%parameter_value( i, param_value )
123  write(*,'(a23,a,F12.6)') param_name, '=', param_value
124  end do
125  end if
126 
127  end subroutine constantparametrized2dfeedback
128 
129  ! ---------------------------------------------------------------------------------------------
131  subroutine constantparametrized2dparametervalues( self, i, value )
132 
133  implicit none
134 
135  class(constant_parametrization_2d) :: self
136  integer , intent(in) :: i
137  real(dl) , intent(out) :: value
138 
139  select case (i)
140  case(1)
141  value = self%constant_value
142  case default
143  write(*,*) 'In constant_parametrization_2D:', self%name
144  write(*,*) 'Illegal index for parameter_names.'
145  write(*,*) 'Maximum value is:', self%parameter_number
146  call mpistop('EFTCAMB error')
147  end select
148 
149  end subroutine constantparametrized2dparametervalues
150 
151  ! ---------------------------------------------------------------------------------------------
153  function constantparametrized2dvalue( self, x, y, eft_cache )
154 
155  implicit none
156 
157  class(constant_parametrization_2d) :: self
158  real(dl), intent(in) :: x
159  real(dl), intent(in) :: y
160  type(eftcamb_timestep_cache), intent(in), optional :: eft_cache
161  real(dl) :: constantparametrized2dvalue
162 
163  constantparametrized2dvalue = self%constant_value
164 
165  end function constantparametrized2dvalue
166 
167  ! ---------------------------------------------------------------------------------------------
169  function constantparametrized2dfirstderivativex( self, x, y, eft_cache )
170 
171  implicit none
172 
173  class(constant_parametrization_2d) :: self
174  real(dl), intent(in) :: x
175  real(dl), intent(in) :: y
176  type(eftcamb_timestep_cache), intent(in), optional :: eft_cache
177  real(dl) :: constantparametrized2dfirstderivativex
178 
179  constantparametrized2dfirstderivativex = 0._dl
180 
181  end function constantparametrized2dfirstderivativex
182 
183  ! ---------------------------------------------------------------------------------------------
185  function constantparametrized2dfirstderivativey( self, x, y, eft_cache )
186 
187  implicit none
188 
189  class(constant_parametrization_2d) :: self
190  real(dl), intent(in) :: x
191  real(dl), intent(in) :: y
192  type(eftcamb_timestep_cache), intent(in), optional :: eft_cache
193  real(dl) :: constantparametrized2dfirstderivativey
194 
195  constantparametrized2dfirstderivativey = 0._dl
196 
197  end function constantparametrized2dfirstderivativey
198 
199  ! ---------------------------------------------------------------------------------------------
201  function constantparametrized2dsecondderivativex( self, x, y, eft_cache )
202 
203  implicit none
204 
205  class(constant_parametrization_2d) :: self
206  real(dl), intent(in) :: x
207  real(dl), intent(in) :: y
208  type(eftcamb_timestep_cache), intent(in), optional :: eft_cache
209  real(dl) :: constantparametrized2dsecondderivativex
210 
211  constantparametrized2dsecondderivativex = 0._dl
212 
213  end function constantparametrized2dsecondderivativex
214 
215  ! ---------------------------------------------------------------------------------------------
217  function constantparametrized2dsecondderivativey( self, x, y, eft_cache )
218 
219  implicit none
220 
221  class(constant_parametrization_2d) :: self
222  real(dl), intent(in) :: x
223  real(dl), intent(in) :: y
224  type(eftcamb_timestep_cache), intent(in), optional :: eft_cache
225  real(dl) :: constantparametrized2dsecondderivativey
226 
227  constantparametrized2dsecondderivativey = 0._dl
228 
229  end function constantparametrized2dsecondderivativey
230 
231  ! ---------------------------------------------------------------------------------------------
233  function constantparametrized2dsecondderivativexy( self, x, y, eft_cache )
234 
235  implicit none
236 
237  class(constant_parametrization_2d) :: self
238  real(dl), intent(in) :: x
239  real(dl), intent(in) :: y
240  type(eftcamb_timestep_cache), intent(in), optional :: eft_cache
241  real(dl) :: constantparametrized2dsecondderivativexy
242 
243  constantparametrized2dsecondderivativexy = 0._dl
244 
245  end function constantparametrized2dsecondderivativexy
246 
247  !----------------------------------------------------------------------------------------
248 
250 
251 !----------------------------------------------------------------------------------------
This module contains the definition of the constant parametrization, inheriting from parametrized_fun...
This module contains the definition of the EFTCAMB caches. These are used to store parameters that ca...
This module contains the abstract class for generic parametrizations for 2D functions that are used b...
This module contains the definitions of all the EFTCAMB compile time flags.
Definition: 01_EFT_def.f90:25