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