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

Last change on this file since 1497 was 1497, checked in by maronga, 9 years ago

last commit documented

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