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

Last change on this file since 109 was 108, checked in by letzel, 17 years ago
  • Improved coupler: evaporation - salinity-flux coupling for humidity = .T.,

avoid MPI hangs when coupled runs terminate, add DOC/app/chapter_3.8;

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