source: palm/trunk/SOURCE/read_var_list.f90 @ 1385

Last change on this file since 1385 was 1323, checked in by raasch, 10 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 34.8 KB
Line 
1 SUBROUTINE read_var_list
2
3!--------------------------------------------------------------------------------!
4! This file is part of PALM.
5!
6! PALM is free software: you can redistribute it and/or modify it under the terms
7! of the GNU General Public License as published by the Free Software Foundation,
8! either version 3 of the License, or (at your option) any later version.
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!
17! Copyright 1997-2014 Leibniz Universitaet Hannover
18!--------------------------------------------------------------------------------!
19!
20! Current revisions:
21! ------------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: read_var_list.f90 1323 2014-03-20 17:09:54Z raasch $
27!
28! 1322 2014-03-20 16:38:49Z raasch
29! REAL functions provided with KIND-attribute
30!
31! 1320 2014-03-20 08:40:49Z raasch
32! ONLY-attribute added to USE-statements,
33! kind-parameters added to all INTEGER and REAL declaration statements,
34! kinds are defined in new module kinds,
35! old module precision_kind is removed,
36! revision history before 2012 removed,
37! comment fields (!:) to be used for variable explanations added to
38! all variable declaration statements
39!
40! 1308 2014-03-13 14:58:42Z fricke
41! +do2d_xy_time_count, do2d_xz_time_count, do2d_yz_time_count,
42! +do3d_time_count
43!
44! 1253 2013-11-07 10:48:12Z fricke
45! Bugfix: add ref_state to read_parts_of_var_list, otherwise ref_state
46! is zero for initializing_actions = 'cyclic_fill'
47!
48! 1241 2013-10-30 11:36:58Z heinze
49! +nudging
50! +large_scale_forcing
51!
52! 1195 2013-07-01 12:27:57Z heinze
53! Bugfix: allocate ref_state
54!
55! 1179 2013-06-14 05:57:58Z raasch
56! +ref_state
57!
58! 1115 2013-03-26 18:16:16Z hoffmann
59! unused variables removed
60!
61! 1092 2013-02-02 11:24:22Z raasch
62! unused variables removed
63!
64! 1065 2012-11-22 17:42:36Z hoffmann
65! +nc, c_sedimentation, limiter_sedimentation, turbulence
66! -mu_constant, mu_constant_value
67!
68! 1053 2012-11-13 17:11:03Z hoffmann
69! necessary expansions according to the two new prognostic equations (nr, qr)
70! of the two-moment cloud physics scheme:
71! +bc_*_b, +bc_*_t, +bc_*_t_val, *_init, *_surface, *_surface_initial_change,
72! +*_vertical_gradient, +*_vertical_gradient_level, *_vertical_gradient_level_ind,
73! +surface_waterflux_*
74!
75! in addition, steering parameters parameters of the two-moment cloud physics
76! scheme:   
77! +cloud_scheme, +drizzle, +mu_constant, +mu_constant_value, +ventilation_effect
78!
79! 1036 2012-10-22 13:43:42Z raasch
80! code put under GPL (PALM 3.9)
81!
82! 1015 2012-09-27 09:23:24Z raasch
83! -adjust_mixing_length
84!
85! 1003 2012-09-14 14:35:53Z raasch
86! -grid_matching
87!
88! 1001 2012-09-13 14:08:46Z raasch
89! -cut_spline_overshoot, dt_fixed, last_dt_change, long_filter_factor,
90! overshoot_limit_*, ups_limit_*
91!
92! 978 2012-08-09 08:28:32Z fricke
93! -km_damp_max, outflow_damping_width
94! +pt_damping_factor, pt_damping_width
95! +z0h_factor
96!
97! 940 2012-07-09 14:31:00Z raasch
98! +neutral
99!
100! 927 2012-06-06 19:15:04Z raasch
101! +masking_method
102!
103! 849 2012-03-15 10:35:09Z raasch
104! first_call_advec_particles renamed first_call_lpm
105!
106! 824 2012-02-17 09:09:57Z raasch
107! +curvature_solution_effects
108!
109! Revision 1.1  1998/03/18 20:18:48  raasch
110! Initial revision
111!
112!
113! Description:
114! ------------
115! Reading values of global control variables from restart-file (binary format)
116!------------------------------------------------------------------------------!
117
118    USE arrays_3d,                                                             &
119        ONLY:  inflow_damping_factor, lad, mean_inflow_profiles, pt_init,      &
120               q_init, ref_state, sa_init, u_init, ug, v_init, vg
121
122    USE cloud_parameters,                                                      &
123        ONLY:  c_sedimentation, curvature_solution_effects,                    &
124               limiter_sedimentation, nc_const, ventilation_effect
125
126    USE control_parameters
127
128    USE grid_variables,                                                        &
129        ONLY:  dx, dy
130
131    USE indices,                                                               &
132        ONLY:  nz, nx, nx_on_file, ny, ny_on_file
133
134    USE model_1d,                                                              &
135        ONLY:  damp_level_1d, dt_pr_1d, dt_run_control_1d, end_time_1d
136
137    USE netcdf_control
138
139    USE particle_attributes,                                                   &
140        ONLY:  time_sort_particles
141
142    USE pegrid
143
144    USE statistics,                                                            &
145        ONLY:  statistic_regions, hom, hom_sum, pr_palm, u_max, u_max_ijk,     &
146               v_max, v_max_ijk, w_max, w_max_ijk
147
148    IMPLICIT NONE
149
150    CHARACTER (LEN=10) ::  binary_version, version_on_file
151    CHARACTER (LEN=30) ::  variable_chr
152
153
154    CALL check_open( 13 )
155
156!
157!-- Make version number check first
158    READ ( 13 )  version_on_file
159    binary_version = '3.9b'
160    IF ( TRIM( version_on_file ) /= TRIM( binary_version ) )  THEN
161       WRITE( message_string, * ) 'version mismatch concerning control ', &
162                                  'variables',                            &
163                                  '&version on file    = "',              &
164                                  TRIM( version_on_file ), '"',           &
165                                  '&version on program = "',              &
166                                  TRIM( binary_version ), '"'
167       CALL message( 'read_var_list', 'PA0296', 1, 2, 0, 6, 0 )
168    ENDIF
169
170!
171!-- Read number of PEs and horizontal index bounds of all PEs used in previous
172!-- run
173    READ ( 13 )  variable_chr
174    IF ( TRIM( variable_chr ) /= 'numprocs' )  THEN
175       WRITE( message_string, * ) 'numprocs not found in data from prior ', &
176                                  'run on PE ', myid
177       CALL message( 'read_var_list', 'PA0297', 1, 2, 0, 6, 0 )
178    ENDIF
179    READ ( 13 )  numprocs_previous_run
180
181    IF ( .NOT. ALLOCATED( hor_index_bounds_previous_run ) )  THEN
182       ALLOCATE( hor_index_bounds_previous_run(4,0:numprocs_previous_run-1) )
183    ENDIF
184
185    READ ( 13 )  variable_chr
186    IF ( TRIM( variable_chr ) /= 'hor_index_bounds' )  THEN
187       WRITE( message_string, * ) 'hor_index_bounds not found in data from ', &
188                                  'prior run on PE ', myid
189       CALL message( 'read_var_list', 'PA0298', 1, 2, 0, 6, 0 )
190    ENDIF
191    READ ( 13 )  hor_index_bounds_previous_run
192
193!
194!-- Read vertical number of gridpoints and number of different areas used
195!-- for computing statistics. Allocate arrays depending on these values,
196!-- which are needed for the following read instructions.
197    READ ( 13 )  variable_chr
198    IF ( TRIM( variable_chr ) /= 'nz' )  THEN
199       WRITE( message_string, * ) 'nz not found in data from prior run on PE ',&
200                                  myid
201       CALL message( 'read_var_list', 'PA0299', 1, 2, 0, 6, 0 )
202    ENDIF
203    READ ( 13 )  nz
204
205    READ ( 13 )  variable_chr
206    IF ( TRIM( variable_chr ) /= 'max_pr_user' )  THEN
207       WRITE( message_string, * ) 'max_pr_user not found in data from ', &
208                    'prior run on PE ', myid
209       CALL message( 'read_var_list', 'PA0300', 1, 2, 0, 6, 0 )
210    ENDIF
211    READ ( 13 )  max_pr_user    ! This value is checked against the number of
212                                ! user profiles given for the current run
213                                ! in routine user_parin (it has to match)
214
215    READ ( 13 )  variable_chr
216    IF ( TRIM( variable_chr ) /= 'statistic_regions' )  THEN
217       WRITE( message_string, * ) 'statistic_regions not found in data from ', &
218                    'prior run on PE ', myid
219       CALL message( 'read_var_list', 'PA0301', 1, 2, 0, 6, 0 )
220    ENDIF
221    READ ( 13 )  statistic_regions
222    IF ( .NOT. ALLOCATED( ug ) )  THEN
223       ALLOCATE( lad(0:nz+1), ug(0:nz+1), u_init(0:nz+1), vg(0:nz+1),    &
224                 v_init(0:nz+1), pt_init(0:nz+1), q_init(0:nz+1),        &
225                 ref_state(0:nz+1), sa_init(0:nz+1),                     &
226                 hom(0:nz+1,2,pr_palm+max_pr_user,0:statistic_regions),  &
227                 hom_sum(0:nz+1,pr_palm+max_pr_user,0:statistic_regions) )
228    ENDIF
229
230!
231!-- Now read all control parameters:
232!-- Caution: When the following read instructions have been changed, the
233!-- -------  version number stored in the variable binary_version has to be
234!--          increased. The same changes must also be done in write_var_list.
235    READ ( 13 )  variable_chr
236    DO  WHILE ( TRIM( variable_chr ) /= '*** end ***' )
237
238       SELECT CASE ( TRIM( variable_chr ) )
239
240          CASE ( 'advected_distance_x' )
241             READ ( 13 )  advected_distance_x
242          CASE ( 'advected_distance_y' )
243             READ ( 13 )  advected_distance_y
244          CASE ( 'alpha_surface' )
245             READ ( 13 )  alpha_surface
246          CASE ( 'average_count_pr' )
247             READ ( 13 )  average_count_pr
248          CASE ( 'average_count_sp' )
249             READ ( 13 )  average_count_sp
250          CASE ( 'average_count_3d' )
251             READ ( 13 )  average_count_3d
252          CASE ( 'bc_e_b' )
253             READ ( 13 )  bc_e_b
254          CASE ( 'bc_lr' )
255             READ ( 13 )  bc_lr
256          CASE ( 'bc_ns' )
257             READ ( 13 )  bc_ns
258          CASE ( 'bc_p_b' )
259             READ ( 13 )  bc_p_b
260          CASE ( 'bc_p_t' )
261             READ ( 13 )  bc_p_t
262          CASE ( 'bc_pt_b' )
263             READ ( 13 )  bc_pt_b
264          CASE ( 'bc_pt_t' )
265             READ ( 13 )  bc_pt_t
266          CASE ( 'bc_pt_t_val' )
267             READ ( 13 )  bc_pt_t_val
268          CASE ( 'bc_q_b' )
269             READ ( 13 )  bc_q_b
270          CASE ( 'bc_q_t' )
271             READ ( 13 )  bc_q_t
272          CASE ( 'bc_q_t_val' )
273             READ ( 13 )  bc_q_t_val
274          CASE ( 'bc_s_b' )
275             READ ( 13 )  bc_s_b
276          CASE ( 'bc_s_t' )
277             READ ( 13 )  bc_s_t
278          CASE ( 'bc_sa_t' )
279             READ ( 13 )  bc_sa_t
280          CASE ( 'bc_uv_b' )
281             READ ( 13 )  bc_uv_b
282          CASE ( 'bc_uv_t' )
283             READ ( 13 )  bc_uv_t
284          CASE ( 'bottom_salinityflux' )
285             READ ( 13 )  bottom_salinityflux
286          CASE ( 'building_height' )
287             READ ( 13 )  building_height
288          CASE ( 'building_length_x' )
289             READ ( 13 )  building_length_x
290          CASE ( 'building_length_y' )
291             READ ( 13 )  building_length_y
292          CASE ( 'building_wall_left' )
293             READ ( 13 )  building_wall_left
294          CASE ( 'building_wall_south' )
295             READ ( 13 )  building_wall_south
296          CASE ( 'call_psolver_at_all_substeps' )
297             READ ( 13 )  call_psolver_at_all_substeps
298          CASE ( 'canopy_mode' )
299             READ ( 13 )  canopy_mode
300          CASE ( 'canyon_height' )
301             READ ( 13 )  canyon_height
302          CASE ( 'canyon_width_x' )
303             READ ( 13 )  canyon_width_x
304          CASE ( 'canyon_width_y' )
305             READ ( 13 )  canyon_width_y
306          CASE ( 'canyon_wall_left' )
307             READ ( 13 )  canyon_wall_left
308          CASE ( 'canyon_wall_south' )
309             READ ( 13 )  canyon_wall_south
310          CASE ( 'c_sedimentation' )
311             READ ( 13 )  c_sedimentation
312          CASE ( 'cfl_factor' )
313             READ ( 13 )  cfl_factor
314          CASE ( 'cloud_droplets' )
315             READ ( 13 )  cloud_droplets
316          CASE ( 'cloud_physics' )
317             READ ( 13 )  cloud_physics
318          CASE ( 'cloud_scheme' )
319             READ ( 13 )  cloud_scheme
320          CASE ( 'collective_wait' )
321             READ ( 13 )  collective_wait
322          CASE ( 'conserve_volume_flow' )
323             READ ( 13 )  conserve_volume_flow
324          CASE ( 'conserve_volume_flow_mode' )
325             READ ( 13 )  conserve_volume_flow_mode
326          CASE ( 'coupling_start_time' )
327             READ ( 13 )  coupling_start_time
328          CASE ( 'cthf' )
329             READ ( 13 )  cthf
330          CASE ( 'current_timestep_number' )
331             READ ( 13 )  current_timestep_number
332          CASE ( 'curvature_solution_effects' )
333             READ ( 13 )  curvature_solution_effects
334          CASE ( 'cycle_mg' )
335             READ ( 13 )  cycle_mg
336          CASE ( 'damp_level_1d' )
337             READ ( 13 )  damp_level_1d
338          CASE ( 'dissipation_1d' )
339             READ ( 13 )  dissipation_1d
340          CASE ( 'do2d_xy_time_count' )
341             READ ( 13 )  do2d_xy_time_count
342          CASE ( 'do2d_xz_time_count' )
343             READ ( 13 )  do2d_xz_time_count
344          CASE ( 'do2d_yz_time_count' )
345             READ ( 13 )  do2d_yz_time_count
346          CASE ( 'do3d_time_count' )
347             READ ( 13 )  do3d_time_count
348          CASE ( 'dp_external' )
349             READ ( 13 )  dp_external
350          CASE ( 'dp_level_b' )
351             READ ( 13 )  dp_level_b
352          CASE ( 'dp_smooth' )
353             READ ( 13 )  dp_smooth
354          CASE ( 'dpdxy' )
355             READ ( 13 )  dpdxy
356          CASE ( 'drag_coefficient' )
357             READ ( 13 )  drag_coefficient
358          CASE ( 'drizzle' )
359             READ ( 13 )  drizzle
360          CASE ( 'dt_pr_1d' )
361             READ ( 13 )  dt_pr_1d
362          CASE ( 'dt_run_control_1d' )
363             READ ( 13 )  dt_run_control_1d
364          CASE ( 'dt_3d' )
365             READ ( 13 )  dt_3d
366          CASE ( 'dvrp_filecount' )
367             READ ( 13 )  dvrp_filecount
368          CASE ( 'dx' )
369             READ ( 13 )  dx
370          CASE ( 'dy' )
371             READ ( 13 )  dy
372          CASE ( 'dz' )
373             READ ( 13 )  dz
374          CASE ( 'dz_max' )
375             READ ( 13 )  dz_max
376          CASE ( 'dz_stretch_factor' )
377             READ ( 13 )  dz_stretch_factor
378          CASE ( 'dz_stretch_level' )
379             READ ( 13 )  dz_stretch_level
380          CASE ( 'e_min' )
381             READ ( 13 )  e_min
382          CASE ( 'end_time_1d' )
383             READ ( 13 )  end_time_1d
384          CASE ( 'fft_method' )
385             READ ( 13 )  fft_method
386          CASE ( 'first_call_lpm' )
387             READ ( 13 )  first_call_lpm
388          CASE ( 'galilei_transformation' )
389             READ ( 13 )  galilei_transformation
390          CASE ( 'hom' )
391             READ ( 13 )  hom
392          CASE ( 'hom_sum' )
393             READ ( 13 )  hom_sum
394          CASE ( 'humidity' )
395             READ ( 13 )  humidity
396          CASE ( 'inflow_damping_factor' )
397             IF ( .NOT. ALLOCATED( inflow_damping_factor ) )  THEN
398                ALLOCATE( inflow_damping_factor(0:nz+1) )
399             ENDIF
400             READ ( 13 )  inflow_damping_factor
401          CASE ( 'inflow_damping_height' )
402             READ ( 13 )  inflow_damping_height
403          CASE ( 'inflow_damping_width' )
404             READ ( 13 )  inflow_damping_width
405          CASE ( 'inflow_disturbance_begin' )
406             READ ( 13 )  inflow_disturbance_begin
407          CASE ( 'inflow_disturbance_end' )
408             READ ( 13 )  inflow_disturbance_end
409          CASE ( 'km_constant' )
410             READ ( 13 )  km_constant
411          CASE ( 'lad' )
412             READ ( 13 )  lad
413          CASE ( 'lad_surface' )
414             READ ( 13 )  lad_surface
415          CASE ( 'lad_vertical_gradient' )
416             READ ( 13 )  lad_vertical_gradient
417          CASE ( 'lad_vertical_gradient_level' )
418             READ ( 13 )  lad_vertical_gradient_level
419          CASE ( 'lad_vertical_gradient_level_in' )
420             READ ( 13 )  lad_vertical_gradient_level_ind
421          CASE ( 'large_scale_forcing' )
422             READ ( 13 )  large_scale_forcing
423           CASE ( 'large_scale_subsidence' )
424             READ ( 13 )  large_scale_subsidence
425          CASE ( 'leaf_surface_concentration' )
426             READ ( 13 )  leaf_surface_concentration
427          CASE ( 'limiter_sedimentation' )
428             READ ( 13 )  limiter_sedimentation
429          CASE ( 'loop_optimization' )
430             READ ( 13 )  loop_optimization
431          CASE ( 'masking_method' )
432             READ ( 13 )  masking_method
433          CASE ( 'mean_inflow_profiles' )
434             IF ( .NOT. ALLOCATED( mean_inflow_profiles ) )  THEN
435                ALLOCATE( mean_inflow_profiles(0:nz+1,5) )
436             ENDIF
437             READ ( 13 )  mean_inflow_profiles
438          CASE ( 'mg_cycles' )
439             READ ( 13 )  mg_cycles
440          CASE ( 'mg_switch_to_pe0_level' )
441             READ ( 13 )  mg_switch_to_pe0_level
442          CASE ( 'mixing_length_1d' )
443             READ ( 13 )  mixing_length_1d
444          CASE ( 'momentum_advec' )
445             READ ( 13 )  momentum_advec
446          CASE ( 'nc_const' )
447             READ ( 13 )  nc_const
448          CASE ( 'netcdf_precision' )
449             READ ( 13 )  netcdf_precision
450          CASE ( 'neutral' )
451             READ ( 13 )  neutral
452          CASE ( 'ngsrb' )
453             READ ( 13 )  ngsrb
454          CASE ( 'nsor' )
455             READ ( 13 )  nsor
456          CASE ( 'nsor_ini' )
457             READ ( 13 )  nsor_ini
458          CASE ( 'nudging' )
459             READ ( 13 )  nudging
460          CASE ( 'nx' )
461             READ ( 13 )  nx
462             nx_on_file = nx
463          CASE ( 'ny' )
464             READ ( 13 )  ny
465             ny_on_file = ny
466          CASE ( 'ocean' )
467             READ ( 13 )  ocean
468          CASE ( 'old_dt' )
469             READ ( 13 )  old_dt
470          CASE ( 'omega' )
471             READ ( 13 )  omega
472          CASE ( 'omega_sor' )
473             READ ( 13 )  omega_sor
474          CASE ( 'output_for_t0' )
475             READ (13)    output_for_t0
476          CASE ( 'passive_scalar' )
477             READ ( 13 )  passive_scalar
478          CASE ( 'pch_index' )
479             READ ( 13 )  pch_index
480          CASE ( 'phi' )
481             READ ( 13 )  phi
482          CASE ( 'plant_canopy' )
483             READ ( 13 )  plant_canopy
484          CASE ( 'prandtl_layer' )
485             READ ( 13 )  prandtl_layer
486          CASE ( 'prandtl_number' )
487             READ ( 13 )  prandtl_number
488          CASE ( 'precipitation' )
489             READ ( 13 ) precipitation
490          CASE ( 'psolver' )
491             READ ( 13 )  psolver
492          CASE ( 'pt_damping_factor' )
493             READ ( 13 )  pt_damping_factor
494          CASE ( 'pt_damping_width' )
495             READ ( 13 )  pt_damping_width
496          CASE ( 'pt_init' )
497             READ ( 13 )  pt_init
498          CASE ( 'pt_reference' )
499             READ ( 13 )  pt_reference
500          CASE ( 'pt_surface' )
501             READ ( 13 )  pt_surface
502          CASE ( 'pt_surface_initial_change' )
503             READ ( 13 )  pt_surface_initial_change
504          CASE ( 'pt_vertical_gradient' )
505             READ ( 13 )  pt_vertical_gradient
506          CASE ( 'pt_vertical_gradient_level' )
507             READ ( 13 )  pt_vertical_gradient_level
508          CASE ( 'pt_vertical_gradient_level_ind' )
509             READ ( 13 )  pt_vertical_gradient_level_ind
510          CASE ( 'q_init' )
511             READ ( 13 )  q_init
512          CASE ( 'q_surface' )
513             READ ( 13 )  q_surface
514          CASE ( 'q_surface_initial_change' )
515             READ ( 13 )  q_surface_initial_change
516          CASE ( 'q_vertical_gradient' )
517             READ ( 13 )  q_vertical_gradient
518          CASE ( 'q_vertical_gradient_level' )
519             READ ( 13 )  q_vertical_gradient_level
520          CASE ( 'q_vertical_gradient_level_ind' )
521             READ ( 13 )  q_vertical_gradient_level_ind
522          CASE ( 'radiation' )
523             READ ( 13 )  radiation
524          CASE ( 'random_generator' )
525             READ ( 13 )  random_generator
526          CASE ( 'random_heatflux' )
527             READ ( 13 )  random_heatflux
528          CASE ( 'rayleigh_damping_factor' )
529             READ ( 13 )  rayleigh_damping_factor
530          CASE ( 'rayleigh_damping_height' )
531             READ ( 13 )  rayleigh_damping_height
532          CASE ( 'recycling_width' )
533             READ ( 13 )  recycling_width
534          CASE ( 'reference_state' )
535             READ ( 13 )  reference_state
536          CASE ( 'ref_state' )
537             READ ( 13 )  ref_state
538          CASE ( 'residual_limit' )
539             READ ( 13 )  residual_limit
540          CASE ( 'rif_max' )
541             READ ( 13 )  rif_max
542          CASE ( 'rif_min' )
543             READ ( 13 )  rif_min
544          CASE ( 'roughness_length' )
545             READ ( 13 )  roughness_length
546          CASE ( 'runnr' )
547             READ ( 13 )  runnr
548          CASE ( 'run_coupled' )
549             READ ( 13 )  run_coupled
550          CASE ( 'sa_init' )
551             READ ( 13 )  sa_init
552          CASE ( 'sa_surface' )
553             READ ( 13 )  sa_surface
554          CASE ( 'sa_vertical_gradient' )
555             READ ( 13 )  sa_vertical_gradient
556          CASE ( 'sa_vertical_gradient_level' )
557             READ ( 13 )  sa_vertical_gradient_level
558          CASE ( 'scalar_advec' )
559             READ ( 13 )  scalar_advec
560          CASE ( 'scalar_exchange_coefficient' )
561             READ ( 13 )  scalar_exchange_coefficient
562          CASE ( 'simulated_time' )
563             READ ( 13 )  simulated_time
564          CASE ( 'surface_heatflux' )
565             READ ( 13 )  surface_heatflux
566          CASE ( 'surface_pressure' )
567             READ ( 13 )  surface_pressure
568          CASE ( 'surface_scalarflux' )
569             READ ( 13 )  surface_scalarflux             
570          CASE ( 'surface_waterflux' )
571             READ ( 13 )  surface_waterflux     
572          CASE ( 's_surface' )
573             READ ( 13 )  s_surface
574          CASE ( 's_surface_initial_change' )
575             READ ( 13 )  s_surface_initial_change
576          CASE ( 's_vertical_gradient' )
577             READ ( 13 )  s_vertical_gradient
578          CASE ( 's_vertical_gradient_level' )
579             READ ( 13 )  s_vertical_gradient_level
580          CASE ( 'time_coupling' )
581             READ ( 13 )  time_coupling
582          CASE ( 'time_disturb' )
583             READ ( 13 )  time_disturb
584          CASE ( 'time_dopr' )
585             READ ( 13 )  time_dopr
586          CASE ( 'time_domask' )
587             READ ( 13 )  time_domask
588          CASE ( 'time_dopr_av' )
589             READ ( 13 )  time_dopr_av
590          CASE ( 'time_dopr_listing' )
591             READ ( 13 )  time_dopr_listing
592          CASE ( 'time_dopts' )
593             READ ( 13 )  time_dopts
594          CASE ( 'time_dosp' )
595             READ ( 13 )  time_dosp
596          CASE ( 'time_dots' )
597             READ ( 13 )  time_dots
598          CASE ( 'time_do2d_xy' )
599             READ ( 13 )  time_do2d_xy
600          CASE ( 'time_do2d_xz' )
601             READ ( 13 )  time_do2d_xz
602          CASE ( 'time_do2d_yz' )
603             READ ( 13 )  time_do2d_yz
604          CASE ( 'time_do3d' )
605             READ ( 13 )  time_do3d
606          CASE ( 'time_do_av' )
607             READ ( 13 )  time_do_av
608          CASE ( 'time_do_sla' )
609             READ ( 13 )  time_do_sla
610          CASE ( 'time_dvrp' )
611             READ ( 13 )  time_dvrp
612          CASE ( 'time_restart' )
613             READ ( 13 )  time_restart
614          CASE ( 'time_run_control' )
615             READ ( 13 )  time_run_control
616          CASE ( 'time_since_reference_point' )
617             READ ( 13 )  time_since_reference_point
618          CASE ( 'time_sort_particles' )
619             READ ( 13 )  time_sort_particles
620          CASE ( 'timestep_scheme' )
621             READ ( 13 )  timestep_scheme
622          CASE ( 'topography' )
623             READ ( 13 )  topography
624          CASE ( 'topography_grid_convention' )
625             READ ( 13 )  topography_grid_convention
626          CASE ( 'top_heatflux' )
627             READ ( 13 )  top_heatflux
628          CASE ( 'top_momentumflux_u' )
629             READ ( 13 )  top_momentumflux_u
630          CASE ( 'top_momentumflux_v' )
631             READ ( 13 )  top_momentumflux_v
632          CASE ( 'top_salinityflux' )
633             READ ( 13 )  top_salinityflux
634          CASE ( 'tsc' )
635             READ ( 13 )  tsc
636          CASE ( 'turbulence' )
637             READ ( 13 )  turbulence
638          CASE ( 'turbulent_inflow' )
639             READ ( 13 )  turbulent_inflow
640          CASE ( 'u_bulk' )
641             READ ( 13 )  u_bulk
642          CASE ( 'u_init' )
643             READ ( 13 )  u_init
644          CASE ( 'u_max' )
645             READ ( 13 )  u_max
646          CASE ( 'u_max_ijk' )
647             READ ( 13 )  u_max_ijk
648          CASE ( 'ug' )
649             READ ( 13 )  ug
650          CASE ( 'ug_surface' )
651             READ ( 13 )  ug_surface
652          CASE ( 'ug_vertical_gradient' )
653             READ ( 13 )  ug_vertical_gradient
654          CASE ( 'ug_vertical_gradient_level' )
655             READ ( 13 )  ug_vertical_gradient_level
656          CASE ( 'ug_vertical_gradient_level_ind' )
657             READ ( 13 )  ug_vertical_gradient_level_ind
658          CASE ( 'use_surface_fluxes' )
659             READ ( 13 )  use_surface_fluxes
660          CASE ( 'use_top_fluxes' )
661             READ ( 13 )  use_top_fluxes
662          CASE ( 'use_ug_for_galilei_tr' )
663             READ ( 13 )  use_ug_for_galilei_tr
664          CASE ( 'use_upstream_for_tke' )
665             READ ( 13 )  use_upstream_for_tke
666          CASE ( 'v_bulk' )
667             READ ( 13 )  v_bulk
668          CASE ( 'v_init' )
669             READ ( 13 )  v_init
670          CASE ( 'v_max' )
671             READ ( 13 )  v_max
672          CASE ( 'v_max_ijk' )
673             READ ( 13 )  v_max_ijk
674          CASE ( 'ventilation_effect' )
675             READ ( 13 )  ventilation_effect
676          CASE ( 'vg' )
677             READ ( 13 )  vg
678          CASE ( 'vg_surface' )
679             READ ( 13 )  vg_surface
680          CASE ( 'vg_vertical_gradient' )
681             READ ( 13 )  vg_vertical_gradient
682          CASE ( 'vg_vertical_gradient_level' )
683             READ ( 13 )  vg_vertical_gradient_level
684          CASE ( 'vg_vertical_gradient_level_ind' )
685             READ ( 13 )  vg_vertical_gradient_level_ind
686          CASE ( 'volume_flow_area' )
687             READ ( 13 )  volume_flow_area
688          CASE ( 'volume_flow_initial' )
689             READ ( 13 )  volume_flow_initial
690          CASE ( 'wall_adjustment' )
691             READ ( 13 )  wall_adjustment
692          CASE ( 'subs_vertical_gradient' )
693             READ ( 13 )  subs_vertical_gradient
694          CASE ( 'subs_vertical_gradient_level' )
695             READ ( 13 )  subs_vertical_gradient_level
696          CASE ( 'subs_vertical_gradient_level_i' )
697             READ ( 13 )  subs_vertical_gradient_level_i
698          CASE ( 'w_max' )
699             READ ( 13 )  w_max
700          CASE ( 'w_max_ijk' )
701             READ ( 13 )  w_max_ijk
702          CASE ( 'z0h_factor' )
703             READ ( 13 )  z0h_factor
704
705          CASE DEFAULT
706             WRITE( message_string, * ) 'unknown variable named "',         &
707                                        TRIM( variable_chr ), '" found in', &
708                                        ' data from prior run on PE ', myid 
709             CALL message( 'read_var_list', 'PA0302', 1, 2, 0, 6, 0 )
710        END SELECT
711!
712!--    Read next string
713       READ ( 13 )  variable_chr
714
715    ENDDO
716
717
718 END SUBROUTINE read_var_list
719
720
721
722 SUBROUTINE read_parts_of_var_list
723
724!------------------------------------------------------------------------------!
725! Description:
726! ------------
727! Skipping the global control variables from restart-file (binary format)
728! except some informations needed when reading restart data from a previous
729! run which used a smaller total domain or/and a different domain decomposition.
730!------------------------------------------------------------------------------!
731
732    USE arrays_3d,                                                             &
733        ONLY:  inflow_damping_factor, lad, mean_inflow_profiles, pt_init,      &
734               q_init, ref_state, sa_init, u_init, ug, v_init, vg
735
736    USE control_parameters
737
738    USE indices,                                                               &
739        ONLY:  nz, nx, nx_on_file, ny, ny_on_file
740
741    USE kinds
742
743    USE pegrid
744
745    USE statistics,                                                            &
746        ONLY:  statistic_regions, hom, hom_sum, pr_palm, u_max, u_max_ijk,     &
747               v_max, v_max_ijk, w_max, w_max_ijk
748
749    IMPLICIT NONE
750
751    CHARACTER (LEN=10) ::  version_on_file
752    CHARACTER (LEN=30) ::  variable_chr
753    CHARACTER (LEN=1)  ::  cdum
754
755    INTEGER(iwp) ::  max_pr_user_on_file
756    INTEGER(iwp) ::  nz_on_file
757    INTEGER(iwp) ::  statistic_regions_on_file
758    INTEGER(iwp) ::  tmp_mpru
759    INTEGER(iwp) ::  tmp_sr
760
761    REAL(wp), DIMENSION(:,:,:),   ALLOCATABLE ::  hom_sum_on_file
762    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  hom_on_file
763
764
765    CALL check_open( 13 )
766
767    WRITE (9,*) 'rpovl: after check open 13'
768    CALL local_flush( 9 )
769    READ ( 13 )  version_on_file
770
771!
772!-- Read number of PEs and horizontal index bounds of all PEs used in previous
773!-- run
774    READ ( 13 )  variable_chr
775    IF ( TRIM( variable_chr ) /= 'numprocs' )  THEN
776       WRITE( message_string, * ) 'numprocs not found in data from prior ', &
777                                  'run on PE ', myid
778       CALL message( 'read_parts_of_var_list', 'PA0297', 1, 2, 0, 6, 0 )
779    ENDIF
780    READ ( 13 )  numprocs_previous_run
781
782    IF ( .NOT. ALLOCATED( hor_index_bounds_previous_run ) )  THEN
783       ALLOCATE( hor_index_bounds_previous_run(4,0:numprocs_previous_run-1) )
784    ENDIF
785
786    READ ( 13 )  variable_chr
787    IF ( TRIM( variable_chr ) /= 'hor_index_bounds' )  THEN
788       WRITE( message_string, * ) 'hor_index_bounds not found in data from ', &
789                                  'prior run on PE ', myid
790       CALL message( 'read_parts_of_var_list', 'PA0298', 1, 2, 0, 6, 0 )
791    ENDIF
792    READ ( 13 )  hor_index_bounds_previous_run
793
794!
795!-- Read vertical number of gridpoints and number of different areas used
796!-- for computing statistics. Allocate arrays depending on these values,
797!-- which are needed for the following read instructions.
798    READ ( 13 )  variable_chr
799    IF ( TRIM( variable_chr ) /= 'nz' )  THEN
800       message_string = 'nz not found in restart data file'
801       CALL message( 'read_parts_of_var_list', 'PA0303', 1, 2, 0, 6, 0 )
802    ENDIF
803    READ ( 13 )  nz_on_file
804    IF ( nz_on_file /= nz )  THEN
805       WRITE( message_string, * ) 'mismatch concerning number of ',      &
806                                  'gridpoints along z',                  &
807                                  '&nz on file    = "', nz_on_file, '"', &
808                                  '&nz from run   = "', nz, '"'
809       CALL message( 'read_parts_of_var_list', 'PA0304', 1, 2, 0, 6, 0 )
810    ENDIF
811
812    READ ( 13 )  variable_chr
813    IF ( TRIM( variable_chr ) /= 'max_pr_user' )  THEN
814       message_string = 'max_pr_user not found in restart data file'
815       CALL message( 'read_parts_of_var_list', 'PA0305', 1, 2, 0, 6, 0 )
816    ENDIF
817    READ ( 13 )  max_pr_user_on_file
818    IF ( max_pr_user_on_file /= max_pr_user )  THEN
819       WRITE( message_string, * ) 'number of user profiles on res',           &
820                                  'tart data file differs from the current ', &
821                                  'run&max_pr_user on file    = "',           &
822                                  max_pr_user_on_file, '"',                   &
823                                  '&max_pr_user from run   = "',              &
824                                  max_pr_user, '"'
825       CALL message( 'read_parts_of_var_list', 'PA0306', 0, 0, 0, 6, 0 )
826       tmp_mpru = MIN( max_pr_user_on_file, max_pr_user )
827    ELSE
828       tmp_mpru = max_pr_user
829    ENDIF
830
831    READ ( 13 )  variable_chr
832    IF ( TRIM( variable_chr ) /= 'statistic_regions' )  THEN
833       message_string = 'statistic_regions not found in restart data file'
834       CALL message( 'read_parts_of_var_list', 'PA0307', 1, 2, 0, 6, 0 )
835    ENDIF
836    READ ( 13 )  statistic_regions_on_file
837    IF ( statistic_regions_on_file /= statistic_regions )  THEN
838       WRITE( message_string, * ) 'statistic regions on restart data file ',& 
839                                  'differ from the current run',            &
840                                  '&statistic regions on file    = "',      &
841                                  statistic_regions_on_file, '"',           &
842                                  '&statistic regions from run   = "',      &
843                                   statistic_regions, '"',                  &
844                                  '&statistic data may be lost!'
845       CALL message( 'read_parts_of_var_list', 'PA0308', 0, 1, 0, 6, 0 )
846       tmp_sr = MIN( statistic_regions_on_file, statistic_regions )
847    ELSE
848       tmp_sr = statistic_regions
849    ENDIF
850
851
852!
853!-- Now read and check some control parameters and skip the rest
854    WRITE (9,*) 'wpovl: begin reading variables'
855    CALL local_flush( 9 )
856    READ ( 13 )  variable_chr
857
858    DO  WHILE ( TRIM( variable_chr ) /= '*** end ***' )
859
860       SELECT CASE ( TRIM( variable_chr ) )
861
862          CASE ( 'average_count_pr' )
863             READ ( 13 )  average_count_pr
864             IF ( average_count_pr /= 0 )  THEN
865                WRITE( message_string, * ) 'inflow profiles not temporally ',  &
866                               'averaged. &Averaging will be done now using ', &
867                               average_count_pr, ' samples.'
868                CALL message( 'read_parts_of_var_list', 'PA0309', &
869                                                                 0, 1, 0, 6, 0 )
870             ENDIF
871
872          CASE ( 'hom' )
873             ALLOCATE( hom_on_file(0:nz+1,2,pr_palm+max_pr_user_on_file, &
874                       0:statistic_regions_on_file) )
875             READ ( 13 )  hom_on_file
876             hom(:,:,1:pr_palm+tmp_mpru,0:tmp_sr) = &
877                          hom_on_file(:,:,1:pr_palm+tmp_mpru,0:tmp_sr)
878             DEALLOCATE( hom_on_file )
879
880          CASE ( 'hom_sum' )
881             ALLOCATE( hom_sum_on_file(0:nz+1,pr_palm+max_pr_user_on_file, &
882                       0:statistic_regions_on_file) )
883             READ ( 13 )  hom_sum_on_file
884             hom_sum(:,1:pr_palm+tmp_mpru,0:tmp_sr) = &
885                          hom_sum_on_file(:,1:pr_palm+tmp_mpru,0:tmp_sr)
886             DEALLOCATE( hom_sum_on_file )
887
888          CASE ( 'nx' )
889             READ ( 13 )  nx_on_file
890
891          CASE ( 'ny' )
892             READ ( 13 )  ny_on_file
893
894          CASE ( 'ref_state' )
895             READ ( 13 )  ref_state
896
897
898          CASE DEFAULT
899
900             READ ( 13 )  cdum
901
902       END SELECT
903
904       READ ( 13 )  variable_chr
905
906    ENDDO
907
908!
909!-- Calculate the temporal average of vertical profiles, if neccessary
910    IF ( average_count_pr /= 0 )  THEN
911       hom_sum = hom_sum / REAL( average_count_pr, KIND=wp )
912    ENDIF
913
914
915 END SUBROUTINE read_parts_of_var_list
916
917
918
919 SUBROUTINE skip_var_list
920
921!------------------------------------------------------------------------------!
922! Description:
923! ------------
924! Skipping the global control variables from restart-file (binary format)
925!------------------------------------------------------------------------------!
926
927    IMPLICIT NONE
928
929    CHARACTER (LEN=10) ::  version_on_file
930    CHARACTER (LEN=30) ::  variable_chr
931
932    CHARACTER (LEN=1) ::  cdum
933
934
935    WRITE (9,*) 'skipvl #1'
936    CALL local_flush( 9 )
937    READ ( 13 )  version_on_file
938
939    WRITE (9,*) 'skipvl before variable_chr'
940    CALL local_flush( 9 )
941    READ ( 13 )  variable_chr
942    WRITE (9,*) 'skipvl after variable_chr'
943    CALL local_flush( 9 )
944
945    DO  WHILE ( TRIM( variable_chr ) /= '*** end ***' )
946
947    WRITE (9,*) 'skipvl chr = ', variable_chr
948    CALL local_flush( 9 )
949       READ ( 13 )  cdum
950       READ ( 13 )  variable_chr
951
952    ENDDO
953    WRITE (9,*) 'skipvl last'
954    CALL local_flush( 9 )
955
956
957 END SUBROUTINE skip_var_list
Note: See TracBrowser for help on using the repository browser.