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

Last change on this file since 1833 was 1833, checked in by raasch, 8 years ago

spectrum renamed spactra_par and further modularized, POINTER-attributes added in coupler-routines to avoid gfortran error messages

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