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

Last change on this file since 151 was 151, checked in by raasch, 14 years ago

preliminary update for the turbulence recycling method

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