[1682] | 1 | !> @file user_parin.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 4 | ! |
---|
[2000] | 5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
| 6 | ! terms of the GNU General Public License as published by the Free Software |
---|
| 7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
| 8 | ! version. |
---|
[1036] | 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 | ! |
---|
[2718] | 17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[258] | 20 | ! Current revisions: |
---|
[211] | 21 | ! ----------------- |
---|
[1834] | 22 | ! |
---|
[3049] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: user_parin.f90 3049 2018-05-29 13:52:36Z gronemeier $ |
---|
[3049] | 27 | ! Error messages revised |
---|
| 28 | ! |
---|
| 29 | ! 3045 2018-05-28 07:55:41Z Giersch |
---|
[2932] | 30 | ! renamed userpar to user_parameters |
---|
| 31 | ! |
---|
| 32 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
[2716] | 33 | ! Corrected "Former revisions" section |
---|
| 34 | ! |
---|
| 35 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 36 | ! Change in file header (GPL part) |
---|
| 37 | ! |
---|
| 38 | ! 2512 2017-10-04 08:26:59Z raasch |
---|
[2512] | 39 | ! current interface revision number number set to r2512 |
---|
| 40 | ! |
---|
| 41 | ! 2298 2017-06-29 09:28:18Z raasch |
---|
[2298] | 42 | ! user interface current revision updated |
---|
| 43 | ! |
---|
| 44 | ! 2101 2017-01-05 16:42:31Z suehring |
---|
[1321] | 45 | ! |
---|
[2001] | 46 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 47 | ! Forced header and separation lines into 80 columns |
---|
| 48 | ! |
---|
[1834] | 49 | ! 1833 2016-04-07 14:23:03Z raasch |
---|
| 50 | ! required interface revision changed |
---|
| 51 | ! |
---|
[1784] | 52 | ! 1783 2016-03-06 18:36:17Z raasch |
---|
| 53 | ! required interface revision changed |
---|
| 54 | ! |
---|
[1683] | 55 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 56 | ! Code annotations made doxygen readable |
---|
| 57 | ! |
---|
[1669] | 58 | ! 1668 2015-09-23 13:45:36Z raasch |
---|
| 59 | ! current interface revision number number set to r1663 |
---|
| 60 | ! |
---|
[1667] | 61 | ! 1666 2015-09-23 07:31:10Z raasch |
---|
[1668] | 62 | ! interface revision number is set to blank |
---|
[1667] | 63 | ! |
---|
[1321] | 64 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 65 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 66 | ! kinds are defined in new module kinds, |
---|
| 67 | ! old module precision_kind is removed, |
---|
| 68 | ! revision history before 2012 removed, |
---|
| 69 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 70 | ! all variable declaration statements |
---|
[211] | 71 | ! |
---|
[1037] | 72 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 73 | ! code put under GPL (PALM 3.9) |
---|
| 74 | ! |
---|
[932] | 75 | ! 931 2012-06-08 15:09:28Z maronga |
---|
| 76 | ! Re-enabled check for max_pr_user |
---|
| 77 | ! |
---|
[842] | 78 | ! 841 2012-02-28 12:29:49Z maronga |
---|
| 79 | ! Bugfix: disable max_pr_user check during prior namelist file check |
---|
| 80 | ! |
---|
[226] | 81 | ! 217 2008-12-09 18:00:48Z letzel |
---|
| 82 | ! +topography_grid_convention |
---|
| 83 | ! Former file user_interface.f90 split into one file per subroutine |
---|
| 84 | ! |
---|
[211] | 85 | ! Description: |
---|
| 86 | ! ------------ |
---|
[1682] | 87 | !> Interface to read user-defined namelist-parameters. |
---|
[211] | 88 | !------------------------------------------------------------------------------! |
---|
[1682] | 89 | SUBROUTINE user_parin |
---|
| 90 | |
---|
[211] | 91 | |
---|
| 92 | USE control_parameters |
---|
[1320] | 93 | |
---|
| 94 | USE kinds |
---|
| 95 | |
---|
[211] | 96 | USE pegrid |
---|
[1320] | 97 | |
---|
[211] | 98 | USE statistics |
---|
[1320] | 99 | |
---|
[211] | 100 | USE user |
---|
| 101 | |
---|
| 102 | IMPLICIT NONE |
---|
| 103 | |
---|
[2932] | 104 | CHARACTER (LEN=80) :: line !< |
---|
[211] | 105 | |
---|
[1682] | 106 | INTEGER(iwp) :: i !< |
---|
| 107 | INTEGER(iwp) :: j !< |
---|
| 108 | INTEGER(iwp) :: max_pr_user_tmp !< |
---|
[211] | 109 | |
---|
| 110 | |
---|
[1320] | 111 | NAMELIST /userpar/ data_output_pr_user, data_output_user, region, & |
---|
[553] | 112 | data_output_masks_user |
---|
[2932] | 113 | |
---|
| 114 | |
---|
| 115 | NAMELIST /user_parameters/ data_output_pr_user, data_output_user, region, & |
---|
| 116 | data_output_masks_user |
---|
[211] | 117 | |
---|
| 118 | ! |
---|
[1666] | 119 | !-- Set revision number of this default interface version. It will be checked within |
---|
| 120 | !-- the main program (palm). Please change the revision number in case that the |
---|
| 121 | !-- current revision does not match with previous revisions (e.g. if routines |
---|
| 122 | !-- have been added/deleted or if parameter lists in subroutines have been changed). |
---|
[2512] | 123 | user_interface_current_revision = 'r2512' |
---|
[1666] | 124 | |
---|
| 125 | ! |
---|
[211] | 126 | !-- Position the namelist-file at the beginning (it was already opened in |
---|
| 127 | !-- parin), search for user-defined namelist-group ("userpar", but any other |
---|
| 128 | !-- name can be choosed) and position the file at this line. |
---|
| 129 | REWIND ( 11 ) |
---|
| 130 | |
---|
[2932] | 131 | line = ' ' |
---|
| 132 | DO WHILE ( INDEX( line, '&user_parameters' ) == 0 ) |
---|
| 133 | READ ( 11, '(A)', END=10 ) line |
---|
[211] | 134 | ENDDO |
---|
| 135 | BACKSPACE ( 11 ) |
---|
| 136 | |
---|
| 137 | ! |
---|
| 138 | !-- Read user-defined namelist |
---|
| 139 | READ ( 11, userpar ) |
---|
[2932] | 140 | |
---|
[211] | 141 | user_defined_namelist_found = .TRUE. |
---|
| 142 | |
---|
[2932] | 143 | GOTO 12 |
---|
| 144 | |
---|
| 145 | |
---|
| 146 | 10 REWIND ( 11 ) |
---|
| 147 | |
---|
| 148 | line = ' ' |
---|
| 149 | DO WHILE ( INDEX( line, '&userpar' ) == 0 ) |
---|
| 150 | READ ( 11, '(A)', END=12 ) line |
---|
| 151 | ENDDO |
---|
| 152 | BACKSPACE ( 11 ) |
---|
| 153 | |
---|
[211] | 154 | ! |
---|
[2932] | 155 | !-- Read user-defined namelist |
---|
| 156 | READ ( 11, userpar ) |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | message_string = 'namelist userpar is deprecated and will be ' // & |
---|
[3046] | 160 | 'removed in near future. &Please use namelist ' // & |
---|
[2932] | 161 | 'user_parameters instead' |
---|
| 162 | CALL message( 'user_parin', 'PA0487', 0, 1, 0, 6, 0 ) |
---|
| 163 | |
---|
| 164 | user_defined_namelist_found = .TRUE. |
---|
| 165 | |
---|
| 166 | |
---|
| 167 | 12 CONTINUE |
---|
| 168 | |
---|
| 169 | ! |
---|
[211] | 170 | !-- Determine the number of user-defined profiles and append them to the |
---|
| 171 | !-- standard data output (data_output_pr) |
---|
[2932] | 172 | IF ( user_defined_namelist_found ) THEN |
---|
| 173 | max_pr_user_tmp = 0 |
---|
| 174 | IF ( data_output_pr_user(1) /= ' ' ) THEN |
---|
| 175 | i = 1 |
---|
| 176 | DO WHILE ( data_output_pr(i) /= ' ' .AND. i <= 100 ) |
---|
| 177 | i = i + 1 |
---|
| 178 | ENDDO |
---|
| 179 | j = 1 |
---|
| 180 | DO WHILE ( data_output_pr_user(j) /= ' ' .AND. j <= 100 ) |
---|
| 181 | data_output_pr(i) = data_output_pr_user(j) |
---|
| 182 | max_pr_user_tmp = max_pr_user_tmp + 1 |
---|
| 183 | i = i + 1 |
---|
| 184 | j = j + 1 |
---|
| 185 | ENDDO |
---|
| 186 | ENDIF |
---|
[211] | 187 | |
---|
[2932] | 188 | |
---|
[211] | 189 | ! |
---|
[2932] | 190 | !-- In case of a restart run, the number of user-defined profiles on the |
---|
| 191 | !-- restart file (already stored in max_pr_user) has to match the one given |
---|
| 192 | !-- for the current run |
---|
| 193 | IF ( TRIM( initializing_actions ) == 'read_restart_data' ) THEN |
---|
| 194 | IF ( max_pr_user /= max_pr_user_tmp ) THEN |
---|
| 195 | WRITE( message_string, * ) 'the number of user-defined profiles ',& |
---|
[3046] | 196 | 'given in data_output_pr (', max_pr_user_tmp, ') doe', & |
---|
[1320] | 197 | 'snot match the one ', & |
---|
[3046] | 198 | 'found in the restart file (', max_pr_user, & |
---|
[258] | 199 | ')' |
---|
[2932] | 200 | CALL message( 'user_parin', 'UI0009', 1, 2, 0, 6, 0 ) |
---|
| 201 | ENDIF |
---|
| 202 | ELSE |
---|
| 203 | max_pr_user = max_pr_user_tmp |
---|
[211] | 204 | ENDIF |
---|
[2932] | 205 | |
---|
[211] | 206 | ENDIF |
---|
[2932] | 207 | |
---|
| 208 | RETURN |
---|
[211] | 209 | |
---|
| 210 | END SUBROUTINE user_parin |
---|
| 211 | |
---|