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