[849] | 1 | SUBROUTINE lpm_read_restart_file |
---|
| 2 | |
---|
| 3 | !------------------------------------------------------------------------------! |
---|
| 4 | ! Current revisions: |
---|
| 5 | ! ------------------ |
---|
| 6 | ! |
---|
| 7 | ! |
---|
| 8 | ! Former revisions: |
---|
| 9 | ! ----------------- |
---|
| 10 | ! $Id: lpm_read_restart_file.f90 849 2012-03-15 10:35:09Z raasch $ |
---|
| 11 | ! |
---|
| 12 | ! |
---|
| 13 | ! Description: |
---|
| 14 | ! ------------ |
---|
| 15 | ! Read particle data from the restart file. |
---|
| 16 | !------------------------------------------------------------------------------! |
---|
| 17 | |
---|
| 18 | USE control_parameters |
---|
| 19 | USE indices |
---|
| 20 | USE particle_attributes |
---|
| 21 | USE pegrid |
---|
| 22 | |
---|
| 23 | IMPLICIT NONE |
---|
| 24 | |
---|
| 25 | CHARACTER (LEN=10) :: particle_binary_version, version_on_file |
---|
| 26 | |
---|
| 27 | ! |
---|
| 28 | !-- Read particle data from previous model run. |
---|
| 29 | !-- First open the input unit. |
---|
| 30 | IF ( myid_char == '' ) THEN |
---|
| 31 | OPEN ( 90, FILE='PARTICLE_RESTART_DATA_IN'//myid_char, & |
---|
| 32 | FORM='UNFORMATTED' ) |
---|
| 33 | ELSE |
---|
| 34 | OPEN ( 90, FILE='PARTICLE_RESTART_DATA_IN/'//myid_char, & |
---|
| 35 | FORM='UNFORMATTED' ) |
---|
| 36 | ENDIF |
---|
| 37 | |
---|
| 38 | ! |
---|
| 39 | !-- First compare the version numbers |
---|
| 40 | READ ( 90 ) version_on_file |
---|
| 41 | particle_binary_version = '3.0' |
---|
| 42 | IF ( TRIM( version_on_file ) /= TRIM( particle_binary_version ) ) THEN |
---|
| 43 | message_string = 'version mismatch concerning data from prior ' // & |
---|
| 44 | 'run &version on file = "' // & |
---|
| 45 | TRIM( version_on_file ) // & |
---|
| 46 | '&version in program = "' // & |
---|
| 47 | TRIM( particle_binary_version ) // '"' |
---|
| 48 | CALL message( 'lpm_read_restart_file', 'PA0214', 1, 2, 0, 6, 0 ) |
---|
| 49 | ENDIF |
---|
| 50 | |
---|
| 51 | ! |
---|
| 52 | !-- Read some particle parameters and the size of the particle arrays, |
---|
| 53 | !-- allocate them and read their contents. |
---|
| 54 | READ ( 90 ) bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, & |
---|
| 55 | maximum_number_of_particles, maximum_number_of_tailpoints, & |
---|
| 56 | maximum_number_of_tails, number_of_initial_particles, & |
---|
| 57 | number_of_particles, number_of_particle_groups, & |
---|
| 58 | number_of_tails, particle_groups, time_prel, & |
---|
| 59 | time_write_particle_data, uniform_particles |
---|
| 60 | |
---|
| 61 | IF ( number_of_initial_particles /= 0 ) THEN |
---|
| 62 | ALLOCATE( initial_particles(1:number_of_initial_particles) ) |
---|
| 63 | READ ( 90 ) initial_particles |
---|
| 64 | ENDIF |
---|
| 65 | |
---|
| 66 | ALLOCATE( prt_count(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 67 | prt_start_index(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 68 | particle_mask(maximum_number_of_particles), & |
---|
| 69 | part_1(maximum_number_of_particles), & |
---|
| 70 | part_2(maximum_number_of_particles) ) |
---|
| 71 | |
---|
| 72 | part_1 = particle_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, & |
---|
| 73 | 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, & |
---|
| 74 | 0.0, 0, 0, 0, 0 ) |
---|
| 75 | |
---|
| 76 | part_2 = particle_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, & |
---|
| 77 | 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, & |
---|
| 78 | 0.0, 0, 0, 0, 0 ) |
---|
| 79 | |
---|
| 80 | sort_count = 0 |
---|
| 81 | |
---|
| 82 | particles => part_1 |
---|
| 83 | |
---|
| 84 | READ ( 90 ) prt_count, prt_start_index |
---|
| 85 | READ ( 90 ) particles |
---|
| 86 | |
---|
| 87 | IF ( use_particle_tails ) THEN |
---|
| 88 | ALLOCATE( particle_tail_coordinates(maximum_number_of_tailpoints,5, & |
---|
| 89 | maximum_number_of_tails), & |
---|
| 90 | new_tail_id(maximum_number_of_tails), & |
---|
| 91 | tail_mask(maximum_number_of_tails) ) |
---|
| 92 | READ ( 90 ) particle_tail_coordinates |
---|
| 93 | ENDIF |
---|
| 94 | |
---|
| 95 | CLOSE ( 90 ) |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | END SUBROUTINE lpm_read_restart_file |
---|