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