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