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