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

Last change on this file since 1195 was 1195, checked in by heinze, 11 years ago

bugfix in allocation of ref_state

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