source: palm/trunk/SOURCE/user_parin.f90 @ 3175

Last change on this file since 3175 was 3174, checked in by Giersch, 6 years ago

Bugfix in reading NAMELIST user_parameters, bugfix in wind turbine model related to the check of vertical stretching

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