source: palm/trunk/SOURCE/parin.f90 @ 2338

Last change on this file since 2338 was 2338, checked in by gronemeier, 7 years ago

modularized 1d model

  • Property svn:keywords set to Id
File size: 28.6 KB
Line 
1!> @file parin.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: parin.f90 2338 2017-08-07 12:15:38Z gronemeier $
27! Modularize 1D model
28!
29!
30! Bugfix: re-arranged call for error messages for ENVPAR file
31!
32! 2304 2017-07-04 14:35:55Z suehring
33! Bugfix, enable restarts for child domain.
34!
35! 2298 2017-06-29 09:28:18Z raasch
36! -return_addres, return_username in ENVPAR, -cross_ts_uymax, cross_ts_uymin in
37! d3par
38!
39! 2296 2017-06-28 07:53:56Z maronga
40! Added parameters for model spinup
41!
42! 2292 2017-06-20 09:51:42Z schwenkel
43! Implementation of new microphysic scheme: cloud_scheme = 'morrison'
44! includes two more prognostic equations for cloud drop concentration (nc) 
45! and cloud water content (qc).
46!
47! 2267 2017-06-09 09:33:25Z gronemeier
48! Bugfix: removed skipping of reading namelists in case of omitted d3par
49!
50! 2259 2017-06-08 09:09:11Z gronemeier
51! Implemented synthetic turbulence generator
52!
53! 2233 2017-05-30 18:08:54Z suehring
54!
55! 2232 2017-05-30 17:47:52Z suehring
56! typo corrected
57! +wall_salinityflux
58! +tunnel_height, tunnel_lenght, tunnel_width_x, tunnel_width_y,
59!  tunnel_wall_depth
60!
61! 2118 2017-01-17 16:38:49Z raasch
62! -background_communication from inipar
63!
64! 2050 2016-11-08 15:00:55Z gronemeier
65! Implement turbulent outflow condition
66!
67! 2037 2016-10-26 11:15:40Z knoop
68! Anelastic approximation implemented
69!
70! 2035 2016-10-24 15:06:17Z suehring
71! Remove check for npex and npey in nesting case
72!
73! 2011 2016-09-19 17:29:57Z kanani
74! Added flag lsf_exception to allow explicit enabling of large scale forcing
75! together with buildings on flat terrain.
76!
77! 2007 2016-08-24 15:47:17Z kanani
78! Added call to urban surface model for reading of &urban_surface_par
79!
80! 2004 2016-08-24 10:25:59Z suehring
81! Humidity and passive scalar treated separately in nesting mode
82!
83! 2000 2016-08-20 18:09:15Z knoop
84! Forced header and separation lines into 80 columns
85!
86! 1992 2016-08-12 15:14:59Z suehring
87! +top_scalarflux
88!
89! 1960 2016-07-12 16:34:24Z suehring
90! Allocation of s_init
91!
92! 1957 2016-07-07 10:43:48Z suehring
93! flight module added
94!
95! 1955 2016-07-01 12:38:59Z hellstea
96! The parameter intializating_actions is set to 'set_constant_profiles for
97! all nest domains in order to make sure that diagnostic variables are properly
98! initialized for nest domains. Prognostic variables are later initialized by
99! interpolation from the parent domain.
100!
101! 1917 2016-05-27 14:28:12Z witha
102! Initial version of purely vertical nesting introduced.
103!
104! 1914 2016-05-26 14:44:07Z witha
105! Added call to wind turbine model for reading of &wind_turbine_par
106!
107! 1849 2016-04-08 11:33:18Z hoffmann
108! Adapted for modularization of microphysics
109!
110! 1833 2016-04-07 14:23:03Z raasch
111! call of spectra_parin
112!
113! 1831 2016-04-07 13:15:51Z hoffmann
114! turbulence renamed collision_turbulence, drizzle renamed
115! cloud_water_sedimentation
116! curvature_solution_effects removed
117!
118! 1826 2016-04-07 12:01:39Z maronga
119! Added call to radiation model for reading of &radiation_par.
120! Added call to plant canopy model for reading of &canopy_par.
121!
122! 1817 2016-04-06 15:44:20Z maronga
123! Added call to land surface model for reading of &lsm_par
124!
125! 1804 2016-04-05 16:30:18Z maronga
126! Removed code for parameter file check (__check)
127!
128! 1783 2016-03-06 18:36:17Z raasch
129! +netcdf_deflate in d3par, netcdf module and variable names changed
130!
131! 1764 2016-02-28 12:45:19Z raasch
132! cpp-statements for nesting removed, explicit settings of boundary conditions
133! in nest domains,
134! bugfix: npex/npey message moved from inipar to d3par
135! bugfix: check of lateral boundary conditions from check_parameters to here,
136! because they will be already used in init_pegrid and init_grid
137!
138! 1762 2016-02-25 12:31:13Z hellstea
139! Introduction of nested domain feature
140!
141! 1691 2015-10-26 16:17:44Z maronga
142! Added parameter most_method. Renamed prandtl_layer to constant_flux_layer.
143!
144! 1682 2015-10-07 23:56:08Z knoop
145! Code annotations made doxygen readable
146!
147! 1560 2015-03-06 10:48:54Z keck
148! +recycling_yshift
149!
150! 1496 2014-12-02 17:25:50Z maronga
151! Renamed: "radiation -> "cloud_top_radiation"
152!
153! 1484 2014-10-21 10:53:05Z kanani
154! Changes due to new module structure of the plant canopy model:
155!   canopy-model related parameters moved to new package canopy_par in
156!   subroutine package_parin
157!
158! 1429 2014-07-15 12:53:45Z knoop
159! +ensemble_member_nr to prepare the random_generator for ensemble runs
160!
161! 1402 2014-05-09 14:25:13Z raasch
162! location messages modified, batch_job included in envpar-NAMELIST
163!
164! 1384 2014-05-02 14:31:06Z raasch
165! location messages added
166!
167! 1365 2014-04-22 15:03:56Z boeske
168! Usage of large scale forcing enabled:
169! +use_subsidence_tendencies
170!
171! 1361 2014-04-16 15:17:48Z hoffmann
172! +call_microphysics_at_all_substeps
173!
174! 1359 2014-04-11 17:15:14Z hoffmann
175! REAL constants provided with KIND-attribute
176!
177! 1353 2014-04-08 15:21:23Z heinze
178! REAL constants provided with KIND-attribute
179!
180! 1327 2014-03-21 11:00:16Z raasch
181! -data_output_format, do3d_compress, do3d_comp_prec
182!
183! 1320 2014-03-20 08:40:49Z raasch
184! ONLY-attribute added to USE-statements,
185! kind-parameters added to all INTEGER and REAL declaration statements,
186! kinds are defined in new module kinds,
187! old module precision_kind is removed,
188! revision history before 2012 removed,
189! comment fields (!:) to be used for variable explanations added to
190! all variable declaration statements
191!
192! 1318 2014-03-17 13:35:16Z raasch
193! +cpu_log_barrierwait in d3par
194!
195! 1301 2014-03-06 13:29:46Z heinze
196! +large_scale_subsidence
197!
198! 1241 2013-10-30 11:36:58Z heinze
199! +nudging
200! +large_scale_forcing
201!
202! 1216 2013-08-26 09:31:42Z raasch
203! +transpose_compute_overlap in inipar
204!
205! 1195 2013-07-01 12:27:57Z heinze
206! Bugfix: allocate ref_state
207!
208! 1179 2013-06-14 05:57:58Z raasch
209! +reference_state in inipar
210!
211! 1159 2013-05-21 11:58:22Z fricke
212! +use_cmax
213!
214! 1128 2013-04-12 06:19:32Z raasch
215! +background_communication in inipar
216!
217! 1115 2013-03-26 18:16:16Z hoffmann
218! unused variables removed
219!
220! 1092 2013-02-02 11:24:22Z raasch
221! unused variables removed
222!
223! 1065 2012-11-22 17:42:36Z hoffmann
224! +nc, c_sedimentation, limiter_sedimentation, turbulence
225! -mu_constant, mu_constant_value
226!
227! 1053 2012-11-13 17:11:03Z hoffmann
228! necessary expansions according to the two new prognostic equations (nr, qr)
229! of the two-moment cloud physics scheme and steering parameters:
230! +*_init, *_surface, *_surface_initial_change, *_vertical_gradient,
231! +*_vertical_gradient_level, surface_waterflux_*,
232! +cloud_scheme, drizzle, mu_constant, mu_constant_value, ventilation_effect
233!
234! 1036 2012-10-22 13:43:42Z raasch
235! code put under GPL (PALM 3.9)
236!
237! 1015 2012-09-27 09:23:24Z raasch
238! -adjust_mixing_length
239!
240! 1003 2012-09-14 14:35:53Z raasch
241! -grid_matching
242!
243! 1001 2012-09-13 14:08:46Z raasch
244! -cut_spline_overshoot, long_filter_factor, overshoot_limit_*, ups_limit_*
245!
246! 996 2012-09-07 10:41:47Z raasch
247! -use_prior_plot1d_parameters
248!
249! 978 2012-08-09 08:28:32Z fricke
250! -km_damp_max, outflow_damping_width
251! +pt_damping_factor, pt_damping_width
252! +z0h_factor
253!
254! 964 2012-07-26 09:14:24Z raasch
255! -cross_normalized_x, cross_normalized_y, cross_xtext, z_max_do1d,
256! z_max_do1d_normalized
257!
258! 940 2012-07-09 14:31:00Z raasch
259! +neutral in inipar
260!
261! 927 2012-06-06 19:15:04Z raasch
262! +masking_method in inipar
263!
264! 824 2012-02-17 09:09:57Z raasch
265! +curvature_solution_effects in inipar
266!
267! 809 2012-01-30 13:32:58Z maronga
268! Bugfix: replaced .AND. and .NOT. with && and ! in the preprocessor directives
269!
270! 807 2012-01-25 11:53:51Z maronga
271! New cpp directive "__check" implemented which is used by check_namelist_files
272!
273! Revision 1.1  1997/07/24 11:22:50  raasch
274! Initial revision
275!
276!
277! Description:
278! ------------
279!> This subroutine reads variables controling the run from the NAMELIST files
280!------------------------------------------------------------------------------!
281 SUBROUTINE parin
282 
283
284    USE arrays_3d,                                                             &
285        ONLY:  pt_init, q_init, ref_state, s_init, sa_init, ug, u_init, v_init,&
286               vg
287
288    USE plant_canopy_model_mod,                                                &
289         ONLY: pcm_parin 
290
291    USE control_parameters
292
293    USE cpulog,                                                                &
294        ONLY:  cpu_log_barrierwait
295
296    USE dvrp_variables,                                                        &
297        ONLY:  local_dvrserver_running
298
299    USE flight_mod,                                                            &
300        ONLY:  flight_parin
301
302    USE grid_variables,                                                        &
303        ONLY:  dx, dy
304
305    USE indices,                                                               &
306        ONLY:  nx, ny, nz
307
308    USE kinds
309
310    USE land_surface_model_mod,                                                &
311        ONLY: lsm_parin
312
313    USE microphysics_mod,                                                      &
314        ONLY:  c_sedimentation, cloud_water_sedimentation,                     &
315               collision_turbulence, curvature_solution_effects_bulk,          &
316               limiter_sedimentation ,na_init, nc_const, ventilation_effect
317
318    USE model_1d_mod,                                                          &
319        ONLY:  damp_level_1d, dt_pr_1d, dt_run_control_1d, end_time_1d
320
321    USE pegrid
322
323    USE netcdf_interface,                                                      &
324        ONLY:  netcdf_data_format, netcdf_deflate, netcdf_precision
325
326    USE pmc_interface,                                                         &
327        ONLY:  nested_run, nesting_mode
328
329    USE profil_parameter,                                                      &
330        ONLY:  cross_profiles, profile_columns, profile_rows
331
332    USE progress_bar,                                                          &
333        ONLY :  batch_job
334
335    USE radiation_model_mod,                                                   &
336        ONLY: radiation_parin 
337
338    USE spectra_mod,                                                           &
339        ONLY :  spectra_parin
340
341    USE statistics,                                                            &
342        ONLY:  hom, hom_sum, pr_palm, region, statistic_regions
343
344    USE synthetic_turbulence_generator_mod,                                    &
345        ONLY:  stg_parin
346
347    USE urban_surface_mod,                                                     &
348        ONLY: usm_parin
349
350    USE wind_turbine_model_mod,                                                &
351        ONLY:  wtm_parin
352
353
354    IMPLICIT NONE
355
356    INTEGER(iwp) ::  i      !<
357    INTEGER(iwp) ::  ioerr  !< error flag for open/read/write
358
359
360    NAMELIST /inipar/  alpha_surface, approximation, bc_e_b, bc_lr,            &
361                       bc_ns, bc_p_b, bc_p_t, bc_pt_b, bc_pt_t, bc_q_b,        &
362             bc_q_t,bc_s_b, bc_s_t, bc_sa_t, bc_uv_b, bc_uv_t,                 &
363             bottom_salinityflux, building_height, building_length_x,          &
364             building_length_y, building_wall_left, building_wall_south,       &
365             call_psolver_at_all_substeps, call_microphysics_at_all_substeps,  &
366             canyon_height,                                                    &
367             canyon_width_x, canyon_width_y, canyon_wall_left,                 &
368             canyon_wall_south, c_sedimentation, cfl_factor, cloud_droplets,   &
369             cloud_physics, cloud_scheme, cloud_top_radiation,                 &
370             cloud_water_sedimentation,                                        &
371             collective_wait, collision_turbulence, conserve_volume_flow,      &
372             conserve_volume_flow_mode, constant_flux_layer,                   &
373             coupling_start_time, curvature_solution_effects_bulk,             &
374             cycle_mg, damp_level_1d,                                          &
375             data_output_during_spinup,                                        &
376             dissipation_1d,                                                   &
377             dp_external, dp_level_b, dp_smooth, dpdxy,                        &
378             dt, dt_pr_1d, dt_run_control_1d, dt_spinup, dx, dy, dz, dz_max,   &
379             dz_stretch_factor, dz_stretch_level, end_time_1d,                 &
380             ensemble_member_nr, e_init, e_min, fft_method,                    &
381             flux_input_mode, flux_output_mode,                                &
382             galilei_transformation, humidity,                                 &
383             inflow_damping_height, inflow_damping_width,                      &
384             inflow_disturbance_begin, inflow_disturbance_end,                 &
385             initializing_actions, km_constant,                                &
386             large_scale_forcing, large_scale_subsidence,                      &
387             limiter_sedimentation,                                            &
388             loop_optimization, lsf_exception, masking_method, mg_cycles,      &
389             mg_switch_to_pe0_level, mixing_length_1d, momentum_advec,         &
390             most_method, na_init, nc_const, netcdf_precision, neutral, ngsrb, &
391             nsor, nsor_ini, nudging, nx, ny, nz, ocean, omega, omega_sor,     &
392             outflow_source_plane, passive_scalar, phi,                        &
393             prandtl_number, precipitation, psolver, pt_damping_factor,        &
394             pt_damping_width, pt_reference, pt_surface,                       &
395             pt_surface_initial_change, pt_vertical_gradient,                  &
396             pt_vertical_gradient_level, q_surface, q_surface_initial_change,  &
397             q_vertical_gradient, q_vertical_gradient_level,                   &
398             random_generator, random_heatflux,                                &
399             rayleigh_damping_factor, rayleigh_damping_height,                 &
400             recycling_width, recycling_yshift,                                &
401             reference_state, residual_limit,                                  &
402             roughness_length, sa_surface,                                     &
403             sa_vertical_gradient, sa_vertical_gradient_level, scalar_advec,   &
404             scalar_rayleigh_damping,                                          &
405             spinup_time, spinup_pt_amplitude, spinup_pt_mean,                 &
406             statistic_regions, subs_vertical_gradient,                        &
407             subs_vertical_gradient_level, surface_heatflux, surface_pressure, &
408             surface_scalarflux, surface_waterflux,                            &
409             s_surface, s_surface_initial_change, s_vertical_gradient,         &
410             s_vertical_gradient_level, timestep_scheme,                       &
411             topography, topography_grid_convention, top_heatflux,             &
412             top_momentumflux_u, top_momentumflux_v, top_salinityflux,         &
413             top_scalarflux, transpose_compute_overlap,                        &
414             tunnel_height, tunnel_length, tunnel_width_x, tunnel_width_y,     &
415             tunnel_wall_depth,                                                &
416             turbulent_inflow, turbulent_outflow,                              &
417             use_subsidence_tendencies, ug_surface, ug_vertical_gradient,      &
418             ug_vertical_gradient_level, use_surface_fluxes, use_cmax,         &
419             use_top_fluxes, use_ug_for_galilei_tr, use_upstream_for_tke,      &
420             uv_heights, u_bulk, u_profile, vg_surface, vg_vertical_gradient,  &
421             vg_vertical_gradient_level, v_bulk, v_profile, ventilation_effect,&
422             wall_adjustment, wall_heatflux, wall_humidityflux,                &
423             wall_salinityflux, wall_scalarflux, zeta_max, zeta_min, z0h_factor
424     
425    NAMELIST /d3par/  averaging_interval, averaging_interval_pr,               &
426             cpu_log_barrierwait, create_disturbances,                         &
427             cross_profiles, data_output, data_output_masks,                   &
428             data_output_pr, data_output_2d_on_each_pe, disturbance_amplitude, &
429             disturbance_energy_limit, disturbance_level_b,                    &
430             disturbance_level_t, do2d_at_begin, do3d_at_begin,                &
431             dt, dt_averaging_input, dt_averaging_input_pr,                    &
432             dt_coupling, dt_data_output, dt_data_output_av, dt_disturb,       &
433             dt_domask, dt_dopr, dt_dopr_listing, dt_dots, dt_do2d_xy,         &
434             dt_do2d_xz, dt_do2d_yz, dt_do3d, dt_max, dt_restart,              &
435             dt_run_control,end_time, force_print_header, mask_scale_x,        &
436             mask_scale_y, mask_scale_z, mask_x, mask_y, mask_z, mask_x_loop,  &
437             mask_y_loop, mask_z_loop, netcdf_data_format, netcdf_deflate,     &
438             normalizing_region, npex, npey, nz_do3d,                          &
439             precipitation_amount_interval, profile_columns, profile_rows,     &
440             restart_time, section_xy, section_xz, section_yz,                 &
441             skip_time_data_output, skip_time_data_output_av, skip_time_dopr,  &
442             skip_time_do2d_xy, skip_time_do2d_xz, skip_time_do2d_yz,          &
443             skip_time_do3d, skip_time_domask, synchronous_exchange,           &
444             termination_time_needed, z_max_do2d
445
446
447    NAMELIST /envpar/  batch_job, host, local_dvrserver_running,               &
448                       maximum_cpu_time_allowed, maximum_parallel_io_streams,  &
449                       revision, run_identifier, tasks_per_node, write_binary
450
451!
452!-- First read values of environment variables (this NAMELIST file is
453!-- generated by mrun)
454    CALL location_message( 'reading environment parameters from ENVPAR', .FALSE. )
455
456    OPEN ( 90, FILE='ENVPAR', STATUS='OLD', FORM='FORMATTED', IOSTAT=ioerr )
457
458    IF ( ioerr /= 0 )  THEN
459       message_string = 'local file ENVPAR not found' //                       &
460                        '&some variables for steering may not be properly set'
461       CALL message( 'parin', 'PA0276', 0, 1, 0, 6, 0 )
462    ELSE
463       READ ( 90, envpar, IOSTAT=ioerr )
464       IF ( ioerr < 0 )  THEN
465          message_string = 'no envpar-NAMELIST found in local file '  //       &
466                           'ENVPAR&some variables for steering may '  //       &
467                           'not be properly set'
468          CALL message( 'parin', 'PA0278', 0, 1, 0, 6, 0 )
469       ELSEIF ( ioerr > 0 )  THEN
470          message_string = 'errors in local file ENVPAR' //                    &
471                           '&some variables for steering may not be properly set'
472          CALL message( 'parin', 'PA0277', 0, 1, 0, 6, 0 )
473       ENDIF
474       CLOSE ( 90 )
475    ENDIF
476
477    CALL location_message( 'finished', .TRUE. )
478
479!
480!-- Calculate the number of groups into which parallel I/O is split.
481!-- The default for files which are opened by all PEs (or where each
482!-- PE opens his own independent file) is, that all PEs are doing input/output
483!-- in parallel at the same time. This might cause performance or even more
484!-- severe problems depending on the configuration of the underlying file
485!-- system.
486!-- First, set the default:
487    IF ( maximum_parallel_io_streams == -1  .OR.                               &
488         maximum_parallel_io_streams > numprocs )  THEN
489       maximum_parallel_io_streams = numprocs
490    ENDIF
491!
492!-- Now calculate the number of io_blocks and the io_group to which the
493!-- respective PE belongs. I/O of the groups is done in serial, but in parallel
494!-- for all PEs belonging to the same group.
495!-- These settings are repeated in init_pegrid for the communicator comm2d,
496!-- which is not available here
497    io_blocks = numprocs / maximum_parallel_io_streams
498    io_group  = MOD( myid+1, io_blocks )
499
500    CALL location_message( 'reading NAMELIST parameters from PARIN', .FALSE. )
501!
502!-- Data is read in parallel by groups of PEs
503    DO  i = 0, io_blocks-1
504       IF ( i == io_group )  THEN
505
506!
507!--       Open the NAMELIST-file which is send with this job
508          CALL check_open( 11 )
509
510!
511!--       Read the control parameters for initialization.
512!--       The namelist "inipar" must be provided in the NAMELIST-file.
513          READ ( 11, inipar, ERR=10, END=11 )
514
515          GOTO 12
516
517 10       message_string = 'errors in \$inipar &or no \$inipar-namelist ' //   &
518                           'found (CRAY-machines only)'
519          CALL message( 'parin', 'PA0271', 1, 2, 0, 6, 0 )
520
521 11       message_string = 'no \$inipar-namelist found'
522          CALL message( 'parin', 'PA0272', 1, 2, 0, 6, 0 )
523
524!
525!--       If required, read control parameters from restart file (produced by
526!--       a prior run). All PEs are reading from file created by PE0 (see
527!--       check_open)
528 12       IF ( TRIM( initializing_actions ) == 'read_restart_data' )  THEN
529             CALL read_var_list
530!
531!--          The restart file will be reopened when reading the subdomain data
532             CALL close_file( 13 )
533
534!
535!--          Increment the run count
536             runnr = runnr + 1
537          ENDIF
538
539!
540!--       In case of nested runs, explicitly set nesting boundary conditions.
541!--       This will overwrite the user settings. bc_lr and bc_ns always need
542!--       to be cyclic for vertical nesting.
543          IF ( nesting_mode == 'vertical' )  THEN
544             IF (bc_lr /= 'cyclic' .OR. bc_ns /= 'cyclic' )  THEN
545                WRITE ( message_string, *)  'bc_lr and bc_ns were set to ,',   &
546                                      'cyclic for vertical nesting'
547                CALL message( 'parin', 'PA0428', 0, 0, 0, 6, 0 )
548                bc_lr   = 'cyclic'
549                bc_ns   = 'cyclic'
550             ENDIF
551             IF ( nest_domain )  THEN
552                bc_uv_t = 'nested'
553                bc_pt_t = 'nested'
554                bc_q_t  = 'nested'
555                bc_s_t  = 'nested'
556                bc_p_t  = 'neumann'
557             ENDIF
558          ELSE
559         
560!
561!--       For other nesting modes only set boundary conditions for
562!--       nested domains.
563             IF ( nest_domain )  THEN
564                bc_lr   = 'nested'
565                bc_ns   = 'nested'
566                bc_uv_t = 'nested'
567                bc_pt_t = 'nested'
568                bc_q_t  = 'nested'
569                bc_s_t  = 'nested'
570                bc_p_t  = 'neumann'
571             ENDIF
572          ENDIF
573
574!         
575!--       In case of nested runs, make sure that initializing_actions =
576!--       'set_constant_profiles' even though the constant-profiles
577!--       initializations for the prognostic variables will be overwritten
578!--       by pmci_child_initialize and pmci_parent_initialize. This is,
579!--       however, important e.g. to make sure that diagnostic variables
580!--       are set properly. An exception is made in case of restart runs.
581!--       MS: is this really necessary?
582          IF ( nest_domain  .AND.                                              &
583               TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
584             initializing_actions = 'set_constant_profiles'
585          ENDIF
586           
587!
588!--       Check validity of lateral boundary conditions. This has to be done
589!--       here because they are already used in init_pegrid and init_grid and
590!--       therefore cannot be check in check_parameters
591          IF ( bc_lr /= 'cyclic'  .AND.  bc_lr /= 'dirichlet/radiation'  .AND. &
592               bc_lr /= 'radiation/dirichlet'  .AND.  bc_lr /= 'nested' )  THEN
593             message_string = 'unknown boundary condition: bc_lr = "' // &
594                              TRIM( bc_lr ) // '"'
595             CALL message( 'check_parameters', 'PA0049', 1, 2, 0, 6, 0 )
596          ENDIF
597          IF ( bc_ns /= 'cyclic'  .AND.  bc_ns /= 'dirichlet/radiation'  .AND. &
598               bc_ns /= 'radiation/dirichlet'  .AND.  bc_ns /= 'nested' )  THEN
599             message_string = 'unknown boundary condition: bc_ns = "' // &
600                              TRIM( bc_ns ) // '"'
601             CALL message( 'check_parameters', 'PA0050', 1, 2, 0, 6, 0 )
602          ENDIF
603
604!
605!--       Set internal variables used for speed optimization in if clauses
606          IF ( bc_lr /= 'cyclic' )               bc_lr_cyc    = .FALSE.
607          IF ( bc_lr == 'dirichlet/radiation' )  bc_lr_dirrad = .TRUE.
608          IF ( bc_lr == 'radiation/dirichlet' )  bc_lr_raddir = .TRUE.
609          IF ( bc_ns /= 'cyclic' )               bc_ns_cyc    = .FALSE.
610          IF ( bc_ns == 'dirichlet/radiation' )  bc_ns_dirrad = .TRUE.
611          IF ( bc_ns == 'radiation/dirichlet' )  bc_ns_raddir = .TRUE.
612
613!
614!--       Definition of names of areas used for computing statistics. They must
615!--       be defined at this place, because they are allowed to be redefined by
616!--       the user in user_parin.
617          region = 'total domain'
618
619!
620!--       Read runtime parameters given by the user for this run (namelist
621!--       "d3par"). The namelist "d3par" can be omitted. In that case, default
622!--       values are used for the parameters.
623          READ ( 11, d3par, END=20 )
624 20       CONTINUE
625
626!
627!--       Check if land surface model is used and read &lsm_par if required
628          CALL lsm_parin
629
630!
631!--       Check if urban surface model is used and read &urban_surface_par if required
632          CALL usm_parin
633
634!
635!--       Check if spectra shall be calculated and read spectra_par if required
636          CALL spectra_parin
637
638!
639!--       Check if radiation model is used and read &radiation_par if required
640          CALL radiation_parin
641 
642 
643!--       Check if plant canopy model is used and read &canopy_par if required
644          CALL pcm_parin
645 
646!
647!--       Read control parameters for optionally used model software packages
648          CALL package_parin
649
650!
651!--       Check if wind turbine model is used and read &wind_turbine_par if
652!--       required
653          CALL wtm_parin
654!
655!--       Check if virtual flights should be carried out and read &flight_par
656!--       if required
657          CALL flight_parin
658!
659!--       Check if synthetic turbulence generator is used and read stg_par if
660!--       required
661          CALL stg_parin
662!
663!--       Read user-defined variables
664          CALL user_parin
665
666!
667!--       Check in case of initial run, if the grid point numbers are well
668!--       defined and allocate some arrays which are already needed in
669!--       init_pegrid or check_parameters. During restart jobs, these arrays
670!--       will be allocated in read_var_list. All other arrays are allocated
671!--       in init_3d_model.
672          IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
673
674             IF ( nx <= 0 )  THEN
675                WRITE( message_string, * ) 'no value or wrong value given',    &
676                                           ' for nx: nx=', nx
677                CALL message( 'parin', 'PA0273', 1, 2, 0, 6, 0 )
678             ENDIF
679             IF ( ny <= 0 )  THEN
680                WRITE( message_string, * ) 'no value or wrong value given',    &
681                                           ' for ny: ny=', ny
682                CALL message( 'parin', 'PA0274', 1, 2, 0, 6, 0 )
683             ENDIF
684             IF ( nz <= 0 )  THEN
685                WRITE( message_string, * ) 'no value or wrong value given',    &
686                                           ' for nz: nz=', nz
687                CALL message( 'parin', 'PA0275', 1, 2, 0, 6, 0 )
688             ENDIF
689!
690!--          ATTENTION: in case of changes to the following statement please
691!--                  also check the allocate statement in routine read_var_list
692             ALLOCATE( pt_init(0:nz+1), q_init(0:nz+1), s_init(0:nz+1),        &
693                       ref_state(0:nz+1), sa_init(0:nz+1), ug(0:nz+1),         &
694                       u_init(0:nz+1), v_init(0:nz+1), vg(0:nz+1),             &
695                       hom(0:nz+1,2,pr_palm+max_pr_user,0:statistic_regions),  &
696                       hom_sum(0:nz+1,pr_palm+max_pr_user,0:statistic_regions) )
697
698             hom = 0.0_wp
699
700          ENDIF
701
702!
703!--       NAMELIST-file is not needed anymore
704          CALL close_file( 11 )
705
706       ENDIF
707#if defined( __parallel )
708       CALL MPI_BARRIER( MPI_COMM_WORLD, ierr )
709#endif
710    ENDDO
711
712    CALL location_message( 'finished', .TRUE. )
713
714 END SUBROUTINE parin
Note: See TracBrowser for help on using the repository browser.