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