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