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