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