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