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

Last change on this file since 2209 was 2101, checked in by suehring, 7 years ago

last commit documented

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