Debian Codegraph @

src/options_powerspec.f90

raw
1 !-----------------------------------------------------------------
2 !
3 ! This file is (or was) part of SPLASH, a visualisation tool
4 ! for Smoothed Particle Hydrodynamics written by Daniel Price:
5 !
6 ! http://users.monash.edu.au/~dprice/splash
7 !
8 ! SPLASH comes with ABSOLUTELY NO WARRANTY.
9 ! This is free software; and you are welcome to redistribute
10 ! it under the terms of the GNU General Public License
11 ! (see LICENSE file for details) and the provision that
12 ! this notice remains intact. If you modify this file, please
13 ! note section 2a) of the GPLv2 states that:
14 !
15 ! a) You must cause the modified files to carry prominent notices
16 ! stating that you changed the files and the date of any change.
17 !
18 ! Copyright (C) 2005-2010 Daniel Price. All rights reserved.
19 ! Contact: [email protected]
20 !
21 !-----------------------------------------------------------------
22
23 !-------------------------------------------------------------------------
24 ! Module containing settings and options relating to power spectrum
25 ! and Probability Distribution Function plots
26 ! includes default values of these options and submenu for changing them
27 !-------------------------------------------------------------------------
28 module settings_powerspec
29 implicit none
30 integer :: ipowerspecy, ipowerspecx, nfreqspec
31 integer :: nwavelengths,npdfbins
32 logical :: idisordered
33 real :: freqmax,freqmin
34
35 namelist /powerspecopts/ ipowerspecy,idisordered,nwavelengths,nfreqspec,npdfbins,freqmin,freqmax
36
37 contains
38
39 !---------------------------------------------
40 ! set default values for these options
41 !---------------------------------------------
42 subroutine defaults_set_powerspec
43 use settings_data, only:ndim
44
45 idisordered = .true.
46 ipowerspecy = max(ndim+1,2)
47 ipowerspecx = 0 ! reset later
48 nwavelengths = 128
49 freqmin = 1.0
50 freqmax = nwavelengths*freqmin
51 nfreqspec = 1
52 npdfbins = 0
53
54 return
55 end subroutine defaults_set_powerspec
56
57 !----------------------------------------------------------------------
58 ! sets options and parameters for power spectrum calculation/plotting
59 !----------------------------------------------------------------------
60 subroutine options_powerspec
61 use settings_data, only:ndim,ndataplots,numplot
62 use limits, only:lim
63 use labels, only:ipowerspec
64 use prompting, only:prompt
65 real :: boxsize
66
67 if (ipowerspecy < ndim+1) ipowerspecy = ndim+1
68 if (ipowerspecy > ndataplots) ipowerspecy = ndataplots
69 call prompt('enter data to take power spectrum of',ipowerspecy,ndim+1,ndataplots)
70 if (ipowerspecx /= 1) then
71 if (ipowerspecx < 1) ipowerspecx = 1
72 if (ipowerspecx > ndataplots) ipowerspecx = ndataplots
73 call prompt('enter column to use as "time" or "space"',ipowerspecx,1,ndataplots)
74 endif
75 !
76 !--if box size has not been set then use x limits
77 !
78 if (abs(freqmin-1.0) < tiny(1.)) then
79 boxsize = abs(lim(1,2) - lim(1,1))
80 if (boxsize > tiny(boxsize)) freqmin = 1./boxsize
81 endif
82 call prompt('enter min frequency (default=1/box size)',freqmin,0.0)
83 call prompt('enter max frequency ',freqmax,min=freqmin)
84
85 if (ipowerspec <= ndataplots .or. ipowerspec > numplot) then
86 !--this should never happen
87 print*,'*** ERROR: something wrong in powerspectrum limit setting'
88 else
89 print*,' wavelength range ',1./freqmax,'->',1./freqmin
90 lim(ipowerspec,1) = freqmin
91 lim(ipowerspec,2) = freqmax
92 print*,' frequency range ',lim(ipowerspec,1),'->',lim(ipowerspec,2)
93 if (nfreqspec <= 1) nfreqspec = 2*nwavelengths
94 call prompt('how many frequency points between these limits? ',nfreqspec,nwavelengths)
95 endif
96
97 !! call prompt('use Lomb periodogram? (no=interpolate and fourier) ',idisordered)
98
99 return
100 end subroutine options_powerspec
101
102 !-----------------------------------------------------------------
103 !
104 ! settings for PDF calculation
105 !
106 !-----------------------------------------------------------------
107 subroutine options_pdf
108 use prompting, only:prompt
109
110 call prompt(' Enter number of bins between min and max of plot (0=auto)',npdfbins,0)
111
112 end subroutine options_pdf
113
114 end module settings_powerspec