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