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

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