libSUFR
a LIBrary of Some Useful Fortran Routines
All Classes Namespaces Files Functions Variables Pages
constants.f90
Go to the documentation of this file.
1!> \file constants.f90 Procedures to define and share constants
2
3
4! Copyright (c) 2002-2025 Marc van der Sluys - Nikhef/Utrecht University - marc.vandersluys.nl
5!
6! This file is part of the libSUFR package,
7! see: http://libsufr.sourceforge.net/
8!
9! This is free software: you can redistribute it and/or modify it under the terms of the European Union
10! Public Licence 1.2 (EUPL 1.2). This software is distributed in the hope that it will be useful, but
11! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12! PURPOSE. See the EU Public Licence for more details. You should have received a copy of the European
13! Union Public Licence along with this code. If not, see <https://www.eupl.eu/1.2/en/>.
14!
15!
16
17
18
19
20!***********************************************************************************************************************************
21!> \brief Provides all constants in the library, and routines to define them
22
24
25 use sufr_kinds, only: double, dbl, intkindmax, realkindmax !, max_accuracy_kinds
26
27 implicit none
28 private :: double, dbl, intkindmax, realkindmax !, max_accuracy_kinds
29 save
30
31
32 ! Mathematical/general constants - double precision:
33 real(double), parameter, public :: one = 1.0_dbl !< Unity
34 real(double), parameter, public :: c3rd = one/3.0_dbl !< One third
35 real(double), parameter, public :: two3rd = 2*c3rd !< Two thirds
36
37 real(double), parameter, public :: pio4 = atan(one) !< pi/4
38 real(double), parameter, public :: pio2 = 2*pio4 !< pi/2
39 real(double), parameter, public :: pi = 2*pio2 !< pi
40 real(double), parameter, public :: pi2 = 2*pi !< 2*pi
41
42 real(double), parameter, public :: r2d = 180.0_dbl/pi !< Radians to degrees
43 real(double), parameter, public :: d2r = one/r2d !< Degrees to radians
44 real(double), parameter, public :: r2h = 12.0_dbl/pi !< Radians to hours
45 real(double), parameter, public :: h2r = one/r2h !< Hours to radians
46 real(double), parameter, public :: h2d = 15.0_dbl !< Hours to degrees
47 real(double), parameter, public :: d2h = one/h2d !< Degrees to hours
48
49 real(double), parameter, public :: d2as = 3600.0_dbl !< Degrees to arcseconds
50 real(double), parameter, public :: as2d = one/d2as !< Arcseconds to degrees
51 real(double), parameter, public :: r2am = dble(180*60)/pi !< Radians to arcminutes
52 real(double), parameter, public :: am2r = one/r2am !< Arcminutes to radians
53 real(double), parameter, public :: r2as = r2am*60.0_dbl !< Radians to arcseconds
54 real(double), parameter, public :: as2r = one/r2as !< Arcseconds to radians
55 real(double), parameter, public :: r2mas = r2as*1000.0_dbl !< Radians to milliarcseconds
56 real(double), parameter, public :: mas2r = one/r2mas !< Milliarcseconds to radians
57
58 real(double), parameter, public :: c2k = 273.15d0 !< Degrees Celsius to Kelvin
59
60
61 ! Mathematical/general constants - single precision:
62 real, parameter, public :: rc3rd = real(c3rd) !< One third
63 real, parameter, public :: rtwo3rd = real(two3rd) !< Two thirds
64
65 real, parameter, public :: rpio4 = real(pio4) !< pi/4
66 real, parameter, public :: rpio2 = real(pio2) !< pi/2
67 real, parameter, public :: rpi = real(pi) !< pi
68 real, parameter, public :: rpi2 = real(pi2) !< 2*pi
69
70 real, parameter, public :: rr2d = real(r2d) !< Radians to degrees
71 real, parameter, public :: rd2r = real(d2r) !< Degrees to radians
72 real, parameter, public :: rr2h = real(r2h) !< Radians to hours
73 real, parameter, public :: rh2r = real(h2r) !< Hours to radians
74 real, parameter, public :: rh2d = real(h2d) !< Hours to degrees
75 real, parameter, public :: rd2h = real(d2h) !< Degrees to hours
76
77 real, parameter, public :: rd2as = real(d2as) !< Degrees to arcseconds
78 real, parameter, public :: ras2d = real(as2d) !< Arcseconds to degrees
79 real, parameter, public :: rr2am = real(r2am) !< Radians to arcminutes
80 real, parameter, public :: ram2r = real(am2r) !< Arcminutes to radians
81 real, parameter, public :: rr2as = real(r2as) !< Radians to arcseconds
82 real, parameter, public :: ras2r = real(as2r) !< Arcseconds to radians
83 real, parameter, public :: rr2mas = real(r2mas) !< Radians to milliarcseconds
84 real, parameter, public :: rmas2r = real(mas2r) !< Milliarcseconds to radians
85
86 real, parameter, public :: rc2k = real(c2k) !< Degrees Celsius to Kelvin
87
88
89
90 ! Physical constants - cgs (http://physics.nist.gov/cuu/Constants/ - 2016):
91 real(double), parameter, public :: pc_g = 6.67408d-8 !< Newton's gravitational constant, cm^3 g^-1 s^-2
92 real(double), parameter, public :: pc_c = 2.99792458d10 !< Speed of light in vacuo, cm s^-1
93 real(double), parameter, public :: pc_gr = 9.80665d2 !< Mean gravitational acceleration at the Earth's surface, cm s^-2
94
95 real(double), parameter, public :: pc_amu = 1.660539040d-24 !< Atomic mass unit; (mass of C12 atom)/12, g
96 real(double), parameter, public :: pc_mh = 1.007825d0*pc_amu !< Mass of a hydrogen atom
97
98 real(double), parameter, public :: pc_kb = 1.38064852d-16 !< Boltzmann constant, erg/K
99 real(double), parameter, public :: pc_hp = 6.626070040d-27 !< Planck's constant, erg s
100 real(double), parameter, public :: pc_hbar = pc_hp/pi2 !< Reduced Planck constant, erg s
101 real(double), parameter, public :: pc_arad = pc_kb**4/((pc_c*pc_hp)**3) * 8*pi**5/15.d0 !< Radiation (density) constant, 7.56591d-15 erg cm^-3 K^-4
102 real(double), parameter, public :: pc_sigma = pc_arad*pc_c*0.25d0 !< Stefan-Boltzmann constant, 5.67051d-5 erg cm^-2 K^-4 s^-1
103
104 real(double), parameter, public :: ev = 1.6021766208d-12 !< ElectronVolt in erg
105
106
107 real(double), parameter, public :: nm = 1.d-7 !< nanometer in cgs (cm)
108 real(double), parameter, public :: mum = 1.d-4 !< micrometer in cgs (cm)
109 real(double), parameter, public :: mm = 1.d-1 !< millimeter in cgs (cm)
110 real(double), parameter, public :: km = 1.d5 !< kilometer in cgs (cm)
111
112
113
114 ! Physical constants - SI:
115 real(double), parameter, public :: si_pc_g = pc_g * 1.d-3 !< Newton's gravitational constant, 6.67259d-11 m^3 kg^-1 s^-2
116 real(double), parameter, public :: si_pc_c = pc_c * 1.d-2 !< Speed of light in vacuo, 2.99792458d8 m s^-1
117 real(double), parameter, public :: si_pc_gr = pc_gr * 1.d-2 !< Mean gravitational acceleration at the Earth's surface, cm s^-2
118
119 real(double), parameter, public :: si_pc_amu = pc_amu * 1.d-3 !< Atomic mass unit; (mass of C12 atom)/12, 1.6605402d-27 kg
120 real(double), parameter, public :: si_pc_mh = 1.007825d0*si_pc_amu !< Mass of a hydrogen atom
121
122 real(double), parameter, public :: si_pc_kb = pc_kb * 1.d-7 !< Boltzmann constant, 1.380658d-23 J/K
123 real(double), parameter, public :: si_pc_hp = pc_hp * 1.d-7 !< Planck's constant, 6.6260755d-34 J s
124 real(double), parameter, public :: si_pc_hbar = si_pc_hp/pi2 !< Reduced Planck constant, J s
125 real(double), parameter, public :: si_pc_arad = si_pc_kb**4/((si_pc_c*si_pc_hp)**3) * 8*pi**5/15.d0 !< Radiation (density) constant, 7.56591d-15 erg cm^-3 K^-4
126 real(double), parameter, public :: si_pc_sigma = si_pc_arad*si_pc_c*0.25d0 !< Stefan-Boltzmann constant, 5.67051d-5 erg cm^-2 K^-4 s^-1
127
128 real(double), parameter, public :: si_ev = ev * 1.d-7 !< Elementary (|electron|) charge in Coulomb; ElectronVolt: 1.6021766d-19 J
129 real(double), parameter, public :: si_pc_ec = si_ev !< Elementary (|electron|) charge in Coulomb; ElectronVolt: 1.6021766d-19 J
130
131 real(double), parameter, public :: si_nm = nm * 1.d-2 !< nanometer in SI (m)
132 real(double), parameter, public :: si_mum = mum * 1.d-2 !< micrometer in SI (m)
133 real(double), parameter, public :: si_mm = mm * 1.d-2 !< millimeter in SI (m)
134 real(double), parameter, public :: si_km = km * 1.d-2 !< kilometer in SI (m)
135
136
137
138
139
140 ! Astronomical constants:
141 real(double), parameter, public :: au = 1.49597870700d13 !< A.U. in cgs (IAU 2009 Resolution B2, IAU XXVIII GA 2012 - Astr.Almanac 2014)
142 real(double), parameter, public :: si_au = au * 1.d-2 !< A.U. in SI (m)
143
144 real(double), parameter, public :: rsun = 6.9599d10 !< Solar radius in cgs (cm)
145 real(double), parameter, public :: msun = 1.9891d33 !< Solar mass in cgs (gm)
146 real(double), parameter, public :: lsun = 3.85d33 !< Solar luminosity in cgs (erg/s)
147
148 real(double), parameter, public :: si_rsun = rsun * 1.d-2 !< Solar radius in SI (m)
149 real(double), parameter, public :: si_msun = msun * 1.d-3 !< Solar mass in SI (kg)
150 real(double), parameter, public :: si_lsun = lsun * 1.d-7 !< Solar luminosity in SI (W)
151
152 real(double), parameter, public :: siday = 0.997269663d0 !< Siderial day in days
153 real(double), parameter, public :: solday = 8.64d4 !< Solar day = 86400 s
154 real(double), parameter, public :: solconst = 1361.5d0 !< Solar constant in W/m^2
155
156 ! True for J2000.0:
157 real(double), parameter, public :: gregmonth = 30.4369d0 * solday !< Gregorian month in seconds: average calendar month length of 4800 months over 400 years
158 real(double), parameter, public :: sidmonth = 27.321661547d0 * solday !< Sidereal month in seconds: fixed star to fixed star
159 real(double), parameter, public :: tropmonth = 27.321582241d0 * solday !< Tropical month in seconds: equinox to equinox, influenced by precession
160 real(double), parameter, public :: anomonth = 27.554549878d0 * solday !< Anomalistic month in seconds: apside to apside
161 real(double), parameter, public :: dracmonth = 27.212220817d0 * solday !< Draconic month in seconds: node to node
162 real(double), parameter, public :: synmonth = 29.530588853d0 * solday !< Synodic month in seconds: phase to phase
163
164 real(double), parameter, public :: julyear = 365.25d0 * solday !< Julian year in seconds: assumes 100 leap years in 400 years
165 real(double), parameter, public :: gregyear = 365.2425d0 * solday !< Gregorian year in seconds: assumes 97 leap years in 400 years
166 real(double), parameter, public :: sidyear = 365.256363051d0 * solday !< Siderial year in seconds: fixed star to fixed star
167 real(double), parameter, public :: tropyear = 365.24218967d0 * solday !< Tropical year in seconds: equinox to equinox, influenced by precession
168 real(double), parameter, public :: anomyear = 365.259635864d0 * solday !< Anomalistic year in seconds: apside to apside
169
170 real(double), parameter, public :: jd1875 = 2405890.d0 !< JD at J1875.0 (when constellation boundaries were defined)
171 real(double), parameter, public :: jd1900 = 2415021.d0 !< JD at J1900.0
172 real(double), parameter, public :: jd1950 = 2433283.d0 !< JD at J1950.0
173 real(double), parameter, public :: jd2000 = 2451545.d0 !< JD at J2000.0 (2000-01-01 12:00 UT)
174
175 real(double), parameter, public :: eps2000 = 0.409092804d0 !< Obliquity of the ecliptic at J2000.0
176
177 real(double), parameter, public :: earthr = 6378136.6d2 !< Equatorial radius of the Earth in cm, WGS84
178 real(double), parameter, public :: si_earthr = earthr * 1.d-2 !< Equatorial radius of the Earth in cm, WGS84
179
180 !> \brief Planet equatorial diameters (cm)
181 !! \note
182 !! - may be redefined if (3) = Earth -> not a constant
183 !! - Venus = 12103.6 + clouds? - e.g., Wikipedia
184 real(double), public :: pland(0:9) = [3476.206d5, 4879.4d5, 12198.d5, 2*rsun, 6792.4d5, 142984.d5, 120536.d5, 51118.d5, 49528.d5, 2390.d5]
185
186 !> \brief Planet equatorial radii (cm) = pland/2.d0
187 !! \note May be redefined if (3) = Earth -> not a constant
188 real(double), public :: planr(0:9) != pland/2.d0
189
190 !> \brief Planet semi-major axes (cm)
191 real(double), parameter, public :: plana(0:9) = [384400.d0/au*km, 0.3871d0, 0.7233d0, 1.d0, 1.5237d0, 5.2028d0, 9.5388d0, 19.191d0, 30.061d0, 39.529d0]*au
192
193 !> \brief Planet orbital periods (years - https://en.wikipedia.org/wiki/Orbital_period):
194 real(double), parameter, public :: planp(0:9) = [0.0748d0, 0.240846d0, 0.615198d0, 1.d0, 1.88082d0, 11.862d0, 29.4571d0, 84.0205d0, 164.8d0, 247.94d0]
195
196
197 ! SI:
198 real(double), public :: si_pland(0:9) !< Planet equatorial diameters (m)
199 real(double), public :: si_planr(0:9) !< Planet equatorial radii (m) = pland/2.d0
200 real(double), parameter, public :: si_plana(0:9) = plana(0:9) * 1.d-2 !< Planet semi-major axes (m)
201 real(double), parameter, public :: si_planp(0:9) = planp(0:9) * sidyear !< Planet orbital periods (s)
202
203
204 ! Satellites:
205 real(double),public :: satrad(4:8,30) !< Radii Galilean moons (cm)
206 real(double),public :: satdiam(4:8,30) !< Diameters Galilean moons (cm)
207
208 real(double),public :: si_satrad(4:8,30) !< Radii Galilean moons (m)
209 real(double),public :: si_satdiam(4:8,30) !< Diameters Galilean moons (m)
210
211
212 ! Planet names - not constants, since (3) may be changed in 'Earth':
213 ! en:
214 !> \brief Capitalised planet names
215 character, public :: enpname(-1:19)*(7) = [character(len=7) :: 'Antisol','Moon','Mercury','Venus','Sun','Mars','Jupiter','Saturn','Uranus','Neptune','Pluto','','Comet','','','','','','','','']
216 !> \brief Lower-case planet names
217 character, public :: enpnames(-1:19)*(7) = [character(len=7) :: 'antisol','moon','mercury','venus','sun','mars','jupiter', 'saturn','uranus','neptune','pluto','','Comet','','','','','','','','']
218 !> \brief Capitalised planet names; "the Moon"
219 character, public :: enpnamel(-1:19)*(8) = [character(len=8) :: 'Antisol','the Moon','Mercury','Venus','the Sun','Mars','Jupiter','Saturn','Uranus','Neptune','Pluto','','Comet','','','','','','','','']
220 !> \brief Capitalised planet names; "The Moon"
221 character, public :: enpnamelb(-1:19)*(8) = [character(len=8) :: 'Antisol','The Moon','Mercury','Venus','The Sun','Mars','Jupiter','Saturn','Uranus','Neptune','Pluto','','Comet','','','','','','','','']
222 !> \brief Capitalised planet abbreviations
223 character, public :: enpnamess(-1:19)*(4) = [character(len=4) :: 'A.S.','Moon','Mer.','Ven.','Sun','Mars','Jup.','Sat.','Ura.','Nep.','Plu.','','Com.','','','','','','','','']
224
225 !nl:
226 !> \brief Capitalised Dutch planet names
227 character, public :: nlpname(-1:19)*(9) = [character(len=9) :: 'Antizon','Maan','Mercurius','Venus','Zon','Mars','Jupiter','Saturnus','Uranus','Neptunus','Pluto','','Komeet','','','','','','','','']
228 !> \brief Lower-case Dutch planet names
229 character, public :: nlpnames(-1:19)*(9) = [character(len=9) :: 'antizon','maan','mercurius','venus','zon','mars','jupiter','saturnus','uranus','neptunus','pluto','','komeet','','','','','','','','']
230 !> \brief Capitalised Dutch planet names; "the Moon"
231 character, public :: nlpnamel(-1:19)*(9) = [character(len=9) :: 'Antizon','de Maan','Mercurius','Venus','de Zon','Mars','Jupiter','Saturnus','Uranus','Neptunus','Pluto','','Komeet','','','','','','','','']
232 !> \brief Capitalised Dutch planet names; "The Moon"
233 character, public :: nlpnamelb(-1:19)*(9) = [character(len=9) :: 'Antizon','De Maan','Mercurius','Venus','De Zon','Mars','Jupiter','Saturnus','Uranus','Neptunus','Pluto','','Komeet','','','','','','','','']
234 !> \brief Capitalised Dutch planet abbreviations
235 character, public :: nlpnamess(-1:19)*(4) = [character(len=4) :: 'A.Z.','Maan','Mer.','Ven.','Zon','Mars','Jup.','Sat.','Ura.','Nep.','Plu.','','Kom.','','','','','','','','']
236
237 !> \brief English names of Lunar phases
238 character, parameter, public :: enphases(0:3)*(13) = ['New Moon ','First Quarter','Full Moon ','Last Quarter ']
239 !> \brief Dutch names of Lunar phases
240 character, parameter, public :: nlphases(0:3)*(16) = ['Nieuwe Maan ','Eerste Kwartier ','Volle Maan ','Laatste Kwartier']
241
242
243
244 ! Month names:
245 ! en:
246 !> \brief Capitalised month names in English
247 character, parameter, public :: enmonths(12)*(9) = ['January ','February ','March ','April ','May ','June ','July ','August ','September','October ','November ','December ']
248 !> \brief Lower-case month names in English
249 character, parameter, public :: enmonthsm(12)*(9) = ['january ','february ','march ','april ','may ','june ','july ','august ','september','october ','november ','december ']
250 !> \brief Capitalised month abbreviations in English
251 character, parameter, public :: enmntsb(12)*(3) = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
252 !> \brief Lower-case month abbreviations in English
253 character, parameter, public :: enmnts(12)*(3) = ['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec']
254
255 ! nl:
256 !> \brief Lower-case month names in Dutch
257 character, parameter, public :: nlmonths(12)*(9) = ['januari ','februari ','maart ','april ','mei ','juni ','juli ','augustus ','september','oktober ','november ','december ']
258 !> \brief Capitalised month names in Dutch
259 character, parameter, public :: nlmonthsb(12)*(9) = ['Januari ','Februari ','Maart ','April ','Mei ','Juni ','Juli ','Augustus ','September','Oktober ','November ','December ']
260 !> \brief Capitalised month abbreviations in Dutch
261 character, parameter, public :: nlmntsb(12)*(3) = ['Jan','Feb','Mrt','Apr','Mei','Jun','Jul','Aug','Sep','Okt','Nov','Dec']
262 !> \brief Lower-case month abbreviations in Dutch
263 character, parameter, public :: nlmnts(12)*(3) = ['jan','feb','mrt','apr','mei','jun','jul','aug','sep','okt','nov','dec']
264
265
266 ! Days of the week:
267 ! en:
268 !> \brief Capitalised day-of-week names in English
269 character, parameter, public :: endays(0:6)*(9) = ['Sunday ','Monday ','Tuesday ','Wednesday','Thursday ','Friday ','Saturday ']
270 !> \brief Capitalised three-letter day-of-week abbreviations in English
271 character, parameter, public :: endys(0:6)*(3) = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
272 !> \brief Capitalised two-letter day-of-week abbreviations in English
273 character, parameter, public :: ends(0:6)*(2) = ['Su','Mo','Tu','We','Th','Fr','Sa']
274
275 ! nl:
276 !> \brief Lower-case day-of-week names in Dutch
277 character, parameter, public :: nldays(0:6)*(9) = ['zondag ','maandag ','dinsdag ','woensdag ','donderdag','vrijdag ','zaterdag ']
278 !> \brief Lower-case three-letter day-of-week abbreviations in Dutch
279 character, parameter, public :: nldys(0:6)*(4) = ['zon ','maa ','din ','woe ','don ','vrij','zat ']
280 !> \brief Lower-case two-letter day-of-week abbreviations in Dutch
281 character, parameter, public :: nlds(0:6)*(2) = ['zo','ma','di','wo','do','vr','za']
282
283
284 !> \brief Timezone names in Dutch
285 character, parameter, public :: nltimezones(0:1)*(10) = ['wintertijd','zomertijd ']
286
287
288 !> \brief Length of the months (for non-leap year)
289 !! \note Changes for leap years -> not a constant
290 integer, public :: mlen(12) = [31,28,31,30,31,30,31,31,30,31,30,31]
291
292
293 integer, public :: currentyear !< Year at system clock at the moment of initialisation (program start)
294 integer, public :: currentmonth !< Month at system clock at the moment of initialisation (program start)
295 integer, public :: currentday !< Day at system clock at the moment of initialisation (program start)
296 integer, public :: currenthour !< Hour at system clock at the moment of initialisation (program start)
297 integer, public :: currentminute !< Minute at system clock at the moment of initialisation (program start)
298 integer, public :: currentsecond !< Second at system clock at the moment of initialisation (program start)
299 integer, public :: currentmillisecond !< Millisecond at system clock at the moment of initialisation (program start)
300 integer, public :: currentdow !< Day of week at system clock at the moment of initialisation (program start)
301
302 real(double), public :: currentjd !< Julian day at system clock at the moment of initialisation (program start)
303 real(double), public :: currenttz !< Time zone at system clock at the moment of initialisation (program start)
304 real(double), public :: currenttime !< Time in hours at system clock at the moment of initialisation (program start)
305
306 character, public :: currentyearstr*(4) !< Current year as a character string (system clock at initialisation)
307 character, public :: currentdatestr*(10) !< Current date as an unambiguous character string YYYY-MM-DD
308 character, public :: currenttimestr*(8) !< Current time as a character string HH:MM:SS (system clock at initialisation)
309 character, public :: currenttimezonestr*(9) !< Current time zone as a character string UTC+_XX (system clock at initialisation)
310 character, public :: currentdatetimestr*(29) !< Current date, time and time zone as a character string (system clock at init)
311
312 character, public :: currentdatestren*(10) !< Current date as a US character string MM/DD/YYYY (system clock)
313 character, public :: currentdowstren*(9) !< Current English day of week as a character string (system clock)
314 character, public :: currentdatestrenl*(39) !< Current English date as long character string DayOfWeek Month DD YY (sys.clock)
315
316 character, public :: currentdatestrnl*(10) !< Current date as a Dutch/EU character string DD/MM/YYYY (system clock)
317 character, public :: currentdowstrnl*(9) !< Current Dutch day of week as a character string (system clock)
318 character, public :: currentdatestrnll*(39) !< Current Dutch date as a long character string DayOfWeek Month DD YY (sys.clock)
319
320
321
322 ! Character constants:
323 character, parameter, public :: tab = char(9) !< Tab character
324 !> \brief Lower-case English names for Greek characters
325 character, parameter, public :: engrchar(24)*(7) = [character(len=7) :: 'alpha','beta','gamma','delta','epsilon','zeta','eta','theta','iota','kappa','lambda', &
326 'mu','nu','xi','omicron','pi','rho','sigma','tau','upsilon','phi','chi','psi','omega']
327 !> \brief HTML codes for lower-case Greek characters
328 character, parameter, public :: htmlgrchar(24)*(9) = [character(len=9) :: '&alpha;','&beta;','&gamma;','&delta;','&epsilon;','&zeta;','&eta;','&theta;','&iota;', &
329 '&kappa;','&lambda;','&mu;','&nu;','&xi;','&omicron;','&pi;','&rho;','&sigma;','&tau;','&upsilon;','&phi;','&chi;','&psi;','&omega;']
330
331
332 ! Cursor movement:
333 character, parameter, public :: cursorup*(4) = char(27)//'[2A' !< Print this to move the cursor up one line on screen (need 2 lines since print gives a hard return)
334 character, parameter, public :: cursordown*(4) = char(27)//'[1B' !< Print this to move the cursor down one line (on screen)
335 character, parameter, public :: cursorright*(4) = char(27)//'[1C' !< Print this to move the cursor to the right one space
336 character, parameter, public :: cursorleft*(4) = char(27)//'[1D' !< Print this to move the cursor to the left one space
337
338 character, parameter, public :: newline*(2) = achar(13)//achar(10) !< Newline character: ASCII Carriage Return (13) + Line Feed (10)
339
340
341 integer, public :: stderr !< Default standard error unit for most (not all!) Fortran compilers
342 integer, public :: stdin !< Default standard input unit for most (not all!) Fortran compilers
343 integer, public :: stdout !< Default standard output unit for most (not all!) Fortran compilers
344
345 character, public :: homedir*(199) !< Current user's home directory (= $HOME, will contain e.g. '/home/user')
346 character, public :: workdir*(199) !< Current working directory (= $PWD, may contain e.g. '/home/user/myCode/...')
347 character, public :: hostname*(99) !< Host name (= $HOSTNAME - not always exported)
348 character, public :: username*(99) !< Name of the current user (= $USER)
349 character, public :: userid*(99) !< ID of the current user (= $UID)
350
351 character, public :: program_name*(199) !< Name of the currently running program, without the path
352 character, public :: program_path*(999) !< Path of the currently running program, without the program name
353 character, public :: program_args*(999) !< List of command-line arguments, separated by two spaces - may be truncated if longer than 999 characters
354
355
356contains
357
358
359 !*********************************************************************************************************************************
360 !> \brief Define the values of all the constants used in this package
361
363 implicit none
364
365 ! Get the kinds of the most accurate integer and real for the current compiler/system:
366 !call max_accuracy_kinds(intkindmax,realkindmax)
367
368 ! Set current date and time, etc.:
370
371 ! Cetera:
373
374
375 ! Set constants that cannot be defined at declaration (partly filled arrays, non-constant 'contants'):
376 ! Astronomical:
377 !> \brief Planet equatorial radii (cm)
378 !! \note may be redefined if (3) = Earth -> not a constant
379 planr(0:9) = pland/2.d0
380 !> \brief Planet equatorial diameters (m)
381 si_pland(0:9) = pland * 1.d-2
382 !> \brief Planet equatorial radii (m)
383 si_planr(0:9) = si_pland/2.d0
384
385 !> \brief Radii (Galilean) moons (cm)
386 satrad(5,1:4) = [1821.6,1560.8,2631.2,2410.3]*1.d5
387 !> \brief Diameters (Galilean) moons (cm)
388 satdiam = 2*satrad
389
390 !> \brief Radii (Galilean) moons (m)
391 si_satrad(5,1:4) = satrad(5,1:4) * 1.d-2
392 !> \brief Diameters (Galilean) moons (cm)
394
395 end subroutine set_sufr_constants
396 !*********************************************************************************************************************************
397
398
399 !*********************************************************************************************************************************
400 !> \brief Define the values of variables that describe the current date and time
401
404
405 implicit none
406 integer :: dt(8)
407 real(double) :: tz
408 character :: tmpStr*(99),tzStr*(9),signStr
409
410 ! Date/time variables:
411 call date_and_time(tmpstr,tmpstr,tmpstr,dt)
412 currentyear = dt(1)
413 currentmonth = dt(2)
414 currentday = dt(3)
415 currenthour = dt(5)
416 currentminute = dt(6)
417 currentsecond = dt(7)
418 currentmillisecond = dt(8) ! Not useful for timekeeping, but useful for random-number seeds
419 currenttime = dble(currenthour) + dble(currentminute)/60.d0 + dble(currentsecond)/3.6d3 + dble(currentmillisecond)/3.6d6 ! in hr
420
421 ! Time zone:
422 tz = abs(dble(dt(4))/60.d0)
423 write(tzstr,'(F5.2)') tz
424 !if(nint(tz).lt.10) write(tzStr,'(A1,F4.2)')'0',tz
425 if(nint(tz).lt.10) write(tzstr(1:1),'(A1)') '0'
426 signstr = '-'
427 if(dt(4).ge.0) signstr = '+'
428 write(currenttimezonestr,'(A)') 'UTC'//signstr//trim(tzstr)
429 if(dt(4).lt.0.d0) tz = -tz
430 currenttz = tz
431
432 ! JD, dow, dow strings:
437
438 write(currentyearstr,'(I4)') currentyear
439
440 write(currentdatestr,'(I4.4,A1,I2.2,A1,I2.2)') currentyear,'-',currentmonth,'-',currentday ! Unambiguous
441 write(currentdatestren,'(I2.2,A1,I2.2,A1,I4.4)') currentmonth,'/',currentday,'/',currentyear ! US
442 write(currentdatestrnl,'(I2.2,A1,I2.2,A1,I4.4)') currentday,'/',currentmonth,'/',currentyear ! EU
443
444 write(currentdatestrenl,'(A,1x,A,I3,I5)') trim(currentdowstren),trim(enmonths(currentmonth)),currentday,currentyear ! English
445 write(currentdatestrnll,'(A,I3,1x,A,I5)') trim(currentdowstrnl),currentday,trim(nlmonths(currentmonth)),currentyear ! Dutch
446
447 write(currenttimestr,'(I2.2,A1,I2.2,A1,I2.2)') currenthour,':',currentminute,':',currentsecond
448
449 write(currentdatetimestr,'(A)') trim(currentdatestr)//' '//trim(currenttimestr)//' '//trim(currenttimezonestr)
450
451 end subroutine set_sufr_constants_currentdate
452 !*********************************************************************************************************************************
453
454
455 !*********************************************************************************************************************************
456 !> \brief Define the values of constants that describe the working environment
457
459 implicit none
460 integer :: i, narg, status
461 character :: tmpStr*(999)
462
463 ! Standard error, input, and output
464 stderr = 0 ! Unit for standard error
465 stdin = 5 ! Unit for standard input
466 stdout = 6 ! Unit for standard output
467
468
469 ! Get info from environment variables:
470 call get_environment_variable('HOME', homedir) ! Set homeDir = $HOME, will contain e.g. '/home/user'
471 call get_environment_variable('PWD', workdir) ! Set workDir = $PWD, may contain e.g. '/home/user/foo'
472 call get_environment_variable('HOSTNAME', hostname) ! Set hostName = $HOSTNAME - not always exported
473 call get_environment_variable('USER', username) ! Set userName = $USER
474 call get_environment_variable('UID', userid) ! Set userid = $UID
475
476 ! Replace '/home/name' with '~' in workDir:
477 i = index(workdir,trim(homedir),back=.false.)
478 if(i.ne.0.and.i.lt.len_trim(workdir)) workdir = workdir(1:i-1)//'~'//trim(workdir(i+len_trim(homedir):))
479
480
481 ! Store the path and name of the program that is being executed in program_path and program_name:
482 call get_command_argument(0,tmpstr)
483 i = index(tmpstr,'/',back=.true.)
484 if(i.eq.0) then
485 program_path = ' '
486 program_name = trim(tmpstr)
487 else
488 program_path = trim(tmpstr(1:i)) ! The string before the last slash should be the program path
489 program_name = trim(tmpstr(i+1:)) ! The bit after the last slash should be the program name
490 end if
491
492 ! Store the command-line arguments of the program that is being executed in program_args:
493 narg = command_argument_count()
494 program_args = ' '
495 if(narg.ge.1) then
496 do i=1,narg
497 call get_command_argument(i,tmpstr)
498 write(program_args,'(A)', iostat=status) trim(program_args)//' '//trim(tmpstr)
499 if(status.ne.0) then
500 write(program_args,'(A)') program_args(1:len(program_args)-13)//' (truncated)'
501 exit ! Too many/long arguments
502 end if
503 end do
504 end if
505
506 end subroutine set_sufr_constants_environment
507 !*********************************************************************************************************************************
508
509
510end module sufr_constants
511!***********************************************************************************************************************************
512
513
Provides all constants in the library, and routines to define them.
Definition constants.f90:23
real(double), dimension(4:8, 30), public si_satrad
Radii Galilean moons (m)
real(double), parameter, public am2r
Arcminutes to radians.
Definition constants.f90:52
real, parameter, public ras2d
Arcseconds to degrees.
Definition constants.f90:78
integer, public stderr
Default standard error unit for most (not all!) Fortran compilers.
character, dimension(99), public hostname
Host name (= $HOSTNAME - not always exported)
character, dimension(9), parameter, public enmonthsm
Lower-case month names in English.
real(double), parameter, public h2r
Hours to radians.
Definition constants.f90:45
character, dimension(7), parameter, public engrchar
Lower-case English names for Greek characters.
character, dimension(99), public username
Name of the current user (= $USER)
real(double), parameter, public sidyear
Siderial year in seconds: fixed star to fixed star.
character, dimension(4), parameter, public cursorup
Print this to move the cursor up one line on screen (need 2 lines since print gives a hard return)
character, dimension(9), public nlpnamel
Capitalised Dutch planet names; "the Moon".
real(double), parameter, public si_pc_amu
Atomic mass unit; (mass of C12 atom)/12, 1.6605402d-27 kg.
real(double), parameter, public si_pc_g
Newton's gravitational constant, 6.67259d-11 m^3 kg^-1 s^-2.
real(double), parameter, public si_msun
Solar mass in SI (kg)
character, dimension(4), public enpnamess
Capitalised planet abbreviations.
real, parameter, public ras2r
Arcseconds to radians.
Definition constants.f90:82
character, dimension(8), public enpnamelb
Capitalised planet names; "The Moon".
real(double), parameter, public si_ev
Elementary (|electron|) charge in Coulomb; ElectronVolt: 1.6021766d-19 J.
real(double), parameter, public msun
Solar mass in cgs (gm)
real(double), parameter, public solday
Solar day = 86400 s.
real(double), public currenttz
Time zone at system clock at the moment of initialisation (program start)
character, dimension(8), public currenttimestr
Current time as a character string HH:MM:SS (system clock at initialisation)
character, dimension(10), public currentdatestr
Current date as an unambiguous character string YYYY-MM-DD.
real(double), parameter, public ev
ElectronVolt in erg.
real, parameter, public ram2r
Arcminutes to radians.
Definition constants.f90:80
character, dimension(39), public currentdatestrenl
Current English date as long character string DayOfWeek Month DD YY (sys.clock)
real(double), parameter, public pc_kb
Boltzmann constant, erg/K.
Definition constants.f90:98
real(double), parameter, public lsun
Solar luminosity in cgs (erg/s)
character, dimension(2), parameter, public newline
Newline character: ASCII Carriage Return (13) + Line Feed (10)
real(double), parameter, public solconst
Solar constant in W/m^2.
real(double), parameter, public si_pc_hbar
Reduced Planck constant, J s.
real, parameter, public rr2am
Radians to arcminutes.
Definition constants.f90:79
character, dimension(199), public program_name
Name of the currently running program, without the path.
real(double), parameter, public pio2
pi/2
Definition constants.f90:38
real(double), dimension(0:9), public si_pland
Planet equatorial diameters (m)
character, dimension(4), public nlpnamess
Capitalised Dutch planet abbreviations.
real(double), parameter, public tropmonth
Tropical month in seconds: equinox to equinox, influenced by precession.
real(double), parameter, public julyear
Julian year in seconds: assumes 100 leap years in 400 years.
character, dimension(9), parameter, public nlmonthsb
Capitalised month names in Dutch.
integer, public currentsecond
Second at system clock at the moment of initialisation (program start)
real(double), parameter, public si_au
A.U. in SI (m)
real(double), parameter, public si_pc_kb
Boltzmann constant, 1.380658d-23 J/K.
character, dimension(9), parameter, public htmlgrchar
HTML codes for lower-case Greek characters.
character, dimension(4), public currentyearstr
Current year as a character string (system clock at initialisation)
real(double), parameter, public si_pc_mh
Mass of a hydrogen atom.
real(double), parameter, public si_rsun
Solar radius in SI (m)
real, parameter, public rh2r
Hours to radians.
Definition constants.f90:73
real(double), dimension(0:9), public planr
Planet equatorial radii (cm) = pland/2.d0.
real(double), parameter, public pc_mh
Mass of a hydrogen atom.
Definition constants.f90:96
character, dimension(2), parameter, public ends
Capitalised two-letter day-of-week abbreviations in English.
real(double), parameter, public km
kilometer in cgs (cm)
character, dimension(99), public userid
ID of the current user (= $UID)
real(double), parameter, public as2d
Arcseconds to degrees.
Definition constants.f90:50
character, dimension(3), parameter, public enmntsb
Capitalised month abbreviations in English.
integer, public currenthour
Hour at system clock at the moment of initialisation (program start)
real, parameter, public rpio2
pi/2
Definition constants.f90:66
real(double), parameter, public as2r
Arcseconds to radians.
Definition constants.f90:54
real, parameter, public rd2as
Degrees to arcseconds.
Definition constants.f90:77
real(double), parameter, public pc_g
Newton's gravitational constant, cm^3 g^-1 s^-2.
Definition constants.f90:91
real(double), parameter, public synmonth
Synodic month in seconds: phase to phase.
real(double), dimension(0:9), parameter, public plana
Planet semi-major axes (cm)
real, parameter, public rr2as
Radians to arcseconds.
Definition constants.f90:81
character, dimension(39), public currentdatestrnll
Current Dutch date as a long character string DayOfWeek Month DD YY (sys.clock)
character, dimension(9), parameter, public nldays
Lower-case day-of-week names in Dutch.
real(double), dimension(0:9), parameter, public si_planp
Planet orbital periods (s)
character, dimension(13), parameter, public enphases
English names of Lunar phases.
real(double), parameter, public mas2r
Milliarcseconds to radians.
Definition constants.f90:56
subroutine set_sufr_constants_currentdate()
Define the values of variables that describe the current date and time.
real(double), parameter, public r2am
Radians to arcminutes.
Definition constants.f90:51
real(double), dimension(0:9), public pland
Planet equatorial diameters (cm)
character, dimension(8), public enpnamel
Capitalised planet names; "the Moon".
character, dimension(9), parameter, public enmonths
Capitalised month names in English.
real(double), parameter, public r2mas
Radians to milliarcseconds.
Definition constants.f90:55
character, dimension(4), parameter, public cursorright
Print this to move the cursor to the right one space.
integer, public currentmonth
Month at system clock at the moment of initialisation (program start)
real(double), parameter, public pc_c
Speed of light in vacuo, cm s^-1.
Definition constants.f90:92
real(double), parameter, public pio4
pi/4
Definition constants.f90:37
real(double), parameter, public jd1950
JD at J1950.0.
character, dimension(3), parameter, public enmnts
Lower-case month abbreviations in English.
real(double), parameter, public earthr
Equatorial radius of the Earth in cm, WGS84.
real(double), dimension(4:8, 30), public satdiam
Diameters Galilean moons (cm)
character, dimension(4), parameter, public cursorleft
Print this to move the cursor to the left one space.
real(double), parameter, public d2as
Degrees to arcseconds.
Definition constants.f90:49
real(double), parameter, public pi2
2*pi
Definition constants.f90:40
real, parameter, public rd2r
Degrees to radians.
Definition constants.f90:71
real(double), parameter, public pc_hp
Planck's constant, erg s.
Definition constants.f90:99
real(double), parameter, public si_pc_arad
Radiation (density) constant, 7.56591d-15 erg cm^-3 K^-4.
character, dimension(9), public nlpnames
Lower-case Dutch planet names.
real(double), parameter, public si_pc_c
Speed of light in vacuo, 2.99792458d8 m s^-1.
character, dimension(3), parameter, public nlmntsb
Capitalised month abbreviations in Dutch.
real(double), parameter, public si_pc_hp
Planck's constant, 6.6260755d-34 J s.
real(double), parameter, public pc_amu
Atomic mass unit; (mass of C12 atom)/12, g.
Definition constants.f90:95
subroutine set_sufr_constants
Define the values of all the constants used in this package.
real(double), parameter, public si_km
kilometer in SI (m)
real, parameter, public rpio4
pi/4
Definition constants.f90:65
real(double), parameter, public r2h
Radians to hours.
Definition constants.f90:44
real(double), parameter, public jd1900
JD at J1900.0.
character, dimension(9), parameter, public nlmonths
Lower-case month names in Dutch.
real(double), parameter, public dracmonth
Draconic month in seconds: node to node.
real, parameter, public rh2d
Hours to degrees.
Definition constants.f90:74
real(double), parameter, public one
Unity.
Definition constants.f90:33
real(double), parameter, public gregmonth
Gregorian month in seconds: average calendar month length of 4800 months over 400 years.
character, dimension(9), public currentdowstrnl
Current Dutch day of week as a character string (system clock)
real(double), parameter, public si_lsun
Solar luminosity in SI (W)
real(double), parameter, public pc_hbar
Reduced Planck constant, erg s.
real(double), parameter, public pc_sigma
Stefan-Boltzmann constant, 5.67051d-5 erg cm^-2 K^-4 s^-1.
real(double), parameter, public jd1875
JD at J1875.0 (when constellation boundaries were defined)
integer, public stdin
Default standard input unit for most (not all!) Fortran compilers.
character, dimension(10), public currentdatestrnl
Current date as a Dutch/EU character string DD/MM/YYYY (system clock)
real(double), parameter, public si_nm
nanometer in SI (m)
real(double), public currenttime
Time in hours at system clock at the moment of initialisation (program start)
character, dimension(999), public program_args
List of command-line arguments, separated by two spaces - may be truncated if longer than 999 charact...
real(double), parameter, public siday
Siderial day in days.
real, parameter, public rc2k
Degrees Celsius to Kelvin.
Definition constants.f90:86
real(double), parameter, public anomonth
Anomalistic month in seconds: apside to apside.
real(double), parameter, public c2k
Degrees Celsius to Kelvin.
Definition constants.f90:58
real(double), parameter, public two3rd
Two thirds.
Definition constants.f90:35
real(double), parameter, public pi
pi
Definition constants.f90:39
character, dimension(7), public enpname
Capitalised planet names.
character, dimension(9), public currenttimezonestr
Current time zone as a character string UTC+_XX (system clock at initialisation)
integer, public currentyear
Year at system clock at the moment of initialisation (program start)
real(double), parameter, public d2r
Degrees to radians.
Definition constants.f90:43
integer, public currentmillisecond
Millisecond at system clock at the moment of initialisation (program start)
character, dimension(9), parameter, public endays
Capitalised day-of-week names in English.
real(double), parameter, public pc_gr
Mean gravitational acceleration at the Earth's surface, cm s^-2.
Definition constants.f90:93
character, dimension(4), parameter, public cursordown
Print this to move the cursor down one line (on screen)
character, dimension(199), public workdir
Current working directory (= $PWD, may contain e.g. '/home/user/myCode/...')
integer, dimension(12), public mlen
Length of the months (for non-leap year)
real(double), dimension(0:9), public si_planr
Planet equatorial radii (m) = pland/2.d0.
real, parameter, public rpi2
2*pi
Definition constants.f90:68
real(double), parameter, public r2d
Radians to degrees.
Definition constants.f90:42
real(double), parameter, public tropyear
Tropical year in seconds: equinox to equinox, influenced by precession.
character, parameter, public tab
Tab character.
real, parameter, public rc3rd
One third.
Definition constants.f90:62
character, dimension(16), parameter, public nlphases
Dutch names of Lunar phases.
real(double), parameter, public si_pc_ec
Elementary (|electron|) charge in Coulomb; ElectronVolt: 1.6021766d-19 J.
character, dimension(2), parameter, public nlds
Lower-case two-letter day-of-week abbreviations in Dutch.
real(double), dimension(0:9), parameter, public si_plana
Planet semi-major axes (m)
character, dimension(29), public currentdatetimestr
Current date, time and time zone as a character string (system clock at init)
real(double), parameter, public eps2000
Obliquity of the ecliptic at J2000.0.
integer, public currentday
Day at system clock at the moment of initialisation (program start)
character, dimension(9), public nlpname
Capitalised Dutch planet names.
real(double), parameter, public mum
micrometer in cgs (cm)
real(double), parameter, public jd2000
JD at J2000.0 (2000-01-01 12:00 UT)
character, dimension(999), public program_path
Path of the currently running program, without the program name.
real(double), parameter, public r2as
Radians to arcseconds.
Definition constants.f90:53
real(double), parameter, public au
A.U. in cgs (IAU 2009 Resolution B2, IAU XXVIII GA 2012 - Astr.Almanac 2014)
real, parameter, public rd2h
Degrees to hours.
Definition constants.f90:75
real(double), parameter, public mm
millimeter in cgs (cm)
real, parameter, public rpi
pi
Definition constants.f90:67
real(double), parameter, public si_mum
micrometer in SI (m)
integer, public currentdow
Day of week at system clock at the moment of initialisation (program start)
real(double), public currentjd
Julian day at system clock at the moment of initialisation (program start)
real(double), parameter, public gregyear
Gregorian year in seconds: assumes 97 leap years in 400 years.
character, dimension(4), parameter, public nldys
Lower-case three-letter day-of-week abbreviations in Dutch.
character, dimension(3), parameter, public endys
Capitalised three-letter day-of-week abbreviations in English.
real(double), dimension(4:8, 30), public satrad
Radii Galilean moons (cm)
subroutine set_sufr_constants_environment()
Define the values of constants that describe the working environment.
character, dimension(10), public currentdatestren
Current date as a US character string MM/DD/YYYY (system clock)
real, parameter, public rtwo3rd
Two thirds.
Definition constants.f90:63
real, parameter, public rr2h
Radians to hours.
Definition constants.f90:72
real(double), parameter, public sidmonth
Sidereal month in seconds: fixed star to fixed star.
character, dimension(7), public enpnames
Lower-case planet names.
real(double), parameter, public anomyear
Anomalistic year in seconds: apside to apside.
real, parameter, public rr2mas
Radians to milliarcseconds.
Definition constants.f90:83
real(double), parameter, public si_mm
millimeter in SI (m)
character, dimension(3), parameter, public nlmnts
Lower-case month abbreviations in Dutch.
integer, public stdout
Default standard output unit for most (not all!) Fortran compilers.
real(double), parameter, public si_pc_gr
Mean gravitational acceleration at the Earth's surface, cm s^-2.
real(double), parameter, public d2h
Degrees to hours.
Definition constants.f90:47
real(double), parameter, public nm
nanometer in cgs (cm)
real(double), parameter, public si_earthr
Equatorial radius of the Earth in cm, WGS84.
character, dimension(9), public currentdowstren
Current English day of week as a character string (system clock)
real(double), parameter, public h2d
Hours to degrees.
Definition constants.f90:46
real(double), parameter, public rsun
Solar radius in cgs (cm)
real, parameter, public rr2d
Radians to degrees.
Definition constants.f90:70
real(double), dimension(0:9), parameter, public planp
Planet orbital periods (years - https://en.wikipedia.org/wiki/Orbital_period):
real, parameter, public rmas2r
Milliarcseconds to radians.
Definition constants.f90:84
real(double), parameter, public c3rd
One third.
Definition constants.f90:34
integer, public currentminute
Minute at system clock at the moment of initialisation (program start)
real(double), parameter, public pc_arad
Radiation (density) constant, 7.56591d-15 erg cm^-3 K^-4.
real(double), dimension(4:8, 30), public si_satdiam
Diameters Galilean moons (m)
character, dimension(9), public nlpnamelb
Capitalised Dutch planet names; "The Moon".
character, dimension(10), parameter, public nltimezones
Timezone names in Dutch.
real(double), parameter, public si_pc_sigma
Stefan-Boltzmann constant, 5.67051d-5 erg cm^-2 K^-4 s^-1.
character, dimension(199), public homedir
Current user's home directory (= $HOME, will contain e.g. '/home/user')
Procedures for manipulation of date and time.
elemental real(double) function ymdhms2jd(yy, mmo, dd, h, m, s)
Convert date and time (y,m,d, h,m,s) to JD. Input and output in UT.
elemental integer function dow_ut(jd0)
Calculates day of week (0 = Sunday, ..., 6 = Saturday). Output for timezone of input - call dow_ut(jd...
Provides kinds and related constants/routines.
Definition kinds.f90:26
integer, parameter intkindmax
Maximum integer kind:
Definition kinds.f90:39
integer, parameter double
Double-precision float. Precision = 15, range = 307.
Definition kinds.f90:35
integer, parameter dbl
Double-precision float. Precision = 15, range = 307.
Definition kinds.f90:36
integer, parameter realkindmax
Maximum real kind:
Definition kinds.f90:42