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