Changeset 849 for palm/trunk/SOURCE/lpm_init.f90
- Timestamp:
- Mar 15, 2012 10:35:09 AM (12 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/lpm_init.f90
r848 r849 1 SUBROUTINE init_particles1 SUBROUTINE lpm_init 2 2 3 3 !------------------------------------------------------------------------------! 4 4 ! Current revisions: 5 5 ! ----------------- 6 ! 6 ! routine renamed: init_particles -> lpm_init 7 ! de_dx, de_dy, de_dz are allocated here (instead of automatic arrays in 8 ! advec_particles), 9 ! sort_particles renamed lpm_sort_arrays, user_init_particles renamed lpm_init 7 10 ! 8 11 ! Former revisions: … … 65 68 ! ------------ 66 69 ! This routine initializes a set of particles and their attributes (position, 67 ! radius, ..). Advection of these particles is carried out by advec_particles, 68 ! plotting is done in data_output_dvrp. 70 ! radius, ..) which are used by the Lagrangian particle model (see lpm). 69 71 !------------------------------------------------------------------------------! 70 72 … … 83 85 IMPLICIT NONE 84 86 85 CHARACTER (LEN=10) :: particle_binary_version, version_on_file86 87 87 INTEGER :: i, j, n, nn 88 88 #if defined( __parallel ) … … 124 124 '&number_of_particle_groups reset to ', & 125 125 max_number_of_particle_groups 126 CALL message( ' init_particles', 'PA0213', 0, 1, 0, 6, 0 )126 CALL message( 'lpm_init', 'PA0213', 0, 1, 0, 6, 0 ) 127 127 number_of_particle_groups = max_number_of_particle_groups 128 128 ENDIF … … 154 154 155 155 ! 156 !-- Allocate arrays required for calculating particle SGS velocities 157 IF ( use_sgs_for_particles ) THEN 158 ALLOCATE( de_dx(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & 159 de_dy(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & 160 de_dz(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) 161 ENDIF 162 163 ! 156 164 !-- Initialize collision kernels 157 165 IF ( collision_kernel /= 'none' ) CALL init_kernels … … 159 167 ! 160 168 !-- For the first model run of a possible job chain initialize the 161 !-- particles, otherwise read the particle data from file.169 !-- particles, otherwise read the particle data from restart file. 162 170 IF ( TRIM( initializing_actions ) == 'read_restart_data' & 163 171 .AND. read_particles_from_restartfile ) THEN 164 172 165 ! 166 !-- Read particle data from previous model run. 167 !-- First open the input unit. 168 IF ( myid_char == '' ) THEN 169 OPEN ( 90, FILE='PARTICLE_RESTART_DATA_IN'//myid_char, & 170 FORM='UNFORMATTED' ) 171 ELSE 172 OPEN ( 90, FILE='PARTICLE_RESTART_DATA_IN/'//myid_char, & 173 FORM='UNFORMATTED' ) 174 ENDIF 175 176 ! 177 !-- First compare the version numbers 178 READ ( 90 ) version_on_file 179 particle_binary_version = '3.0' 180 IF ( TRIM( version_on_file ) /= TRIM( particle_binary_version ) ) THEN 181 message_string = 'version mismatch concerning data from prior ' // & 182 'run &version on file = "' // & 183 TRIM( version_on_file ) // & 184 '&version in program = "' // & 185 TRIM( particle_binary_version ) // '"' 186 CALL message( 'init_particles', 'PA0214', 1, 2, 0, 6, 0 ) 187 ENDIF 188 189 ! 190 !-- Read some particle parameters and the size of the particle arrays, 191 !-- allocate them and read their contents. 192 READ ( 90 ) bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, & 193 maximum_number_of_particles, maximum_number_of_tailpoints, & 194 maximum_number_of_tails, number_of_initial_particles, & 195 number_of_particles, number_of_particle_groups, & 196 number_of_tails, particle_groups, time_prel, & 197 time_write_particle_data, uniform_particles 198 199 IF ( number_of_initial_particles /= 0 ) THEN 200 ALLOCATE( initial_particles(1:number_of_initial_particles) ) 201 READ ( 90 ) initial_particles 202 ENDIF 203 204 ALLOCATE( prt_count(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & 205 prt_start_index(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & 206 particle_mask(maximum_number_of_particles), & 207 part_1(maximum_number_of_particles), & 208 part_2(maximum_number_of_particles) ) 209 210 part_1 = particle_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, & 211 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, & 212 0.0, 0, 0, 0, 0 ) 213 214 part_2 = particle_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, & 215 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, & 216 0.0, 0, 0, 0, 0 ) 217 218 sort_count = 0 219 220 particles => part_1 221 222 READ ( 90 ) prt_count, prt_start_index 223 READ ( 90 ) particles 224 225 IF ( use_particle_tails ) THEN 226 ALLOCATE( particle_tail_coordinates(maximum_number_of_tailpoints,5, & 227 maximum_number_of_tails), & 228 new_tail_id(maximum_number_of_tails), & 229 tail_mask(maximum_number_of_tails) ) 230 READ ( 90 ) particle_tail_coordinates 231 ENDIF 232 233 CLOSE ( 90 ) 173 CALL lpm_read_restart_file 234 174 235 175 ELSE … … 278 218 WRITE( message_string, * ) 'particle group #', i, 'has a', & 279 219 'density ratio /= 0 but radius = 0' 280 CALL message( ' init_particles', 'PA0215', 1, 2, 0, 6, 0 )220 CALL message( 'lpm_init', 'PA0215', 1, 2, 0, 6, 0 ) 281 221 ENDIF 282 222 particle_groups(i)%density_ratio = density_ratio(i) … … 318 258 maximum_number_of_particles, ') on PE ', & 319 259 myid 320 CALL message( ' init_particles', 'PA0216',&321 2, 2, -1, 6,1 )260 CALL message( 'lpm_init', 'PA0216', 2, 2, -1, 6,& 261 1 ) 322 262 ENDIF 323 263 particles(n)%x = pos_x … … 410 350 ! 411 351 !-- User modification of initial particles 412 CALL user_ init_particles352 CALL user_lpm_init 413 353 414 354 ! … … 456 396 !-- Sort particles in the sequence the gridboxes are stored in the memory. 457 397 !-- Only required if cloud droplets are used. 458 IF ( cloud_droplets ) CALL sort_particles398 IF ( cloud_droplets ) CALL lpm_sort_arrays 459 399 460 400 ! … … 575 515 WRITE( message_string, * ) 'unknown boundary condition ', & 576 516 'bc_par_b = "', TRIM( bc_par_b ), '"' 577 CALL message( ' init_particles', 'PA0217', 1, 2, 0, 6, 0 )517 CALL message( 'lpm_init', 'PA0217', 1, 2, 0, 6, 0 ) 578 518 579 519 END SELECT … … 589 529 WRITE( message_string, * ) 'unknown boundary condition ', & 590 530 'bc_par_t = "', TRIM( bc_par_t ), '"' 591 CALL message( ' init_particles', 'PA0218', 1, 2, 0, 6, 0 )531 CALL message( 'lpm_init', 'PA0218', 1, 2, 0, 6, 0 ) 592 532 593 533 END SELECT … … 606 546 WRITE( message_string, * ) 'unknown boundary condition ', & 607 547 'bc_par_lr = "', TRIM( bc_par_lr ), '"' 608 CALL message( ' init_particles', 'PA0219', 1, 2, 0, 6, 0 )548 CALL message( 'lpm_init', 'PA0219', 1, 2, 0, 6, 0 ) 609 549 610 550 END SELECT … … 623 563 WRITE( message_string, * ) 'unknown boundary condition ', & 624 564 'bc_par_ns = "', TRIM( bc_par_ns ), '"' 625 CALL message( ' init_particles', 'PA0220', 1, 2, 0, 6, 0 )565 CALL message( 'lpm_init', 'PA0220', 1, 2, 0, 6, 0 ) 626 566 627 567 END SELECT … … 630 570 8000 FORMAT (I6,1X,F7.2,4X,I6,71X,I6) 631 571 632 END SUBROUTINE init_particles572 END SUBROUTINE lpm_init
Note: See TracChangeset
for help on using the changeset viewer.