1 | !********************************************************************** |
---|
2 | ! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010 * |
---|
3 | ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa, * |
---|
4 | ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann * |
---|
5 | ! * |
---|
6 | ! This file is part of FLEXPART. * |
---|
7 | ! * |
---|
8 | ! FLEXPART is free software: you can redistribute it and/or modify * |
---|
9 | ! it under the terms of the GNU General Public License as published by* |
---|
10 | ! the Free Software Foundation, either version 3 of the License, or * |
---|
11 | ! (at your option) any later version. * |
---|
12 | ! * |
---|
13 | ! FLEXPART is distributed in the hope that it will be useful, * |
---|
14 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of * |
---|
15 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
---|
16 | ! GNU General Public License for more details. * |
---|
17 | ! * |
---|
18 | ! You should have received a copy of the GNU General Public License * |
---|
19 | ! along with FLEXPART. If not, see <http://www.gnu.org/licenses/>. * |
---|
20 | !********************************************************************** |
---|
21 | |
---|
22 | subroutine readageclasses |
---|
23 | |
---|
24 | !***************************************************************************** |
---|
25 | ! * |
---|
26 | ! This routine reads the age classes to be used for the current model * |
---|
27 | ! run. * |
---|
28 | ! * |
---|
29 | ! Author: A. Stohl * |
---|
30 | ! * |
---|
31 | ! 20 March 2000 * |
---|
32 | ! * |
---|
33 | !***************************************************************************** |
---|
34 | ! * |
---|
35 | ! Variables: * |
---|
36 | ! * |
---|
37 | ! Constants: * |
---|
38 | ! * |
---|
39 | !***************************************************************************** |
---|
40 | |
---|
41 | use par_mod |
---|
42 | use com_mod |
---|
43 | |
---|
44 | implicit none |
---|
45 | |
---|
46 | integer :: i |
---|
47 | |
---|
48 | |
---|
49 | ! If age spectra calculation is switched off, set number of age classes |
---|
50 | ! to 1 and maximum age to a large number |
---|
51 | !********************************************************************** |
---|
52 | |
---|
53 | if (lagespectra.ne.1) then |
---|
54 | nageclass=1 |
---|
55 | lage(nageclass)=999999999 |
---|
56 | return |
---|
57 | endif |
---|
58 | |
---|
59 | |
---|
60 | ! If age spectra claculation is switched on, |
---|
61 | ! open the AGECLASSSES file and read user options |
---|
62 | !************************************************ |
---|
63 | |
---|
64 | open(unitageclasses,file=path(1)(1:length(1))//'AGECLASSES', & |
---|
65 | status='old',err=999) |
---|
66 | |
---|
67 | do i=1,13 |
---|
68 | read(unitageclasses,*) |
---|
69 | end do |
---|
70 | read(unitageclasses,*) nageclass |
---|
71 | |
---|
72 | |
---|
73 | if (nageclass.gt.maxageclass) then |
---|
74 | write(*,*) ' #### FLEXPART MODEL ERROR! NUMBER OF AGE #### ' |
---|
75 | write(*,*) ' #### CLASSES GREATER THAN MAXIMUM ALLOWED. #### ' |
---|
76 | write(*,*) ' #### CHANGE SETTINGS IN FILE AGECLASSES OR #### ' |
---|
77 | write(*,*) ' #### RECOMPILE WITH LARGER MAXAGECLASS IN #### ' |
---|
78 | write(*,*) ' #### FILE PAR_MOD. #### ' |
---|
79 | stop |
---|
80 | endif |
---|
81 | |
---|
82 | read(unitageclasses,*) lage(1) |
---|
83 | if (lage(1).le.0) then |
---|
84 | write(*,*) ' #### FLEXPART MODEL ERROR! AGE OF FIRST #### ' |
---|
85 | write(*,*) ' #### CLASS MUST BE GREATER THAN ZERO. CHANGE #### ' |
---|
86 | write(*,*) ' #### SETTINGS IN FILE AGECLASSES. #### ' |
---|
87 | stop |
---|
88 | endif |
---|
89 | |
---|
90 | do i=2,nageclass |
---|
91 | read(unitageclasses,*) lage(i) |
---|
92 | if (lage(i).le.lage(i-1)) then |
---|
93 | write(*,*) ' #### FLEXPART MODEL ERROR! AGE CLASSES #### ' |
---|
94 | write(*,*) ' #### MUST BE GIVEN IN TEMPORAL ORDER. #### ' |
---|
95 | write(*,*) ' #### CHANGE SETTINGS IN FILE AGECLASSES. #### ' |
---|
96 | stop |
---|
97 | endif |
---|
98 | end do |
---|
99 | |
---|
100 | return |
---|
101 | |
---|
102 | 999 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "AGECLASSES" #### ' |
---|
103 | write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY #### ' |
---|
104 | write(*,'(a)') path(1)(1:length(1)) |
---|
105 | stop |
---|
106 | |
---|
107 | end subroutine readageclasses |
---|