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