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

Last change on this file since 23 was 20, checked in by raasch, 18 years ago

new parameter use_top_fluxes, Bugfix: ddzw dimensioned 1:nzt+1

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