1 | !> @file user_parin.f90 |
---|
2 | !--------------------------------------------------------------------------------! |
---|
3 | ! This file is part of PALM. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
7 | ! either version 3 of the License, or (at your option) any later version. |
---|
8 | ! |
---|
9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
12 | ! |
---|
13 | ! You should have received a copy of the GNU General Public License along with |
---|
14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
15 | ! |
---|
16 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: user_parin.f90 1818 2016-04-06 15:53:27Z hoffmann $ |
---|
26 | ! |
---|
27 | ! 1783 2016-03-06 18:36:17Z raasch |
---|
28 | ! required interface revision changed |
---|
29 | ! |
---|
30 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
31 | ! Code annotations made doxygen readable |
---|
32 | ! |
---|
33 | ! 1668 2015-09-23 13:45:36Z raasch |
---|
34 | ! current interface revision number number set to r1663 |
---|
35 | ! |
---|
36 | ! 1666 2015-09-23 07:31:10Z raasch |
---|
37 | ! interface revision number is set to blank |
---|
38 | ! |
---|
39 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
40 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
41 | ! kinds are defined in new module kinds, |
---|
42 | ! old module precision_kind is removed, |
---|
43 | ! revision history before 2012 removed, |
---|
44 | ! comment fields (!:) to be used for variable explanations added to |
---|
45 | ! all variable declaration statements |
---|
46 | ! |
---|
47 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
48 | ! code put under GPL (PALM 3.9) |
---|
49 | ! |
---|
50 | ! 931 2012-06-08 15:09:28Z maronga |
---|
51 | ! Re-enabled check for max_pr_user |
---|
52 | ! |
---|
53 | ! 841 2012-02-28 12:29:49Z maronga |
---|
54 | ! Bugfix: disable max_pr_user check during prior namelist file check |
---|
55 | ! |
---|
56 | ! 217 2008-12-09 18:00:48Z letzel |
---|
57 | ! +topography_grid_convention |
---|
58 | ! Former file user_interface.f90 split into one file per subroutine |
---|
59 | ! |
---|
60 | ! Description: |
---|
61 | ! ------------ |
---|
62 | !> Interface to read user-defined namelist-parameters. |
---|
63 | !------------------------------------------------------------------------------! |
---|
64 | SUBROUTINE user_parin |
---|
65 | |
---|
66 | |
---|
67 | USE control_parameters |
---|
68 | |
---|
69 | USE kinds |
---|
70 | |
---|
71 | USE pegrid |
---|
72 | |
---|
73 | USE statistics |
---|
74 | |
---|
75 | USE user |
---|
76 | |
---|
77 | IMPLICIT NONE |
---|
78 | |
---|
79 | CHARACTER (LEN=80) :: zeile !< |
---|
80 | |
---|
81 | INTEGER(iwp) :: i !< |
---|
82 | INTEGER(iwp) :: j !< |
---|
83 | INTEGER(iwp) :: max_pr_user_tmp !< |
---|
84 | |
---|
85 | |
---|
86 | NAMELIST /userpar/ data_output_pr_user, data_output_user, region, & |
---|
87 | data_output_masks_user |
---|
88 | |
---|
89 | ! |
---|
90 | !-- Set revision number of this default interface version. It will be checked within |
---|
91 | !-- the main program (palm). Please change the revision number in case that the |
---|
92 | !-- current revision does not match with previous revisions (e.g. if routines |
---|
93 | !-- have been added/deleted or if parameter lists in subroutines have been changed). |
---|
94 | user_interface_current_revision = 'r1783' |
---|
95 | |
---|
96 | ! |
---|
97 | !-- Position the namelist-file at the beginning (it was already opened in |
---|
98 | !-- parin), search for user-defined namelist-group ("userpar", but any other |
---|
99 | !-- name can be choosed) and position the file at this line. |
---|
100 | REWIND ( 11 ) |
---|
101 | |
---|
102 | zeile = ' ' |
---|
103 | DO WHILE ( INDEX( zeile, '&userpar' ) == 0 ) |
---|
104 | READ ( 11, '(A)', END=100 ) zeile |
---|
105 | ENDDO |
---|
106 | BACKSPACE ( 11 ) |
---|
107 | |
---|
108 | ! |
---|
109 | !-- Read user-defined namelist |
---|
110 | READ ( 11, userpar ) |
---|
111 | user_defined_namelist_found = .TRUE. |
---|
112 | |
---|
113 | ! |
---|
114 | !-- Determine the number of user-defined profiles and append them to the |
---|
115 | !-- standard data output (data_output_pr) |
---|
116 | max_pr_user_tmp = 0 |
---|
117 | IF ( data_output_pr_user(1) /= ' ' ) THEN |
---|
118 | i = 1 |
---|
119 | DO WHILE ( data_output_pr(i) /= ' ' .AND. i <= 100 ) |
---|
120 | i = i + 1 |
---|
121 | ENDDO |
---|
122 | j = 1 |
---|
123 | DO WHILE ( data_output_pr_user(j) /= ' ' .AND. j <= 100 ) |
---|
124 | data_output_pr(i) = data_output_pr_user(j) |
---|
125 | max_pr_user_tmp = max_pr_user_tmp + 1 |
---|
126 | i = i + 1 |
---|
127 | j = j + 1 |
---|
128 | ENDDO |
---|
129 | ENDIF |
---|
130 | |
---|
131 | ! |
---|
132 | !-- In case of a restart run, the number of user-defined profiles on the |
---|
133 | !-- restart file (already stored in max_pr_user) has to match the one given |
---|
134 | !-- for the current run |
---|
135 | IF ( TRIM( initializing_actions ) == 'read_restart_data' ) THEN |
---|
136 | IF ( max_pr_user /= max_pr_user_tmp ) THEN |
---|
137 | WRITE( message_string, * ) 'the number of user-defined profiles ', & |
---|
138 | 'given in &data_output_pr (', max_pr_user_tmp, ') doe', & |
---|
139 | 'snot match the one ', & |
---|
140 | '&found in the restart file (', max_pr_user, & |
---|
141 | ')' |
---|
142 | CALL message( 'user_parin', 'UI0009', 1, 2, 0, 6, 0 ) |
---|
143 | ENDIF |
---|
144 | ELSE |
---|
145 | max_pr_user = max_pr_user_tmp |
---|
146 | ENDIF |
---|
147 | |
---|
148 | 100 RETURN |
---|
149 | |
---|
150 | END SUBROUTINE user_parin |
---|
151 | |
---|