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