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

Last change on this file since 1306 was 1254, checked in by fricke, 10 years ago

last commit documented

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