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