1 | SUBROUTINE init_dvrp |
---|
2 | |
---|
3 | !------------------------------------------------------------------------------! |
---|
4 | ! Actual revisions: |
---|
5 | ! ----------------- |
---|
6 | ! DVRP arguments changed to single precision, mode pathlines added |
---|
7 | ! TEST: print* statements |
---|
8 | ! ToDo: checking of mode_dvrp for legal values is not correct |
---|
9 | ! Implementation of a MPI-1 coupling: __mpi2 adjustments for MPI_COMM_WORLD |
---|
10 | ! Former revisions: |
---|
11 | ! ----------------- |
---|
12 | ! $Id: init_dvrp.f90 210 2008-11-06 08:54:02Z letzel $ |
---|
13 | ! |
---|
14 | ! 155 2008-03-28 10:56:30Z letzel |
---|
15 | ! introduce prefix_chr to ensure unique dvrp_file path |
---|
16 | ! |
---|
17 | ! 130 2007-11-13 14:08:40Z letzel |
---|
18 | ! allow two instead of one digit to specify isosurface and slicer variables |
---|
19 | ! Test output of isosurface on camera file |
---|
20 | ! |
---|
21 | ! 82 2007-04-16 15:40:52Z raasch |
---|
22 | ! Preprocessor strings for different linux clusters changed to "lc", |
---|
23 | ! routine local_flush is used for buffer flushing |
---|
24 | ! |
---|
25 | ! 17 2007-02-19 01:57:39Z raasch |
---|
26 | ! dvrp_output_local activated for all streams |
---|
27 | ! |
---|
28 | ! 13 2007-02-14 12:15:07Z raasch |
---|
29 | ! RCS Log replace by Id keyword, revision history cleaned up |
---|
30 | ! |
---|
31 | ! Revision 1.12 2006/02/23 12:30:22 raasch |
---|
32 | ! ebene renamed section, pl.. replaced by do.., |
---|
33 | ! |
---|
34 | ! Revision 1.1 2000/04/27 06:24:39 raasch |
---|
35 | ! Initial revision |
---|
36 | ! |
---|
37 | ! |
---|
38 | ! Description: |
---|
39 | ! ------------ |
---|
40 | ! Initializing actions needed when using dvrp-software |
---|
41 | !------------------------------------------------------------------------------! |
---|
42 | #if defined( __dvrp_graphics ) |
---|
43 | |
---|
44 | USE arrays_3d |
---|
45 | USE DVRP |
---|
46 | USE dvrp_variables |
---|
47 | USE grid_variables |
---|
48 | USE indices |
---|
49 | USE pegrid |
---|
50 | USE control_parameters |
---|
51 | |
---|
52 | IMPLICIT NONE |
---|
53 | |
---|
54 | CHARACTER (LEN=2) :: section_chr |
---|
55 | CHARACTER (LEN=3) :: prefix_chr |
---|
56 | CHARACTER (LEN=80) :: dvrp_file_local |
---|
57 | INTEGER :: i, j, k, l, m, pn, tv, vn |
---|
58 | LOGICAL :: allocated |
---|
59 | REAL(4) :: center(3), distance, tmp_b, tmp_g, tmp_r, tmp_t, tmp_th, & |
---|
60 | tmp_thr, tmp_x1, tmp_x2, tmp_y1, tmp_y2, tmp_z1, tmp_z2, & |
---|
61 | tmp_1, tmp_2, tmp_3, tmp_4, tmp_5, tmp_6, tmp_7 |
---|
62 | |
---|
63 | REAL(4), DIMENSION(:,:,:), ALLOCATABLE :: local_pf |
---|
64 | |
---|
65 | TYPE(CSTRING), SAVE :: dvrp_directory_c, dvrp_file_c, & |
---|
66 | dvrp_file_local_c,dvrp_host_c, & |
---|
67 | dvrp_password_c, dvrp_username_c, name_c |
---|
68 | |
---|
69 | ! |
---|
70 | !-- Set the maximum time the program can be suspended on user request (by |
---|
71 | !-- dvrp steering). This variable is defined in module DVRP. |
---|
72 | DVRP_MAX_SUSPEND_TIME = 7200 |
---|
73 | |
---|
74 | ! |
---|
75 | !-- Allocate array holding the names and limits of the steering variables |
---|
76 | !-- (must have the same number of elements as array mode_dvrp!) |
---|
77 | ALLOCATE( steering_dvrp(10) ) |
---|
78 | |
---|
79 | ! |
---|
80 | !-- Check, if output parameters are given and/or allowed |
---|
81 | !-- and set default-values, where necessary |
---|
82 | IF ( dvrp_username == ' ' ) THEN |
---|
83 | IF ( myid == 0 ) THEN |
---|
84 | PRINT*, '+++ init_dvrp: dvrp_username is undefined' |
---|
85 | CALL local_stop |
---|
86 | ENDIF |
---|
87 | ENDIF |
---|
88 | |
---|
89 | IF ( dvrp_output /= 'ftp' .AND. dvrp_output /= 'rtsp' .AND. & |
---|
90 | dvrp_output /= 'local' ) THEN |
---|
91 | IF ( myid == 0 ) THEN |
---|
92 | PRINT*, '+++ init_dvrp: dvrp_output="', dvrp_output, '" not allowed' |
---|
93 | CALL local_stop |
---|
94 | ENDIF |
---|
95 | ENDIF |
---|
96 | |
---|
97 | IF ( dvrp_directory == 'default' ) THEN |
---|
98 | dvrp_directory = TRIM( dvrp_username ) // '/' // TRIM( run_identifier ) |
---|
99 | ENDIF |
---|
100 | |
---|
101 | IF ( dvrp_output /= 'local' ) THEN |
---|
102 | IF ( dvrp_file /= 'default' .AND. dvrp_file /= '/dev/null' ) THEN |
---|
103 | IF ( myid == 0 ) THEN |
---|
104 | PRINT*, '+++ init_dvrp: dvrp_file="', dvrp_file, '" not allowed' |
---|
105 | CALL local_stop |
---|
106 | ENDIF |
---|
107 | ENDIF |
---|
108 | ENDIF |
---|
109 | |
---|
110 | ! |
---|
111 | !-- Strings are assigned to strings of special type which have a CHAR( 0 ) |
---|
112 | !-- (C end-of-character symbol) at their end. This is needed when strings are |
---|
113 | !-- passed to C routines. |
---|
114 | dvrp_directory_c = dvrp_directory |
---|
115 | dvrp_file_c = dvrp_file |
---|
116 | dvrp_host_c = dvrp_host |
---|
117 | dvrp_password_c = dvrp_password |
---|
118 | dvrp_username_c = dvrp_username |
---|
119 | |
---|
120 | ! |
---|
121 | !-- Loop over all output modes choosed |
---|
122 | m = 1 |
---|
123 | allocated = .FALSE. |
---|
124 | DO WHILE ( mode_dvrp(m) /= ' ' ) |
---|
125 | |
---|
126 | ! |
---|
127 | !-- Check, if mode is allowed |
---|
128 | IF ( mode_dvrp(m)(1:10) /= 'isosurface' .AND. & |
---|
129 | mode_dvrp(m)(1:6) /= 'slicer' .AND. & |
---|
130 | mode_dvrp(m)(1:9) /= 'particles' .AND. & |
---|
131 | mode_dvrp(m)(1:9) /= 'pathlines' ) THEN |
---|
132 | |
---|
133 | IF ( myid == 0 ) THEN |
---|
134 | PRINT*, '+++ init_dvrp: mode_dvrp="', mode_dvrp, '" not allowed' |
---|
135 | ENDIF |
---|
136 | CALL local_stop |
---|
137 | |
---|
138 | ENDIF |
---|
139 | ! |
---|
140 | !-- Determine prefix for dvrp_file |
---|
141 | WRITE ( prefix_chr, '(I2.2,''_'')' ) m |
---|
142 | ! |
---|
143 | !-- Camera position must be computed and written on file when no dvrp-output |
---|
144 | !-- has been generated so far (in former runs) |
---|
145 | ! IF ( dvrp_filecount == 0 ) THEN |
---|
146 | ! |
---|
147 | !-- Compute center of domain and distance of camera from center |
---|
148 | center(1) = ( nx + 1.0 ) * dx * 0.5 * superelevation_x |
---|
149 | center(2) = ( ny + 1.0 ) * dy * 0.5 * superelevation_y |
---|
150 | center(3) = ( zu(nz_do3d) - zu(nzb) ) * 0.5 * superelevation |
---|
151 | distance = 1.5 * MAX( ( nx + 1.0 ) * dx * superelevation_x, & |
---|
152 | ( ny + 1.0 ) * dy * superelevation_y, & |
---|
153 | ( zu(nz_do3d) - zu(nzb) ) * superelevation ) |
---|
154 | |
---|
155 | ! |
---|
156 | !-- Write camera position on file |
---|
157 | CALL DVRP_INIT( m-1, 0 ) |
---|
158 | |
---|
159 | ! |
---|
160 | !-- Create filename for camera |
---|
161 | IF ( dvrp_output == 'rtsp' ) THEN |
---|
162 | |
---|
163 | WRITE ( 9, * ) '*** vor dvrp_output_rtsp' |
---|
164 | CALL local_flush( 9 ) |
---|
165 | |
---|
166 | dvrp_file = prefix_chr // TRIM( mode_dvrp(m) ) // '/camera.dvr' |
---|
167 | dvrp_file_c = dvrp_file |
---|
168 | CALL DVRP_OUTPUT_RTSP( m-1, dvrp_host_c, dvrp_username_c, & |
---|
169 | dvrp_password_c, dvrp_directory_c, & |
---|
170 | dvrp_file_c ) |
---|
171 | WRITE ( 9, * ) '*** nach dvrp_output_rtsp' |
---|
172 | CALL local_flush( 9 ) |
---|
173 | |
---|
174 | ELSEIF ( dvrp_output == 'ftp' ) THEN |
---|
175 | |
---|
176 | dvrp_file = prefix_chr // TRIM( mode_dvrp(m) ) // '.camera.dvr' |
---|
177 | dvrp_file_c = dvrp_file |
---|
178 | ! CALL DVRP_OUTPUT_FTP( m-1, 0, dvrp_host_c, dvrp_username_c, & |
---|
179 | ! dvrp_password_c, dvrp_directory_c, & |
---|
180 | ! dvrp_file_c ) |
---|
181 | |
---|
182 | ELSE |
---|
183 | |
---|
184 | IF ( dvrp_file(1:9) /= '/dev/null' ) THEN |
---|
185 | dvrp_file_local = prefix_chr // TRIM( mode_dvrp(m) ) & |
---|
186 | // '.camera.dvr' |
---|
187 | dvrp_file_local_c = dvrp_file_local |
---|
188 | ELSE |
---|
189 | dvrp_file_local_c = dvrp_file_c |
---|
190 | ENDIF |
---|
191 | CALL DVRP_OUTPUT_LOCAL( m-1, 0, dvrp_file_local_c ) |
---|
192 | |
---|
193 | ENDIF |
---|
194 | |
---|
195 | CALL DVRP_CAMERA( m-1, center, distance ) |
---|
196 | WRITE ( 9, * ) '*** #1' |
---|
197 | CALL local_flush( 9 ) |
---|
198 | |
---|
199 | ! |
---|
200 | !-- Define bounding box material and create a bounding box |
---|
201 | tmp_r = 0.5; tmp_g = 0.5; tmp_b = 0.5; tmp_t = 0.0 |
---|
202 | CALL DVRP_MATERIAL_RGB( m-1, 1, tmp_r, tmp_g, tmp_b, tmp_t ) |
---|
203 | |
---|
204 | tmp_1 = 0.01; tmp_2 = 0.0; tmp_3 = 0.0; tmp_4 = 0.0 |
---|
205 | tmp_5 = (nx+1) * dx * superelevation_x |
---|
206 | tmp_6 = (ny+1) * dy * superelevation_y |
---|
207 | tmp_7 = zu(nz_do3d) * superelevation |
---|
208 | CALL DVRP_BOUNDINGBOX( m-1, 1, tmp_1, tmp_2, tmp_3, tmp_4, tmp_5, & |
---|
209 | tmp_6, tmp_7 ) |
---|
210 | |
---|
211 | CALL DVRP_VISUALIZE( m-1, 0, 0 ) |
---|
212 | CALL DVRP_EXIT( m-1 ) |
---|
213 | WRITE ( 9, * ) '*** #2' |
---|
214 | CALL local_flush( 9 ) |
---|
215 | |
---|
216 | |
---|
217 | ! |
---|
218 | !-- Write topography isosurface on file |
---|
219 | CALL DVRP_INIT( m-1, 0 ) |
---|
220 | |
---|
221 | ! |
---|
222 | !-- Create filename for buildings |
---|
223 | IF ( dvrp_output == 'rtsp' ) THEN |
---|
224 | |
---|
225 | dvrp_file = prefix_chr // TRIM( mode_dvrp(m) ) & |
---|
226 | // '/buildings.dvr' |
---|
227 | dvrp_file_c = dvrp_file |
---|
228 | CALL DVRP_OUTPUT_RTSP( m-1, dvrp_host_c, dvrp_username_c, & |
---|
229 | dvrp_password_c, dvrp_directory_c, & |
---|
230 | dvrp_file_c ) |
---|
231 | WRITE ( 9, * ) '*** #3' |
---|
232 | CALL local_flush( 9 ) |
---|
233 | |
---|
234 | ELSEIF ( dvrp_output == 'ftp' ) THEN |
---|
235 | |
---|
236 | dvrp_file = prefix_chr // TRIM( mode_dvrp(m) ) & |
---|
237 | // '.buildings.dvr' |
---|
238 | dvrp_file_c = dvrp_file |
---|
239 | ! CALL DVRP_OUTPUT_FTP( m-1, 0, dvrp_host_c, dvrp_username_c, & |
---|
240 | ! dvrp_password_c, dvrp_directory_c, & |
---|
241 | ! dvrp_file_c ) |
---|
242 | |
---|
243 | ELSE |
---|
244 | |
---|
245 | IF ( dvrp_file(1:9) /= '/dev/null' ) THEN |
---|
246 | dvrp_file_local = prefix_chr // TRIM( mode_dvrp(m) ) & |
---|
247 | // '.buildings.dvr' |
---|
248 | dvrp_file_local_c = dvrp_file_local |
---|
249 | ELSE |
---|
250 | dvrp_file_local_c = dvrp_file_c |
---|
251 | ENDIF |
---|
252 | CALL DVRP_OUTPUT_LOCAL( m-1, 0, dvrp_file_local_c ) |
---|
253 | |
---|
254 | ENDIF |
---|
255 | |
---|
256 | ! |
---|
257 | !-- Determine local gridpoint coordinates |
---|
258 | IF ( .NOT. allocated ) THEN |
---|
259 | ALLOCATE( xcoor_dvrp(nxl:nxr+1), ycoor_dvrp(nys:nyn+1), & |
---|
260 | zcoor_dvrp(nzb:nz_do3d) ) |
---|
261 | allocated = .TRUE. |
---|
262 | |
---|
263 | DO i = nxl, nxr+1 |
---|
264 | xcoor_dvrp(i) = i * dx * superelevation_x |
---|
265 | ENDDO |
---|
266 | DO j = nys, nyn+1 |
---|
267 | ycoor_dvrp(j) = j * dy * superelevation_y |
---|
268 | ENDDO |
---|
269 | zcoor_dvrp = zu(nzb:nz_do3d) * superelevation |
---|
270 | nx_dvrp = nxr+1 - nxl + 1 |
---|
271 | ny_dvrp = nyn+1 - nys + 1 |
---|
272 | nz_dvrp = nz_do3d - nzb + 1 |
---|
273 | ENDIF |
---|
274 | |
---|
275 | ! |
---|
276 | !-- Define the grid used by dvrp |
---|
277 | CALL DVRP_NO_GLOBAL_GRID( m-1, 1 ) |
---|
278 | CALL DVRP_GRID( m-1, nx_dvrp, ny_dvrp, nz_dvrp, xcoor_dvrp, & |
---|
279 | ycoor_dvrp, zcoor_dvrp ) |
---|
280 | |
---|
281 | tmp_r = 0.8; tmp_g = 0.7; tmp_b = 0.6; tmp_t = 0.0 |
---|
282 | CALL DVRP_MATERIAL_RGB( m-1, 1, tmp_r, tmp_g, tmp_b, tmp_t ) |
---|
283 | WRITE ( 9, * ) '*** #4' |
---|
284 | CALL local_flush( 9 ) |
---|
285 | |
---|
286 | ! |
---|
287 | !-- Compute and plot isosurface in dvr-format |
---|
288 | ALLOCATE( local_pf(nxl:nxr+1,nys:nyn+1,nzb:nz_do3d) ) |
---|
289 | local_pf = 0.0 |
---|
290 | DO i = nxl, nxr+1 |
---|
291 | DO j = nys, nyn+1 |
---|
292 | IF ( nzb_s_inner(j,i) > 0 ) THEN |
---|
293 | local_pf(i,j,nzb:nzb_s_inner(j,i)) = 1.0 |
---|
294 | ENDIF |
---|
295 | ENDDO |
---|
296 | ENDDO |
---|
297 | WRITE ( 9, * ) '*** #4.1' |
---|
298 | CALL local_flush( 9 ) |
---|
299 | CALL DVRP_DATA( m-1, local_pf, 1, nx_dvrp, ny_dvrp, nz_dvrp, & |
---|
300 | cyclic_dvrp, cyclic_dvrp, cyclic_dvrp ) |
---|
301 | WRITE ( 9, * ) '*** #4.2' |
---|
302 | CALL local_flush( 9 ) |
---|
303 | tmp_th = 1.0 |
---|
304 | CALL DVRP_THRESHOLD( m-1, tmp_th ) |
---|
305 | WRITE ( 9, * ) '*** #4.3' |
---|
306 | CALL local_flush( 9 ) |
---|
307 | CALL DVRP_VISUALIZE( m-1, 1, 0 ) |
---|
308 | WRITE ( 9, * ) '*** #4.4' |
---|
309 | CALL local_flush( 9 ) |
---|
310 | |
---|
311 | DEALLOCATE( local_pf ) |
---|
312 | |
---|
313 | CALL DVRP_EXIT( m-1 ) |
---|
314 | WRITE ( 9, * ) '*** #5' |
---|
315 | CALL local_flush( 9 ) |
---|
316 | |
---|
317 | ! |
---|
318 | !-- Write the surface isosurface on file |
---|
319 | CALL DVRP_INIT( m-1, 0 ) |
---|
320 | |
---|
321 | ! |
---|
322 | !-- Create filename for surface |
---|
323 | IF ( dvrp_output == 'rtsp' ) THEN |
---|
324 | |
---|
325 | dvrp_file = prefix_chr // TRIM( mode_dvrp(m) ) // '/surface.dvr' |
---|
326 | dvrp_file_c = dvrp_file |
---|
327 | CALL DVRP_OUTPUT_RTSP( m-1, dvrp_host_c, dvrp_username_c, & |
---|
328 | dvrp_password_c, dvrp_directory_c, & |
---|
329 | dvrp_file_c ) |
---|
330 | WRITE ( 9, * ) '*** #6' |
---|
331 | CALL local_flush( 9 ) |
---|
332 | |
---|
333 | ELSEIF ( dvrp_output == 'ftp' ) THEN |
---|
334 | |
---|
335 | dvrp_file = prefix_chr // TRIM( mode_dvrp(m) ) // '.surface.dvr' |
---|
336 | dvrp_file_c = dvrp_file |
---|
337 | ! CALL DVRP_OUTPUT_FTP( m-1, 0, dvrp_host_c, dvrp_username_c, & |
---|
338 | ! dvrp_password_c, dvrp_directory_c, & |
---|
339 | ! dvrp_file_c ) |
---|
340 | |
---|
341 | ELSE |
---|
342 | |
---|
343 | IF ( dvrp_file(1:9) /= '/dev/null' ) THEN |
---|
344 | dvrp_file_local = prefix_chr // TRIM( mode_dvrp(m) ) & |
---|
345 | // '.surface.dvr' |
---|
346 | dvrp_file_local_c = dvrp_file_local |
---|
347 | ELSE |
---|
348 | dvrp_file_local_c = dvrp_file_c |
---|
349 | ENDIF |
---|
350 | CALL DVRP_OUTPUT_LOCAL( m-1, 0, dvrp_file_local_c ) |
---|
351 | |
---|
352 | ENDIF |
---|
353 | |
---|
354 | ! |
---|
355 | !-- Determine local gridpoint coordinates |
---|
356 | IF ( .NOT. allocated ) THEN |
---|
357 | ALLOCATE( xcoor_dvrp(nxl:nxr+1), ycoor_dvrp(nys:nyn+1), & |
---|
358 | zcoor_dvrp(nzb:nz_do3d) ) |
---|
359 | allocated = .TRUE. |
---|
360 | |
---|
361 | DO i = nxl, nxr+1 |
---|
362 | xcoor_dvrp(i) = i * dx * superelevation_x |
---|
363 | ENDDO |
---|
364 | DO j = nys, nyn+1 |
---|
365 | ycoor_dvrp(j) = j * dy * superelevation_y |
---|
366 | ENDDO |
---|
367 | zcoor_dvrp = zu(nzb:nz_do3d) * superelevation |
---|
368 | nx_dvrp = nxr+1 - nxl + 1 |
---|
369 | ny_dvrp = nyn+1 - nys + 1 |
---|
370 | nz_dvrp = nz_do3d - nzb + 1 |
---|
371 | ENDIF |
---|
372 | |
---|
373 | ! |
---|
374 | !-- Define the grid used by dvrp |
---|
375 | CALL DVRP_NO_GLOBAL_GRID( m-1, 1 ) |
---|
376 | CALL DVRP_GRID( m-1, nx_dvrp, ny_dvrp, nz_dvrp, xcoor_dvrp, & |
---|
377 | ycoor_dvrp, zcoor_dvrp ) |
---|
378 | |
---|
379 | tmp_r = 0.0; tmp_g = 0.6; tmp_b = 0.0; tmp_t = 0.0 |
---|
380 | CALL DVRP_MATERIAL_RGB( m-1, 1, tmp_r, tmp_g, tmp_b, tmp_t ) |
---|
381 | WRITE ( 9, * ) '*** #7' |
---|
382 | CALL local_flush( 9 ) |
---|
383 | |
---|
384 | ! |
---|
385 | !-- Compute and plot isosurface in dvr-format |
---|
386 | ALLOCATE( local_pf(nxl:nxr+1,nys:nyn+1,nzb:nz_do3d) ) |
---|
387 | local_pf = 0.0 |
---|
388 | local_pf(:,:,0) = 1.0 |
---|
389 | |
---|
390 | CALL DVRP_DATA( m-1, local_pf, 1, nx_dvrp, ny_dvrp, nz_dvrp, & |
---|
391 | cyclic_dvrp, cyclic_dvrp, cyclic_dvrp ) |
---|
392 | tmp_th = 1.0 |
---|
393 | CALL DVRP_THRESHOLD( m-1, tmp_th ) |
---|
394 | CALL DVRP_VISUALIZE( m-1, 1, 0 ) |
---|
395 | |
---|
396 | DEALLOCATE( local_pf ) |
---|
397 | |
---|
398 | CALL DVRP_EXIT( m-1 ) |
---|
399 | WRITE ( 9, * ) '*** #8' |
---|
400 | CALL local_flush( 9 ) |
---|
401 | |
---|
402 | |
---|
403 | ! ENDIF |
---|
404 | |
---|
405 | |
---|
406 | ! |
---|
407 | !-- Initialize dvrp for all dvrp-calls during the run |
---|
408 | CALL DVRP_INIT( m-1, 0 ) |
---|
409 | |
---|
410 | ! |
---|
411 | !-- Preliminary definition of filename for dvrp-output |
---|
412 | IF ( dvrp_output == 'rtsp' ) THEN |
---|
413 | |
---|
414 | ! |
---|
415 | !-- First initialize parameters for possible interactive steering. |
---|
416 | !-- Every parameter has to be passed to the respective stream. |
---|
417 | pn = 1 |
---|
418 | ! |
---|
419 | !-- Initialize threshold counter needed for initialization of the |
---|
420 | !-- isosurface steering variables |
---|
421 | tv = 0 |
---|
422 | |
---|
423 | DO WHILE ( mode_dvrp(pn) /= ' ' ) |
---|
424 | |
---|
425 | IF ( mode_dvrp(pn)(1:10) == 'isosurface' ) THEN |
---|
426 | |
---|
427 | READ ( mode_dvrp(pn), '(10X,I2)' ) vn |
---|
428 | steering_dvrp(pn)%name = do3d(0,vn) |
---|
429 | tv = tv + 1 |
---|
430 | |
---|
431 | IF ( do3d(0,vn)(1:1) == 'w' ) THEN |
---|
432 | steering_dvrp(pn)%min = -4.0 |
---|
433 | steering_dvrp(pn)%max = 5.0 |
---|
434 | ELSE |
---|
435 | steering_dvrp(pn)%min = 288.0 |
---|
436 | steering_dvrp(pn)%max = 292.0 |
---|
437 | ENDIF |
---|
438 | |
---|
439 | name_c = TRIM( do3d(0,vn) ) |
---|
440 | WRITE ( 9, * ) '*** #9' |
---|
441 | CALL local_flush( 9 ) |
---|
442 | tmp_thr = threshold(tv) |
---|
443 | CALL DVRP_STEERING_INIT( m-1, name_c, steering_dvrp(pn)%min, & |
---|
444 | steering_dvrp(pn)%max, tmp_thr ) |
---|
445 | WRITE ( 9, * ) '*** #10' |
---|
446 | CALL local_flush( 9 ) |
---|
447 | |
---|
448 | ELSEIF ( mode_dvrp(pn)(1:6) == 'slicer' ) THEN |
---|
449 | |
---|
450 | READ ( mode_dvrp(pn), '(6X,I2)' ) vn |
---|
451 | steering_dvrp(pn)%name = do2d(0,vn) |
---|
452 | name_c = TRIM( do2d(0,vn) ) |
---|
453 | |
---|
454 | l = MAX( 2, LEN_TRIM( do2d(0,vn) ) ) |
---|
455 | section_chr = do2d(0,vn)(l-1:l) |
---|
456 | SELECT CASE ( section_chr ) |
---|
457 | CASE ( 'xy' ) |
---|
458 | steering_dvrp(pn)%imin = 0 |
---|
459 | steering_dvrp(pn)%imax = nz_do3d |
---|
460 | slicer_position_dvrp(pn) = section(1,1) |
---|
461 | CALL DVRP_STEERING_INIT( m-1, name_c, & |
---|
462 | steering_dvrp(pn)%imin, & |
---|
463 | steering_dvrp(pn)%imax, & |
---|
464 | slicer_position_dvrp(pn) ) |
---|
465 | CASE ( 'xz' ) |
---|
466 | steering_dvrp(pn)%imin = 0 |
---|
467 | steering_dvrp(pn)%imax = ny |
---|
468 | slicer_position_dvrp(pn) = section(1,2) |
---|
469 | CALL DVRP_STEERING_INIT( m-1, name_c, & |
---|
470 | steering_dvrp(pn)%imin, & |
---|
471 | steering_dvrp(pn)%imax, & |
---|
472 | slicer_position_dvrp(pn) ) |
---|
473 | CASE ( 'yz' ) |
---|
474 | steering_dvrp(pn)%imin = 0 |
---|
475 | steering_dvrp(pn)%imax = nx |
---|
476 | slicer_position_dvrp(pn) = section(1,3) |
---|
477 | CALL DVRP_STEERING_INIT( m-1, name_c, & |
---|
478 | steering_dvrp(pn)%imin, & |
---|
479 | steering_dvrp(pn)%imax, & |
---|
480 | slicer_position_dvrp(pn) ) |
---|
481 | END SELECT |
---|
482 | |
---|
483 | ENDIF |
---|
484 | |
---|
485 | pn = pn + 1 |
---|
486 | |
---|
487 | ENDDO |
---|
488 | |
---|
489 | WRITE ( 9, * ) '*** #11' |
---|
490 | CALL local_flush( 9 ) |
---|
491 | |
---|
492 | dvrp_file = prefix_chr // TRIM( mode_dvrp(m) ) // '/*****.dvr' |
---|
493 | dvrp_file_c = dvrp_file |
---|
494 | CALL DVRP_OUTPUT_RTSP( m-1, dvrp_host_c, dvrp_username_c, & |
---|
495 | dvrp_password_c, dvrp_directory_c, & |
---|
496 | dvrp_file_c ) |
---|
497 | WRITE ( 9, * ) '*** #12' |
---|
498 | CALL local_flush( 9 ) |
---|
499 | |
---|
500 | ELSEIF ( dvrp_output == 'ftp' ) THEN |
---|
501 | |
---|
502 | dvrp_file = prefix_chr // TRIM( mode_dvrp(m) ) // '.%05d.dvr' |
---|
503 | dvrp_file_c = dvrp_file |
---|
504 | ! CALL DVRP_OUTPUT_FTP( m-1, 0, dvrp_host_c, dvrp_username_c, & |
---|
505 | ! dvrp_password_c, dvrp_directory_c, dvrp_file_c ) |
---|
506 | |
---|
507 | ELSE |
---|
508 | |
---|
509 | IF ( dvrp_file(1:9) /= '/dev/null' ) THEN |
---|
510 | dvrp_file_local = prefix_chr // TRIM( mode_dvrp(m) ) & |
---|
511 | // '_%05d.dvr' |
---|
512 | dvrp_file_local_c = dvrp_file_local |
---|
513 | ELSE |
---|
514 | dvrp_file_local_c = dvrp_file_c |
---|
515 | ENDIF |
---|
516 | CALL DVRP_OUTPUT_LOCAL( m-1, 0, dvrp_file_local_c ) |
---|
517 | |
---|
518 | ENDIF |
---|
519 | |
---|
520 | ! dvrp_file = prefix_chr // TRIM( mode_dvrp(m) ) // '.%05d.dvr' & |
---|
521 | ! // CHAR( 0 ) |
---|
522 | ! dvrp_file = prefix_chr // TRIM( mode_dvrp(m) ) // '/*****.dvr' & |
---|
523 | ! // CHAR( 0 ) |
---|
524 | ! dvrp_file = '/dev/null' // CHAR( 0 ) |
---|
525 | ! CALL DVRP_OUTPUT_FTP( m-1, 0, dvrp_host, dvrp_username, dvrp_password, & |
---|
526 | ! dvrp_directory, dvrp_file ) |
---|
527 | ! CALL DVRP_OUTPUT_RTSP( m-1, dvrp_host, dvrp_username, dvrp_password, & |
---|
528 | ! dvrp_directory, dvrp_file ) |
---|
529 | ! CALL DVRP_OUTPUT_LOCAL( m-1, 0, dvrp_file ) |
---|
530 | |
---|
531 | ! |
---|
532 | !-- Determine local gridpoint coordinates |
---|
533 | IF ( .NOT. allocated ) THEN |
---|
534 | ALLOCATE( xcoor_dvrp(nxl:nxr+1), ycoor_dvrp(nys:nyn+1), & |
---|
535 | zcoor_dvrp(nzb:nz_do3d) ) |
---|
536 | allocated = .TRUE. |
---|
537 | |
---|
538 | DO i = nxl, nxr+1 |
---|
539 | xcoor_dvrp(i) = i * dx * superelevation_x |
---|
540 | ENDDO |
---|
541 | DO j = nys, nyn+1 |
---|
542 | ycoor_dvrp(j) = j * dy * superelevation_y |
---|
543 | ENDDO |
---|
544 | zcoor_dvrp = zu(nzb:nz_do3d) * superelevation |
---|
545 | nx_dvrp = nxr+1 - nxl + 1 |
---|
546 | ny_dvrp = nyn+1 - nys + 1 |
---|
547 | nz_dvrp = nz_do3d - nzb + 1 |
---|
548 | ENDIF |
---|
549 | |
---|
550 | ! |
---|
551 | !-- Define the grid used by dvrp |
---|
552 | WRITE ( 9, * ) '*** #13' |
---|
553 | CALL local_flush( 9 ) |
---|
554 | |
---|
555 | IF ( mode_dvrp(m) /= 'pathlines' ) THEN |
---|
556 | CALL DVRP_NO_GLOBAL_GRID( m-1, 1 ) |
---|
557 | ENDIF |
---|
558 | CALL DVRP_GRID( m-1, nx_dvrp, ny_dvrp, nz_dvrp, xcoor_dvrp, ycoor_dvrp, & |
---|
559 | zcoor_dvrp ) |
---|
560 | |
---|
561 | IF ( mode_dvrp(m) == 'pathlines' ) THEN |
---|
562 | |
---|
563 | tmp_x1 = 0.0; tmp_y1 = 0.0; tmp_z1 = 0.0 |
---|
564 | tmp_x2 = 1.0; tmp_y2 = 1.0; tmp_z2 = 0.3 |
---|
565 | CALL DVRP_CUBIC_SEEDING( m-1, tmp_x1, tmp_y1, tmp_z1, tmp_x2, tmp_y2,& |
---|
566 | tmp_z2, pathlines_linecount, 2, 0 ) |
---|
567 | ! |
---|
568 | !-- Set wavecount and wavetime |
---|
569 | CALL DVRP_PATHLINES_BEHAVIOUR_WAVE( m-1, pathlines_wavecount, & |
---|
570 | pathlines_wavetime, & |
---|
571 | pathlines_fadeintime, & |
---|
572 | pathlines_fadeouttime ) |
---|
573 | ! |
---|
574 | !-- Set pathline length |
---|
575 | CALL DVRP_PATHLINES_SETMAXHISTORY( m-1, pathlines_maxhistory ) |
---|
576 | CALL DVRP_PATHLINES_SETFADING( m-1, 1, 0.0 ) |
---|
577 | |
---|
578 | CALL DVRP_INIT_PATHLINES( m-1, 0 ) |
---|
579 | |
---|
580 | ENDIF |
---|
581 | |
---|
582 | WRITE ( 9, * ) '*** #14' |
---|
583 | CALL local_flush( 9 ) |
---|
584 | |
---|
585 | |
---|
586 | m = m + 1 |
---|
587 | |
---|
588 | ENDDO |
---|
589 | |
---|
590 | #endif |
---|
591 | END SUBROUTINE init_dvrp |
---|
592 | |
---|
593 | |
---|
594 | SUBROUTINE init_dvrp_logging |
---|
595 | |
---|
596 | !------------------------------------------------------------------------------! |
---|
597 | ! Description: |
---|
598 | ! ------------ |
---|
599 | ! Initializes logging events for time measurement with dvrp software |
---|
600 | ! and splits one PE from the global communicator in case that dvrp output |
---|
601 | ! shall be done by one single PE. |
---|
602 | !------------------------------------------------------------------------------! |
---|
603 | #if defined( __dvrp_graphics ) |
---|
604 | |
---|
605 | USE control_parameters |
---|
606 | USE dvrp_variables |
---|
607 | USE pegrid |
---|
608 | |
---|
609 | IMPLICIT NONE |
---|
610 | |
---|
611 | CHARACTER (LEN=4) :: chr |
---|
612 | INTEGER :: idummy |
---|
613 | |
---|
614 | ! |
---|
615 | !-- Initialize logging of calls by DVRP graphic software |
---|
616 | WRITE ( 9, * ) '*** myid=', myid, ' vor DVRP_LOG_INIT' |
---|
617 | CALL local_flush( 9 ) |
---|
618 | CALL DVRP_LOG_INIT( 'DVRP_LOG' // CHAR( 0 ), 0 ) |
---|
619 | WRITE ( 9, * ) '*** myid=', myid, ' nach DVRP_LOG_INIT' |
---|
620 | CALL local_flush( 9 ) |
---|
621 | |
---|
622 | ! |
---|
623 | !-- User-defined logging events: #1 (total time needed by PALM) |
---|
624 | WRITE ( 9, * ) '*** myid=', myid, ' vor DVRP_LOG_SYMBOL' |
---|
625 | CALL local_flush( 9 ) |
---|
626 | CALL DVRP_LOG_SYMBOL( 1, 'PALM_total' // CHAR( 0 ) ) |
---|
627 | WRITE ( 9, * ) '*** myid=', myid, ' nach DVRP_LOG_SYMBOL' |
---|
628 | CALL local_flush( 9 ) |
---|
629 | CALL DVRP_LOG_SYMBOL( 2, 'PALM_timestep' // CHAR( 0 ) ) |
---|
630 | WRITE ( 9, * ) '*** myid=', myid, ' vor DVRP_LOG_EVENT' |
---|
631 | CALL local_flush( 9 ) |
---|
632 | CALL DVRP_LOG_EVENT( 1, 1 ) |
---|
633 | WRITE ( 9, * ) '*** myid=', myid, ' nach DVRP_LOG_EVENT' |
---|
634 | CALL local_flush( 9 ) |
---|
635 | |
---|
636 | #if defined( __parallel ) |
---|
637 | ! |
---|
638 | !-- Find out, if dvrp output shall be done by a dedicated PE |
---|
639 | CALL local_getenv( 'use_seperate_pe_for_dvrp_output', 31, chr, idummy ) |
---|
640 | IF ( chr == 'true' ) THEN |
---|
641 | use_seperate_pe_for_dvrp_output = .TRUE. |
---|
642 | WRITE ( 9, * ) '*** myid=', myid, ' vor DVRP_SPLIT' |
---|
643 | CALL local_flush( 9 ) |
---|
644 | |
---|
645 | ! |
---|
646 | !-- Adjustment for new MPI-1 coupling. This might be unnecessary. |
---|
647 | #if defined( __mpi2 ) |
---|
648 | CALL DVRP_SPLIT( MPI_COMM_WORLD, comm_palm ) |
---|
649 | #else |
---|
650 | IF ( coupling_mode /= 'uncoupled' ) THEN |
---|
651 | IF ( myid == 0 ) THEN |
---|
652 | PRINT*, '+++ init_dvrp: split of communicator not realized with', & |
---|
653 | ' MPI1 coupling atmosphere-ocean' |
---|
654 | ENDIF |
---|
655 | CALL local_stop |
---|
656 | ! CALL DVRP_SPLIT( comm_inter, comm_palm ) |
---|
657 | ELSE |
---|
658 | CALL DVRP_SPLIT( MPI_COMM_WORLD, comm_palm ) |
---|
659 | ENDIF |
---|
660 | #endif |
---|
661 | |
---|
662 | WRITE ( 9, * ) '*** myid=', myid, ' nach DVRP_SPLIT' |
---|
663 | CALL local_flush( 9 ) |
---|
664 | CALL MPI_COMM_SIZE( comm_palm, numprocs, ierr ) |
---|
665 | ENDIF |
---|
666 | #endif |
---|
667 | |
---|
668 | #endif |
---|
669 | END SUBROUTINE init_dvrp_logging |
---|
670 | |
---|
671 | |
---|
672 | SUBROUTINE close_dvrp |
---|
673 | |
---|
674 | !------------------------------------------------------------------------------! |
---|
675 | ! Description: |
---|
676 | ! ------------ |
---|
677 | ! Exit of dvrp software and finish dvrp logging |
---|
678 | !------------------------------------------------------------------------------! |
---|
679 | #if defined( __dvrp_graphics ) |
---|
680 | |
---|
681 | USE control_parameters |
---|
682 | USE dvrp |
---|
683 | USE dvrp_variables |
---|
684 | |
---|
685 | INTEGER :: m |
---|
686 | |
---|
687 | ! |
---|
688 | !-- If required, close dvrp-software and logging of dvrp-calls |
---|
689 | IF ( dt_dvrp /= 9999999.9 ) THEN |
---|
690 | m = 1 |
---|
691 | DO WHILE ( mode_dvrp(m) /= ' ' ) |
---|
692 | CALL DVRP_EXIT( m-1 ) |
---|
693 | m = m + 1 |
---|
694 | ENDDO |
---|
695 | CALL DVRP_LOG_EVENT( -1, 1 ) ! Logging of total cpu-time used by PALM |
---|
696 | IF ( use_seperate_pe_for_dvrp_output ) THEN |
---|
697 | CALL DVRP_SPLIT_EXIT( 1 ) ! Argument 0: reduced output |
---|
698 | ELSE |
---|
699 | CALL DVRP_LOG_EXIT( 1 ) ! Argument 0: reduced output |
---|
700 | ENDIF |
---|
701 | ENDIF |
---|
702 | |
---|
703 | #endif |
---|
704 | END SUBROUTINE close_dvrp |
---|