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

Last change on this file since 224 was 199, checked in by raasch, 16 years ago

FORTRAN bug in parin removed

  • Property svn:keywords set to Id
File size: 11.3 KB
Line 
1 SUBROUTINE parin
2
3!------------------------------------------------------------------------------!
4! Actual revisions:
5! -----------------
6!
7!
8! Former revisions:
9! -----------------
10! $Id: parin.f90 199 2008-09-17 09:10:35Z letzel $
11!
12! 197 2008-09-16 15:29:03Z raasch
13! +cthf,leaf_surface_concentration, scalar_exchange_coefficient
14! +inflow_damping_height, inflow_damping_width, recycling_width,
15! turbulent_inflow in inipar, -skip_time_dosp in d3par,
16! allocation of hom_sum moved from init_3d_model to here,
17! npex, npey moved from inipar to d3par, setting of myid_char_14 removed,
18! lad is allways allocated
19!
20! 138 2007-11-28 10:03:58Z letzel
21! +canopy_mode, drag_coefficient, lad_surface, lad_vertical_gradient,
22! lad_vertical_gradient_level, pch_index, plant_canopy,
23! +allocation of leaf area density field
24!
25! 108 2007-08-24 15:10:38Z letzel
26! +e_init, top_momentumflux_u|v in inipar, +dt_coupling in d3par
27!
28! 95 2007-06-02 16:48:38Z raasch
29! +bc_sa_t, bottom_salinityflux, ocean, sa_surface, sa_vertical_gradient,
30! sa_vertical_gradient_level, top_salinityflux in inipar,
31! sa_init is allocated
32!
33! 87 2007-05-22 15:46:47Z raasch
34! Size of hom increased by the maximum number of user-defined profiles,
35! var_hom renamed pr_palm
36!
37! 82 2007-04-16 15:40:52Z raasch
38! +return_addres, return_username in envpar
39!
40! 75 2007-03-22 09:54:05Z raasch
41! +dt_max, netcdf_64bit_3d, precipitation_amount_interval in d3par,
42! +loop_optimization, pt_reference in inipar, -data_output_ts,
43! moisture renamed humidity
44!
45! 20 2007-02-26 00:12:32Z raasch
46! +top_heatflux, use_top_fluxes in inipar
47!
48! -netcdf_64bit_3d
49!
50! 3 2007-02-13 11:30:58Z raasch
51! +netcdf_64bit_3d in d3par,
52! RCS Log replace by Id keyword, revision history cleaned up
53!
54! Revision 1.57  2007/02/11 13:11:22  raasch
55! Values of environment variables are now read from file ENVPAR instead of
56! reading them with a system call, + NAMELIST envpar
57!
58! Revision 1.1  1997/07/24 11:22:50  raasch
59! Initial revision
60!
61!
62! Description:
63! ------------
64! This subroutine reads variables controling the run from the NAMELIST files
65!------------------------------------------------------------------------------!
66
67    USE arrays_3d
68    USE averaging
69    USE control_parameters
70    USE grid_variables
71    USE indices
72    USE model_1d
73    USE pegrid
74    USE profil_parameter
75    USE statistics
76
77    IMPLICIT NONE
78
79    INTEGER ::  idum
80
81
82    NAMELIST /inipar/  adjust_mixing_length, alpha_surface, bc_e_b, bc_lr, &
83                       bc_ns, bc_p_b, bc_p_t, bc_pt_b, bc_pt_t, bc_q_b, &
84             bc_q_t,bc_s_b, bc_s_t, bc_sa_t, bc_uv_b, bc_uv_t, &
85             bottom_salinityflux, building_height, building_length_x, &
86             building_length_y, building_wall_left, &
87             building_wall_south, canopy_mode, cloud_droplets, cloud_physics, &
88             conserve_volume_flow, cthf, cut_spline_overshoot, damp_level_1d, &
89             dissipation_1d, drag_coefficient, dt, dt_pr_1d, &
90             dt_run_control_1d, dx, dy, dz, dz_max, dz_stretch_factor, & 
91             dz_stretch_level, e_init, e_min, end_time_1d, fft_method, &
92             galilei_transformation, grid_matching, humidity, &
93             inflow_damping_height, inflow_damping_width, &
94             inflow_disturbance_begin, inflow_disturbance_end, &
95             initializing_actions, km_constant, km_damp_max, lad_surface, &
96             lad_vertical_gradient, lad_vertical_gradient_level, &
97             leaf_surface_concentration, long_filter_factor, &
98             loop_optimization, mixing_length_1d, momentum_advec, &
99             netcdf_precision, nsor_ini, nx, ny, &
100             nz, ocean, omega, outflow_damping_width, overshoot_limit_e, &
101             overshoot_limit_pt, overshoot_limit_u, overshoot_limit_v, &
102             overshoot_limit_w, passive_scalar, pch_index, phi, & 
103             plant_canopy, prandtl_layer, precipitation, pt_reference, &
104             pt_surface, pt_surface_initial_change, pt_vertical_gradient, &
105             pt_vertical_gradient_level, q_surface, q_surface_initial_change, &
106             q_vertical_gradient, q_vertical_gradient_level, radiation, &
107             random_generator, random_heatflux, recycling_width, rif_max, &
108             rif_min, roughness_length, sa_surface, sa_vertical_gradient, &
109             sa_vertical_gradient_level, scalar_advec, &
110             scalar_exchange_coefficient, statistic_regions, &
111             surface_heatflux, surface_pressure, surface_scalarflux, &
112             surface_waterflux, s_surface, s_surface_initial_change, &
113             s_vertical_gradient, s_vertical_gradient_level, timestep_scheme, &
114             topography, top_heatflux, top_momentumflux_u, top_momentumflux_v, &
115             top_salinityflux, turbulent_inflow, ug_surface, &
116             ug_vertical_gradient, ug_vertical_gradient_level, ups_limit_e, &
117             ups_limit_pt, ups_limit_u, ups_limit_v, ups_limit_w, &
118             use_surface_fluxes, use_top_fluxes, use_ug_for_galilei_tr, &
119             use_upstream_for_tke, vg_surface, vg_vertical_gradient, &
120             vg_vertical_gradient_level, wall_adjustment, wall_heatflux
121
122
123    NAMELIST /d3par/   averaging_interval,  averaging_interval_pr, &
124                       call_psolver_at_all_substeps, cfl_factor, &
125                       create_disturbances, cross_normalized_x, &
126                       cross_normalized_y, cross_profiles, cross_ts_uymax, &
127                       cross_ts_uymin, cross_xtext, cycle_mg, data_output, &
128                       data_output_format, data_output_pr, &
129                       data_output_2d_on_each_pe, disturbance_amplitude, &
130                       disturbance_energy_limit, disturbance_level_b, &
131                       disturbance_level_t, do2d_at_begin, do3d_at_begin, &
132                       do3d_compress, do3d_comp_prec, dt, dt_averaging_input, &
133                       dt_averaging_input_pr, dt_coupling, dt_data_output, &
134                       dt_data_output_av, dt_disturb, dt_dopr, &
135                       dt_dopr_listing, dt_dots, dt_do2d_xy, dt_do2d_xz, &
136                       dt_do2d_yz, dt_do3d, dt_max, dt_restart, dt_run_control,&
137                       end_time, force_print_header, mg_cycles, &
138                       mg_switch_to_pe0_level, netcdf_64bit, netcdf_64bit_3d, &
139                       ngsrb, normalizing_region, npex, npey, nsor, nz_do3d, &
140                       omega_sor, &
141                       prandtl_number, precipitation_amount_interval, &
142                       profile_columns, profile_rows, psolver, &
143                       rayleigh_damping_factor, rayleigh_damping_height, &
144                       residual_limit, restart_time, section_xy, section_xz, &
145                       section_yz, skip_time_data_output, &
146                       skip_time_data_output_av, skip_time_dopr, &
147                       skip_time_do2d_xy, skip_time_do2d_xz, &
148                       skip_time_do2d_yz, skip_time_do3d, &
149                       termination_time_needed, use_prior_plot1d_parameters, &
150                       z_max_do1d, z_max_do1d_normalized, z_max_do2d
151
152
153    NAMELIST /envpar/  host, maximum_cpu_time_allowed, revision, return_addres,&
154                       return_username, run_identifier, tasks_per_node, &
155                       write_binary
156
157!
158!-- Open the NAMELIST-file which is send with this job
159    CALL check_open( 11 )
160
161!
162!-- Read the control parameters for initialization.
163!-- The namelist "inipar" must be provided in the NAMELIST-file. If this is
164!-- not the case and the file contains - instead of "inipar" - any other
165!-- namelist, a read error is created on t3e and control is transferred
166!-- to the statement with label 10. Therefore, on t3e machines one can not
167!-- distinguish between errors produced by a wrong "inipar" namelist or
168!-- because this namelist is totally missing.
169    READ ( 11, inipar, ERR=10, END=11 )
170    GOTO 12
171 10 IF ( myid == 0 )  THEN
172       PRINT*, '+++ parin: errors in \$inipar'
173       PRINT*, '           or no \$inipar-namelist found (CRAY-machines only)' 
174    ENDIF
175    CALL local_stop
176 11 IF ( myid == 0 )  THEN
177       PRINT*, '+++ parin: no \$inipar-namelist found'
178    ENDIF
179    CALL local_stop
180
181!
182!-- If required, read control parameters from restart file (produced by
183!-- a prior run). All PEs are reading from file created by PE0 (see check_open)
184 12 IF ( TRIM( initializing_actions ) == 'read_restart_data' )  THEN
185
186       CALL read_var_list
187!
188!--    The restart file will be reopened when reading the subdomain data
189       CALL close_file( 13 )
190
191!
192!--    Increment the run count
193       runnr = runnr + 1
194
195    ENDIF
196
197!
198!-- Definition of names of areas used for computing statistics. They must
199!-- be defined at this place, because they are allowed to be redefined by
200!-- the user in user_parin.
201    region = 'total domain'
202
203!
204!-- Read runtime parameters given by the user for this run (namelist "d3par").
205!-- The namelist "d3par" can be omitted. In that case, default values are
206!-- used for the parameters.
207    READ ( 11, d3par, END=20 )
208
209!
210!-- Read control parameters for optionally used model software packages
211 20 CALL package_parin
212
213!
214!-- Read user-defined variables
215    CALL user_parin
216
217!
218!-- Check in case of initial run, if the grid point numbers are well defined
219!-- and allocate some arrays which are already needed in init_pegrid or
220!-- check_parameters. During restart jobs, these arrays will be allocated
221!-- in read_var_list. All other arrays are allocated in init_3d_model.
222    IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
223
224       IF ( nx <= 0 )  THEN
225          IF ( myid == 0 )  THEN
226             PRINT*, '+++ parin: no value or wrong value given for nx: nx=', nx
227          ENDIF
228          CALL local_stop
229       ENDIF
230       IF ( ny <= 0 )  THEN
231          IF ( myid == 0 )  THEN
232             PRINT*, '+++ parin: no value or wrong value given for ny: ny=', ny
233          ENDIF
234          CALL local_stop
235       ENDIF
236       IF ( nz <= 0 )  THEN
237          IF ( myid == 0 )  THEN
238             PRINT*, '+++ parin: no value or wrong value given for nz: nz=', nz
239          ENDIF
240          CALL local_stop
241       ENDIF
242!
243!--    ATTENTION: in case of changes to the following statement please also
244!--    check the allocate statement in routine read_var_list
245       ALLOCATE( lad(0:nz+1),pt_init(0:nz+1), q_init(0:nz+1), sa_init(0:nz+1), &
246                 ug(0:nz+1), u_init(0:nz+1), v_init(0:nz+1), vg(0:nz+1),       &
247                 hom(0:nz+1,2,pr_palm+max_pr_user,0:statistic_regions),        &
248                 hom_sum(0:nz+1,pr_palm+max_pr_user,0:statistic_regions) )
249       hom = 0.0
250
251    ENDIF
252
253!
254!-- NAMELIST-file is not needed anymore
255    CALL close_file( 11 )
256
257!
258!-- Read values of environment variables (this NAMELIST file is generated by
259!-- mrun)
260    OPEN ( 90, FILE='ENVPAR', STATUS='OLD', FORM='FORMATTED', ERR=30 )
261    READ ( 90, envpar, ERR=31, END=32 )
262    CLOSE ( 90 )
263    RETURN
264
265 30 IF ( myid == 0 )  THEN
266       PRINT*, '+++ parin: WARNING: local file ENVPAR not found'
267       PRINT*, '           some variables for steering may not be properly set'
268    ENDIF
269    RETURN
270
271 31 IF ( myid == 0 )  THEN
272       PRINT*, '+++ parin: WARNING: errors in local file ENVPAR'
273       PRINT*, '           some variables for steering may not be properly set'
274    ENDIF
275    RETURN
276
277 32 IF ( myid == 0 )  THEN
278       PRINT*, '+++ parin: WARNING: no envpar-NAMELIST found in local file ', &
279                           'ENVPAR'
280       PRINT*, '           some variables for steering may not be properly set'
281    ENDIF
282
283 END SUBROUTINE parin
Note: See TracBrowser for help on using the repository browser.